@libxai/board 0.11.9 → 0.11.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +7 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Ro({templates:e,onSelectTemplate:t,className:r}){let[a,n]=ve.useState(false),o=ve.useRef(null),s=ve.useRef(null);ve.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:ee("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:ee("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Io({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,l]=ve.useState("export"),[c,i]=ve.useState("json"),[u,d]=ve.useState(null),f=ve.useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,g=await Fs(e,c,x);Bs(g,c);},y=async x=>{let g=x.target.files?.[0];if(g){try{let h=await Hs(g),v=g.name.endsWith(".json")?"json":"csv",m=zs(h,v);d(m),m.success&&a&&a(m,h);}catch(h){d({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}f.current&&(f.current.value="");}};return jsxRuntime.jsxs("div",{className:ee("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:ee("flex-1 px-6 py-4 font-semibold transition-colors",s==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:ee("flex-1 px-6 py-4 font-semibold transition-colors",s==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[s==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:ee("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:p,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"})]}),s==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:f,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>f.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:ee("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:[jsxRuntime.jsx("h3",{className:ee("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},g))})]})]})]})]})]})}var Kp=["URGENT","HIGH","MEDIUM","LOW"],jp=[{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"}],qp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Mo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:f=false,groupBy:p="none",onGroupByChange:y}){let[x,g]=ve.useState(true),h=ve.useCallback(b=>{r({search:b.target.value});},[r]),v=ve.useCallback(b=>{r({dateFilter:b.target.value});},[r]),m=ve.useCallback(b=>{a({by:b.target.value});},[a]),w=ve.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${f?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:b=>{let C=b.target.value;r({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Kp.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let C=b.target.value;r({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let C=b.target.value;r({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:m,className:"filter-bar__select filter-bar__select--sm",children:jp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:p,onChange:b=>y(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:qp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ao({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=ve.useState(false),d=ve.useRef(null);ve.useEffect(()=>{let p=y=>{d.current&&!d.current.contains(y.target)&&u(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let f=p=>{p(),u(false);};return jsxRuntime.jsxs("div",{className:ee("relative",a),ref:d,children:[jsxRuntime.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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>f(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>f(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>f(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>f(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>f(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>f(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>f(r),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Lo={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Fo={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Bo={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"}},Ar={dark:Lo,light:Fo,neutral:Bo},vn="dark";var bn=ve.createContext(void 0),nm="asakaa-theme";function il({children:e,defaultTheme:t=vn,storageKey:r=nm}){let[a,n]=ve.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),o=ve.useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);ve.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Ar[a];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${om(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let f=c.colors[u];f&&l.style.setProperty(d,f);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:Ar};return jsxRuntime.jsx(bn.Provider,{value:s,children:e})}function ta(){let e=ve.useContext(bn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function om(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Oo({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ta();return e?jsxRuntime.jsxs("div",{className:ee("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ar).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:ee("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},o))})]})]}):null}var fe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1E2228",bgWeekend:"rgba(139, 92, 246, 0.03)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",accent:"#8B5CF6",accentHover:"#9D72F8",accentLight:"rgba(139, 92, 246, 0.12)",taskBarPrimary:"#8B5CF6",taskBarProgress:"#7C3AED",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#8B5CF6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#8B5CF6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FCFCFD",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FEFEFE",bgWeekend:"rgba(41, 37, 36, 0.025)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function ll(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return fe[e]||fe.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",fe[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",fe[e].bgSecondary),bgGrid:a("--theme-bg-card",fe[e].bgGrid),bgWeekend:a("--theme-bg-hover",fe[e].bgWeekend),border:a("--theme-border-primary",fe[e].border),borderLight:a("--theme-border-subtle",fe[e].borderLight),textPrimary:a("--theme-text-primary",fe[e].textPrimary),textSecondary:a("--theme-text-secondary",fe[e].textSecondary),textTertiary:a("--theme-text-tertiary",fe[e].textTertiary),accent:a("--theme-accent-primary",fe[e].accent),accentHover:a("--theme-accent-hover",fe[e].accentHover),accentLight:a("--theme-accent-primary",fe[e].accentLight),taskBarPrimary:a("--theme-accent-primary",fe[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",fe[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",fe[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",fe[e].dependency),dependencyHover:a("--theme-border-secondary",fe[e].dependencyHover),criticalPath:a("--theme-error",fe[e].criticalPath),criticalPathLight:a("--theme-error",fe[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",fe[e].today):e==="neutral"?a("--theme-text-primary",fe[e].today):a("--theme-error",fe[e].today),todayLight:e==="light"?a("--theme-accent-primary",fe[e].todayLight):e==="neutral"?a("--theme-text-primary",fe[e].todayLight):a("--theme-error",fe[e].todayLight),milestone:a("--theme-warning",fe[e].milestone),milestoneLight:a("--theme-warning",fe[e].milestoneLight),statusTodo:a("--theme-text-tertiary",fe[e].statusTodo),statusInProgress:a("--theme-accent-primary",fe[e].statusInProgress),statusCompleted:a("--theme-success",fe[e].statusCompleted),hoverBg:a("--theme-bg-hover",fe[e].hoverBg),focusRing:a("--theme-accent-primary",fe[e].focusRing)}}function Go({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(n=>{let o=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"activeSegment",className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.label})]},n.value)})})}function xn({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=true}){let u=[{value:"day",label:"Day",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"week",label:"Week",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"month",label:"Month",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})}],d=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],f=[{value:"compact",label:"Compact",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"comfortable",label:"Comfortable",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"spacious",label:"Spacious",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-14 px-6 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Go,{options:u,value:t,onChange:p=>r(p),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})}),jsxRuntime.jsxs("div",{className:"px-3 py-1 rounded-md text-xs tabular-nums min-w-[50px] text-center",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`,color:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Go,{options:f,value:l,onChange:p=>c(p),theme:e})]}),i&&jsxRuntime.jsx(Go,{options:d,value:o,onChange:p=>s(p),theme:e})]})}function kn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=ve.useState(false),[o,s]=ve.useState({x:0,y:0}),l=ve.useRef(null),c=ve.useRef(null);ve.useEffect(()=>{if(!a)return;let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Xe,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,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:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.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:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function aa({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=ve.useRef(null);return ve.useEffect(()=>{if(!e)return;let l=i=>{s.current&&!s.current.contains(i.target)&&n();},c=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,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 shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(l=>jsxRuntime.jsxs("div",{children:[l.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{l.disabled||(l.onClick(),n());},disabled:l.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:l.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:l.disabled?"not-allowed":"pointer",opacity:l.disabled?.5:1},onMouseEnter:c=>{l.disabled||(c.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[l.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:l.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:l.label}),l.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},l.id))})})}):null}var St={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"})};function ml({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:f=true}){let p=ve.useRef(false),y=ve.useCallback(m=>{p.current=m;},[]),x=ve.useCallback(m=>{let w=[],k=b=>{for(let C of b)w.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&k(C.subtasks);};return k(m),w},[]),g=ve.useCallback(()=>{let m=x(e);for(let w of m)if(t.has(w.id))return w;return null},[e,t,x]),h=ve.useCallback((m,w)=>{let k=x(e);if(k.length===0)return;let b=g();if(!b){r(k[0].id,false);return}let C=k.findIndex(S=>S.id===b.id);if(C===-1)return;let T=m==="up"?C-1:C+1;if(T<0||T>=k.length)return;let D=k[T];r(D.id,w);},[e,g,x,r]),v=ve.useCallback(m=>{if(!f)return;let w=m.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){m.key==="Escape"&&(w.blur(),p.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?m.metaKey:m.ctrlKey,T=Array.from(t),D=g();if(m.key==="ArrowUp"){m.preventDefault(),h("up",m.shiftKey);return}if(m.key==="ArrowDown"){m.preventDefault(),h("down",m.shiftKey);return}if(D&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(m.preventDefault(),(m.key==="ArrowRight"&&!D.isExpanded||m.key==="ArrowLeft"&&D.isExpanded)&&u(D.id));return}if(m.altKey&&(m.key==="ArrowUp"||m.key==="ArrowDown")){T.length>0&&(m.preventDefault(),s(T,m.key==="ArrowUp"?"up":"down"));return}if(m.key==="Tab"&&!m.shiftKey){T.length>0&&(m.preventDefault(),l(T));return}if(m.key==="Tab"&&m.shiftKey){T.length>0&&(m.preventDefault(),c(T));return}if(m.key==="Enter"&&!m.shiftKey&&!C){D&&(m.preventDefault(),a(D.id,"below"));return}if(m.key==="Enter"&&m.shiftKey&&!C){D&&(m.preventDefault(),a(D.id,"above"));return}if(m.key==="Enter"&&C){D&&(m.preventDefault(),d(D.id));return}if(m.key==="F2"){D&&(m.preventDefault(),i(D.id));return}if(m.key==="Delete"||m.key==="Backspace"&&C){T.length>0&&(m.preventDefault(),n(T));return}if(m.key==="d"&&C&&!m.shiftKey){T.length>0&&(m.preventDefault(),o(T));return}},[f,t,g,h,a,n,o,s,l,c,i,u,d]);return ve.useEffect(()=>{if(f)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[f,v]),{setIsEditing:y}}function gl(){let[e,t]=ve.useState(new Set),[r,a]=ve.useState(null),n=ve.useCallback(d=>{t(new Set([d])),a(d);},[]),o=ve.useCallback(d=>{t(f=>{let p=new Set(f);return p.has(d)?p.delete(d):p.add(d),p}),a(d);},[]),s=ve.useCallback((d,f)=>{if(!r){n(d);return}let p=f.indexOf(r),y=f.indexOf(d);if(p===-1||y===-1){n(d);return}let x=Math.min(p,y),g=Math.max(p,y),h=f.slice(x,g+1);t(new Set(h)),a(d);},[r,n]),l=ve.useCallback((d,f,p,y)=>{y?s(d,f):p?o(d):n(d);},[n,o,s]),c=ve.useCallback((d,f)=>{f?t(p=>{let y=new Set(p);return y.add(d),y}):n(d);},[n]),i=ve.useCallback(()=>{t(new Set),a(null);},[]),u=ve.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function na(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let l={...a[s],parentId:n,level:o,position:s};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,o+1);}};return r(e),t}function _o(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=_o(r.subtasks,t);if(a)return a}return null}function $o(e,t){if(t.length===0)return e;let r=na(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let o=r[n-1],s=(d,f)=>{let p=[];return {tasks:d.filter(x=>{if(f.has(x.id))return p.push(x),false;if(x.subtasks){let g=s(x.subtasks,f);x.subtasks=g.tasks,p.push(...g.removed);}return true}),removed:p}},l=(d,f,p)=>d.map(y=>y.id===f?{...y,subtasks:[...y.subtasks||[],...p],isExpanded:true}:y.subtasks?{...y,subtasks:l(y.subtasks,f,p)}:y),c=new Set(t),{tasks:i,removed:u}=s(e,c);return l(i,o.id,u)}function Wo(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=_o(r,a);if(!n)continue;let o=_o(r,n.id),s=(i,u,d)=>{for(let f=0;f<i.length;f++){let p=i[f];if(p.id===u&&p.subtasks){let y=p.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=p.subtasks.splice(y,1);return x}}if(p.subtasks){let y=s(p.subtasks,u,d);if(y)return y}}return null},l=(i,u,d)=>{let f=i.findIndex(p=>p.id===u);if(f!==-1)return i.splice(f+1,0,d),i;for(let p of i)p.subtasks&&l(p.subtasks,u,d);return i},c=s(r,n.id,a);c&&(o&&o.subtasks?l(o.subtasks,n.id,c):l(r,n.id,c));}return r}function Vo(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,l,c)=>{let i=s.findIndex(d=>d.id===l);if(i===-1){for(let d of s)if(d.subtasks&&o(d.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function Ko(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function jo(e,t){let r=[...e];for(let a of t){let n=s=>{let l=s.findIndex(u=>u.id===a);if(l===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let c=s[l],i={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?o(c.subtasks):void 0};return s.splice(l+1,0,i),true},o=s=>s.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?o(l.subtasks):void 0}));n(r);}return r}function hl(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,color:"#6366F1"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let u=r==="above"?i:i+1;return c.splice(u,0,s),true};return l(a),{tasks:a,newTask:s}}function qo(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:qo(a.subtasks,t,r)}:a)}function Yo(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:Yo(r.subtasks,t)}:r)}function Xo(e,t){let r=new Date,a=new Date(r);a.setDate(a.getDate()+7);let n=c=>{for(let i of c){if(i.id===t)return i;if(i.subtasks){let u=n(i.subtasks);if(u)return u}}return null},o=n(e),s={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:r,endDate:a,color:o?.color||"#6366F1"},l=c=>c.map(i=>{if(i.id===t){let u=i.subtasks||[];return {...i,subtasks:[...u,s],isExpanded:true}}return i.subtasks?{...i,subtasks:l(i.subtasks)}:i});return {tasks:l(e),newTask:s}}var yl={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},xl=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function kl({status:e="todo",onChange:t,className:r}){let[a,n]=ve.useState(false),[o,s]=ve.useState({top:0,left:0}),l=ve.useRef(null),c=ve.useRef(null);ve.useEffect(()=>{if(a&&c.current){let f=c.current.getBoundingClientRect();s({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[a]),ve.useEffect(()=>{let f=p=>{l.current&&!l.current.contains(p.target)&&!c.current?.contains(p.target)&&n(false);};if(a)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a]),ve.useEffect(()=>{let f=p=>{p.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a]);let i=f=>{t(f),n(false);},u=yl[e],d=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>n(!a),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${d}10`,boxShadow:`0 0 0 2px ${d}30 inset`},title:u.label,children:jsxRuntime.jsx(xl,{icon:u.icon,color:d})}),a&&jsxRuntime.jsx(Xe,{children:jsxRuntime.jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:Object.entries(yl).map(([f,p])=>jsxRuntime.jsxs("button",{onClick:()=>i(f),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:p.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(xl,{icon:p.icon,color:p.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:p.label}),e===f&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f))})]})})]})}function wn({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onTaskUpdate:f,onTaskIndent:p,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:g,onTaskDuplicate:h,onTaskCreate:v,onTaskRename:m,onCreateSubtask:w,onOpenTaskModal:k}){let[b,C]=ve.useState(null),[T,D]=ve.useState(false),[S,E]=ve.useState(null),[I,R]=ve.useState(""),L=ve.useRef(null),H=ve.useRef(null),[G,J]=ve.useState({isOpen:false,x:0,y:0,type:"header"});ve.useEffect(()=>{function U(z){L.current&&!L.current.contains(z.target)&&D(false);}if(T)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[T]),ve.useEffect(()=>{S&&H.current&&(H.current.focus(),H.current.select());},[S]);let{selectedTaskIds:X,handleTaskClick:ne,isTaskSelected:De}=gl(),{setIsEditing:re}=ml({tasks:e,selectedTaskIds:X,onTaskSelect:(U,z)=>{let ze=na(e).map(Ie=>Ie.id);ne(U,ze,z||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:p||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:U=>{let z=na(e).find(Me=>Me.id===U);z&&et(z);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:U=>{let z=na(e).find(Me=>Me.id===U);z&&k&&k(z);},enableKeyboard:true}),Ee=(U,z=0)=>{let Me=[];for(let ze of U)Me.push({task:ze,level:z}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&Me.push(...Ee(ze.subtasks,z+1));return Me},B=Ee(e),j=48,Le=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,et=U=>{E(U.id),R(U.name),re(true);},Rt=U=>{I.trim()&&I!==e.find(z=>z.id===U)?.name&&m?.(U,I.trim()),E(null),R(""),re(false);},ke=()=>{E(null),R(""),re(false);},ae=(U,z)=>{z.stopPropagation(),w?.(U.id);},ie=(U,z,Me)=>{switch(U.id){case "name":let ze=S===z.id,Ie=b===z.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Me*24}px`},children:[z.subtasks&&z.subtasks.length>0&&jsxRuntime.jsx("button",{onClick:te=>{te.stopPropagation(),c?.(z.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:z.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:z.color||"#6366F1",opacity:z.parentId?.6:1,borderColor:z.isMilestone?t.accent:"transparent",borderWidth:z.isMilestone?"2px":"0px"},title:z.isMilestone?"Milestone":z.parentId?"Subtask":"Task"}),ze?jsxRuntime.jsx("input",{ref:H,type:"text",value:I,onChange:te=>R(te.target.value),onKeyDown:te=>{te.key==="Enter"?Rt(z.id):te.key==="Escape"&&ke();},onBlur:()=>Rt(z.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:te=>te.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Me===0?"14px":Me===1?"13px":"12px",fontWeight:z.isMilestone?600:z.subtasks&&z.subtasks.length>0?500:400,opacity:Me===0?1:Me===1?.95:.88},children:z.name}),Ie&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:te=>te.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:te=>ae(z,te),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:te=>{te.stopPropagation(),et(z);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":let Ht=z.startDate?typeof z.startDate=="string"?z.startDate:z.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:te=>te.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Ht||"",onChange:te=>{f?.(z.id,{startDate:te.target.value?new Date(te.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let ht=z.endDate?typeof z.endDate=="string"?z.endDate:z.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:te=>te.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ht||"",onChange:te=>{f?.(z.id,{endDate:te.target.value?new Date(te.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Le(z)})});case "assignees":let It=a.filter(te=>z.assignees?.some(Fe=>Fe.name===te.name||Fe.initials===te.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:te=>te.stopPropagation(),children:jsxRuntime.jsx(Pr,{assignedUsers:It,availableUsers:a,onChange:te=>{let Fe=te.map(Gt=>({id:Gt.id,name:Gt.name,initials:Gt.initials,color:Gt.color}));f?.(z.id,{assignees:Fe.length>0?Fe:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:te=>te.stopPropagation(),children:jsxRuntime.jsx(kl,{status:z.status||"todo",onChange:te=>{f?.(z.id,{status:te,progress:te==="completed"?100:z.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${z.progress}%`,backgroundColor:z.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[z.progress,"%"]})]});default:return null}},Pt=U=>[{id:"hide",label:"Hide Column",icon:St.Hide,onClick:()=>d(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:St.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:St.SortDesc,onClick:()=>{}}],Ot=U=>[{id:"edit",label:"Edit Task",icon:St.Edit,onClick:()=>{}},{id:"addSubtask",label:"Add Subtask",icon:St.Add,onClick:()=>{}},{id:"addDependency",label:"Add Dependency",icon:St.Link,onClick:()=>{}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markComplete",label:U.status==="completed"?"Mark Incomplete":"Mark Complete",icon:St.Progress,onClick:()=>{let z=U.status==="completed"?"in-progress":"completed",Me=U.status==="completed"?U.progress:100;f?.(U.id,{status:z,progress:Me});}},{id:"setInProgress",label:"Set In Progress",icon:St.Progress,onClick:()=>{f?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:St.Delete,onClick:()=>{window.confirm(`Delete task "${U.name}"?`)&&g?.([U.id]);}}],zt=u.filter(U=>U.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-auto",style:{backgroundColor:t.bgPrimary,borderRight:`1px solid ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border,height:`${j}px`,marginLeft:"3px"},children:[zt.map(U=>jsxRuntime.jsx("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${U.id==="name"?"justify-start":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.width}px`,maxWidth:`${U.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:z=>{z.preventDefault(),J({isOpen:true,x:z.clientX,y:z.clientY,type:"header",columnId:U.id});},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent";},children:jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:U.label})},U.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(kn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>D(!T),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"}),T&&jsxRuntime.jsxs("div",{ref:L,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>D(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),B.map(({task:U,level:z},Me)=>{let ze=De(U.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${ze?t.accent:t.borderLight}`,borderRight:`1px solid ${ze?t.accent:t.borderLight}`,borderBottom:`1px solid ${ze?t.accent:t.borderLight}`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:Me%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>C(U.id),onMouseLeave:()=>C(null),onClick:Ie=>{let ht=na(e).map(Fe=>Fe.id),te=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ie.metaKey:Ie.ctrlKey;ne(U.id,ht,te,Ie.shiftKey),o?.(U);},onDoubleClick:Ie=>{Ie.stopPropagation(),s?.(U);},onContextMenu:Ie=>{Ie.preventDefault(),J({isOpen:true,x:Ie.clientX,y:Ie.clientY,type:"task",task:U}),l?.(U,Ie);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:zt.map(Ie=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${Ie.id==="name"?"justify-start":"justify-center"}`,style:{width:`${Ie.width}px`,minWidth:`${Ie.width}px`,maxWidth:`${Ie.width}px`,borderColor:b===U.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:ie(Ie,U,Ie.id==="name"?z:0)},`${U.id}-${Ie.id}`))},U.id)}),jsxRuntime.jsx(aa,{isOpen:G.isOpen,x:G.x,y:G.y,items:G.type==="header"&&G.columnId?Pt(G.columnId):G.type==="task"&&G.task?Ot(G.task):[],onClose:()=>J({...G,isOpen:false}),theme:t})]})}function Tl(e,t){let[r,a]=ve.useState("none"),[n,o]=ve.useState(0),[s,l]=ve.useState(e),[c,i]=ve.useState(t),[u,d]=ve.useState(null),[f,p]=ve.useState(null),[y,x]=ve.useState(null),[g,h]=ve.useState(null),[v,m]=ve.useState(0),[w,k]=ve.useState(0),[b,C]=ve.useState(null),[T,D]=ve.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:f,setHoveredTaskId:p,activeZone:y,setActiveZone:x,draggedSegmentIndex:g,setDraggedSegmentIndex:h,draggedSegmentStartX:v,setDraggedSegmentStartX:m,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:b,setHoveredSegmentIndex:C,isHovered:T,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(L,H)=>{a("none"),d(null),p(null),l(L),i(H),k(0),h(null),m(0);}}}function Cn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:f,allTaskPositions:p=[]}){let y=Tl(t,a),x=ve.useRef(null),{dragMode:g,setDragMode:h,dragOffset:v,setDragOffset:m,ghostX:w,setGhostX:k,ghostWidth:b,setGhostWidth:C,connectionLine:T,setConnectionLine:D,hoveredTaskId:S,setHoveredTaskId:E,activeZone:I,setActiveZone:R,draggedSegmentIndex:L,setDraggedSegmentIndex:H,draggedSegmentStartX:G,setDraggedSegmentStartX:J,segmentDragOffsetX:X,setSegmentDragOffsetX:ne,hoveredSegmentIndex:De,setHoveredSegmentIndex:re,isHovered:Ee,setIsHovered:B,isDragging:j,isResizing:Le,isConnecting:et,resetDragState:Rt}=y,ke=32,ae=8,ie=e.endDate&&e.endDate<new Date&&e.progress<100,Pt=e.isCriticalPath,Ot=n.name==="neutral"||n.today==="#1C1917",U=(O=>O>=80?20:O>=60?15:O>=50?12:10)(a),z=a<50,Me=a<40,ze=O=>O.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ie=()=>{let O=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${O} day${O!==1?"s":""}`},Ht=O=>Math.round(O/o)*o,ht=O=>{let ge=Math.round(O/o),de=new Date(s);return de.setDate(de.getDate()+ge),de},It=(O,ge)=>{for(let de of p){if(de.id===e.id)continue;let N=5;if(O>=de.x-N&&O<=de.x+de.width+N&&ge>=de.y-N&&ge<=de.y+de.height+N)return de.id}return null},te=ve.useCallback((O,ge,de)=>{O.preventDefault(),O.stopPropagation();let N=x.current?.ownerSVGElement;if(!N)return;let _=N.createSVGPoint();_.x=O.clientX,_.y=O.clientY;let ue=_.matrixTransform(N.getScreenCTM()?.inverse()),we=de!==void 0?de:t,Se=ge;if(!Se){let Nt=ue.x-we;O.shiftKey?(Se="connect",D({x:t+a,y:r+ke/2})):O.ctrlKey||O.metaKey?Se="move":O.altKey?Se=Nt<a/2?"resize-start":"resize-end":Me?Nt<a/2?Se="move":Se="resize-end":z?Nt<=U/2?Se="resize-start":Nt>=a-U/2?Se="resize-end":Se="move":Nt<=U?Se="resize-start":Nt>=a-U?Se="resize-end":Se="move";}h(Se),B(false),R(null),Se==="move"?m(ue.x-we):Se==="connect"?D({x:t+a,y:r+ke/2}):m(0),k(we),C(a);},[t,a,r,ke]),Fe=ve.useCallback(O=>{if(g==="none")return;let ge=x.current?.ownerSVGElement;if(!ge)return;let de=ge.createSVGPoint();de.x=O.clientX,de.y=O.clientY;let N=de.matrixTransform(ge.getScreenCTM()?.inverse());if(g==="connect"){D({x:N.x,y:N.y});let _=It(N.x,N.y);E(_);}else if(g==="move"){let _=N.x-v,ue=Ht(_);if(k(ue),C(a),e.segments&&e.segments.length>0&&L!==null){let we=ue-G;ne(we);}}else if(g==="resize-start"){let _=N.x,ue=Ht(_),we=t+a-ue;we>=o&&(k(ue),C(we));}else if(g==="resize-end"){let _=N.x,we=Ht(_)-t;we>=o&&C(we);}},[g,t,a,o,v,e,Ht,L,G,It,E,D,k,C,ne]),Gt=ve.useCallback(()=>{if(g!=="none"){if(g==="connect")S&&f&&f(e,S),D(null),E(null);else {let O=e.endDate.getTime()-e.startDate.getTime(),ge,de,N=true;if(g==="move"){if(ge=ht(w),de=new Date(ge.getTime()+O),e.segments&&e.segments.length>0&&L!==null){let _=Math.round(X/o),ue=e.segments.map((Mt,Gn)=>{if(Gn===L){let la=new Date(Mt.startDate),Wr=new Date(Mt.endDate);return la.setDate(la.getDate()+_),Wr.setDate(Wr.getDate()+_),{startDate:la,endDate:Wr}}return Mt}),we=ue.flatMap(Mt=>[Mt.startDate,Mt.endDate]),Se=new Date(Math.min(...we.map(Mt=>Mt.getTime()))),Nt=new Date(Math.max(...we.map(Mt=>Mt.getTime())));d?.({...e,segments:ue},Se,Nt),Rt(t,a);return}}else g==="resize-start"?(ge=ht(w),de=e.endDate,ge>=de&&(console.warn("Invalid date range: start date must be before end date"),N=false)):g==="resize-end"?(ge=e.startDate,de=ht(w+b),de<=ge&&(console.warn("Invalid date range: end date must be after start date"),N=false)):N=false;N&&ge&&de&&(de.getTime()-ge.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,ge,de));}Rt(t,a);}},[g,w,b,e,d,S,f,t,a,o,ht,X,L,Rt]);ve.useEffect(()=>{if(g==="none")return;let O=de=>{Fe(de);},ge=()=>{Gt();};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",ge),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",ge);}},[g,Fe,Gt]);let he=j&&!et?w:t,me=j&&!et?b:a,nr=l.taskTooltip(e),_r=typeof nr=="string"?nr:"",$r=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!j&&B(true),onMouseLeave:()=>{j||(B(false),R(null));},onClick:()=>!j&&c?.(e),onDoubleClick:O=>{j||(O.stopPropagation(),i?.(e));},onContextMenu:O=>{O.preventDefault(),u?.(e,O);},children:[_r&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:_r}}),Ee&&!j&&!z&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:U,height:ke,fill:I==="resize-start"?n.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>R("resize-start"),onMouseDown:O=>te(O,"resize-start")}),jsxRuntime.jsx("rect",{x:t+U,y:r,width:a-U*2,height:ke,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>R("move"),onMouseDown:O=>te(O,"move")}),jsxRuntime.jsx("rect",{x:t+a-U,y:r,width:U,height:ke,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>R("resize-end"),onMouseDown:O=>te(O,"resize-end")})]}),Ee&&!j&&Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:ke,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>R("move"),onMouseDown:O=>te(O,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:ke,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>R("resize-end"),onMouseDown:O=>te(O,"resize-end")}),Ee&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+ke-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),j&&!et&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:r,width:b,height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":n.taskBarPrimary,opacity:.3,stroke:e.isCriticalPath?"#EF4444":n.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.5},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:he,y:r,width:me,height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":$r,initial:{opacity:0,scale:.95},animate:{opacity:j&&!et?.15:e.parentId?.6:Ee?.9:.8,scale:Ee&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:O=>te(O),style:{cursor:j?et?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:he,y:r,width:me*(e.progress/100),height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((O,ge)=>{let de=(O.startDate.getTime()-s.getTime())/864e5*o,_=(O.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-de+o,ue=j&&g==="move"&&L===ge,we=De===ge,Se=ue?de+X:de;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!j&&re(ge),onMouseLeave:()=>!j&&re(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Se,y:r,width:_,height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:ue||e.parentId?.6:we?.9:.8,scale:we&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Nt=>{Nt.stopPropagation(),H(ge),J(de),te(Nt,void 0,de);},style:{cursor:j?et?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Se,y:r,width:_*(e.progress/100),height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ge}`)}),Ot&&(ie||Pt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Pt&&!ie&&jsxRuntime.jsx("rect",{x:he,y:r,width:me,height:ke,rx:ae,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ie&&jsxRuntime.jsx("rect",{x:he,y:r,width:me,height:ke,rx:ae,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),me>60&&!e.segments&&(()=>{let O=l.taskLabel(e),ge=typeof O=="string"?O:e.name,de=ge.length>Math.floor(me/8)?`${ge.substring(0,Math.floor(me/8))}...`:ge;return jsxRuntime.jsx("text",{x:he+12,y:r+ke/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:de})})(),me>100&&e.progress>0&&e.progress<100&&!j&&!e.segments&&jsxRuntime.jsxs("text",{x:he+me-12,y:r+ke/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&me>80&&!j&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:he+me-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:he+me-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ee||Le)&&!et&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:z?he-15:he-10,y:r-5,width:z?25:20,height:ke+10,fill:"transparent",onMouseDown:O=>te(O,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:z?he-8:he-3,y:r+6,width:z?8:6,height:z?ke-12:ke-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:he+me-10,y:r-5,width:z?25:20,height:ke+10,fill:"transparent",onMouseDown:O=>te(O,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:z?he+me:he+me-3,y:r+6,width:z?8:6,height:z?ke-12:ke-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&!j&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+8,cy:r+ke/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:O=>{O.stopPropagation(),te(O,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+ke/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),et&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+ke/2,x2:T.x,y2:T.y,stroke:S?n.statusCompleted:n.accent,strokeWidth:S?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:S?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:S?8:6,fill:S?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),S&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(Ee||j)&&!et&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:he-2,y:r-2,width:me+4,height:ke+4,rx:ae+2,fill:"none",stroke:j?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:j?.6:.4,initial:{opacity:0},animate:{opacity:j?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+b,y1:0,x2:w+b,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&!j&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:he+me/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${he+me/2-6} ${r-13} L ${he+me/2} ${r-3} L ${he+me/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:he+me/2,y:r-73,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:he+me/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:he+me/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ze(e.startDate)}),jsxRuntime.jsx("text",{x:he+me/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:he+me/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ze(e.endDate)}),jsxRuntime.jsx("text",{x:he+me/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:he+me/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ie()}),jsxRuntime.jsx("text",{x:he+me/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:he+me/2+65,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:he+me/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:he+me/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(O=>O.name).join(", ").substring(0,30),e.assignees.map(O=>O.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:he+me/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Me?"Left: move \u2022 Right: resize":z?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})]})}function Sn({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,l]=ve.useState(false),c=r-e,i=a-t,u=e+c/2,d=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,f=6,p=Math.atan2(i,c),y=r-f*Math.cos(p-Math.PI/6),x=a-f*Math.sin(p-Math.PI/6),g=r-f*Math.cos(p+Math.PI/6),h=a-f*Math.sin(p+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${y} ${x} M ${r} ${a} L ${g} ${h}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:v,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:m=>{m.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Dn({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=ve.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:l+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:r+16-l/2,width:l,height:l,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:r+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}function Rn({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:l,onTaskClick:c,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:f,onDependencyDelete:p}){let x=Math.ceil((o.getTime()-n.getTime())/864e5),g=a==="day"?60:a==="week"?20:8,h=x*g*s,v=E=>{let I=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),R=I.getUTCDay()||7;I.setUTCDate(I.getUTCDate()+4-R);let L=new Date(Date.UTC(I.getUTCFullYear(),0,1));return Math.ceil(((I.getTime()-L.getTime())/864e5+1)/7)},m=E=>{let I=E.getDay();return I===0||I===6},w=ve.useCallback(E=>{let I=Math.round(E/(g*s)),R=new Date(n);return R.setDate(R.getDate()+I),R},[n,g,s]),k=ve.useCallback((E,I)=>{if(I.startDate&&I.endDate)return;let R=E.currentTarget.ownerSVGElement;if(!R)return;let L=R.createSVGPoint();L.x=E.clientX,L.y=E.clientY;let H=L.matrixTransform(R.getScreenCTM()?.inverse()),G=w(H.x),J=new Date(G);J.setDate(J.getDate()+1),d?.(I,G,J);},[w,d]),b=ve.useMemo(()=>{let E=H=>H.map(G=>{if(G.subtasks&&G.subtasks.length>0){let J=E(G.subtasks),X=J.filter(ne=>ne.startDate&&ne.endDate);if(X.length>0){let ne=X.map(B=>B.startDate.getTime()),De=X.map(B=>B.endDate.getTime()),re=new Date(Math.min(...ne)),Ee=new Date(Math.max(...De));return {...G,subtasks:J,startDate:re,endDate:Ee}}return {...G,subtasks:J}}return G}),I=(H,G=[])=>{for(let J of H)G.push(J),J.subtasks&&J.subtasks.length>0&&(J.isExpanded===void 0||J.isExpanded)&&I(J.subtasks,G);return G},R=E(e);return I(R)},[e]),C=ve.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let I=E.startDate.getTime(),R=E.endDate.getTime(),L=n.getTime(),H=(I-L)/(1e3*60*60*24),G=(R-I)/(1e3*60*60*24),J=H*g*s,X=Math.max(g*s,40),ne=Math.max(G*g*s,X);return {x:J,width:ne}},[n,g,s]),T=ve.useMemo(()=>b.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:I,width:R}=C(E),H=48+b.findIndex(G=>G.id===E.id)*r+12;return {id:E.id,x:I,y:H,width:R,height:32}}),[b,C]),D=ve.useMemo(()=>{let E=[],I=new Date(n);for(;I<=o;){let H=(I.getTime()-n.getTime())/864e5*g*s;if(a==="day")E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:H}),I.setDate(I.getDate()+1);else if(a==="week"){let G=v(I);E.push({date:new Date(I),label:`Week ${G}`,x:H}),I.setDate(I.getDate()+7);}else E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:H}),I.setMonth(I.getMonth()+1);}return E},[n,o,a,g,s]),S=ve.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*g*s,[n,g,s]);return jsxRuntime.jsx("div",{className:"w-full h-full","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:jsxRuntime.jsxs("svg",{width:Math.max(h,1e3),height:Math.max(b.length*r+48,600),children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(h,1e3),height:Math.max(b.length*r+48,600),fill:t.bgPrimary}),jsxRuntime.jsx("rect",{x:0,y:0,width:h,height:48,fill:t.bgGrid}),D.map((E,I)=>{let R=D[I+1]?.x||h,L=m(E.date);return jsxRuntime.jsxs("g",{children:[L&&jsxRuntime.jsx("rect",{x:E.x,y:48,width:R-E.x,height:b.length*r,fill:t.bgWeekend,opacity:1}),jsxRuntime.jsx("line",{x1:E.x,y1:48,x2:E.x,y2:b.length*r+48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",dominantBaseline:"middle",children:E.label})]},I)}),S>=0&&S<=h&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:S,y1:48,x2:S,y2:b.length*r+48,stroke:t.today,strokeWidth:2,opacity:1}),jsxRuntime.jsx("circle",{cx:S,cy:38,r:6,fill:t.today,opacity:1})]}),b.map((E,I)=>{let R=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:48+I*r,width:h,height:r,fill:I%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:48+I*r,width:h,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:L=>k(L,E),onMouseEnter:L=>{L.currentTarget.setAttribute("fill",t.accentLight),L.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:L=>{L.currentTarget.setAttribute("fill","transparent"),L.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:S>0?S:100,y:48+I*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),b.map((E,I)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(R=>{let L=b.find(X=>X.id===R);if(!L||!L.startDate||!L.endDate)return null;let H=b.findIndex(X=>X.id===R),G=C(L),J=C(E);return jsxRuntime.jsx(Sn,{x1:G.x+G.width,y1:48+H*r+r/2,x2:J.x,y2:48+I*r+r/2,theme:t,onDelete:()=>p?.(E.id,R)},`dep-${R}-${E.id}`)})),b.map((E,I)=>{if(!E.startDate||!E.endDate)return null;let{x:R,width:L}=C(E),H=48+I*r+12,G=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Dn,{task:E,x:R+L/2,y:H+16,theme:t,onClick:c},E.id):G?jsxRuntime.jsxs("g",{onClick:()=>c?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:R,y:H,width:L,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:R,y1:H,x2:R+L,y2:H,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:H,x2:R,y2:H+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R+L,y1:H,x2:R+L,y2:H+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:H+32,x2:R+L,y2:H+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),L>60&&jsxRuntime.jsx("text",{x:R+12,y:H+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(Cn,{task:E,x:R,y:H,width:L,theme:t,dayWidth:g*s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:f,allTaskPositions:T},E.id)})]})})}var El=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Rl({value:e="#6366F1",onChange:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:El.map(a=>{let n=e===a.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!r&&t(a.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:a.value,boxShadow:n?`0 0 0 2px #FFFFFF, 0 0 0 4px ${a.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:r?.5:1,cursor:r?"not-allowed":"pointer"},whileHover:r?{}:{scale:1.1},whileTap:r?{}:{scale:.95},title:a.name,disabled:r,children:n&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},a.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:El.find(a=>a.value===e)?.name||"Personalizado"})]})}function Pn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:l=r?"edit":"create",theme:c="dark"}){let i=fe[c]||fe.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},d={color:i.textSecondary},[f,p]=ve.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[y,x]=ve.useState({});ve.useEffect(()=>{p(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,color:r.color||"#6366F1",assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[r,e]);let g=()=>{let m={};return f.name.trim()||(m.name="El nombre es requerido"),f.startDate&&f.endDate&&f.startDate>f.endDate&&(m.endDate="La fecha de fin debe ser posterior a la de inicio"),x(m),Object.keys(m).length===0},h=async m=>{if(m.preventDefault(),!!g())try{await o(f),t();}catch(w){console.error("Error submitting task:",w);}},v=(m,w)=>{p(k=>{let b={...k,[m]:w};if(m==="progress"){let C=typeof w=="number"?w:parseInt(w,10);C===100&&k.status!=="completed"?b.status="completed":C>0&&C<100&&k.status==="todo"?b.status="in-progress":C===0&&k.status==="in-progress"&&(b.status="todo");}return b}),y[m]&&x(k=>{let b={...k};return delete b[m],b});};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:l==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:m=>m.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:m=>m.currentTarget.style.backgroundColor="transparent",disabled:s,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:h,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:d,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:f.name,onChange:m=>v("name",m.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,onFocus:m=>m.currentTarget.style.borderColor=i.accent,onBlur:m=>m.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:s}),y.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),y.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:f.startDate?f.startDate.toISOString().split("T")[0]:"",onChange:m=>v("startDate",m.target.value?new Date(m.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||f.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:f.endDate?f.endDate.toISOString().split("T")[0]:"",onChange:m=>v("endDate",m.target.value?new Date(m.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||f.isMilestone}),y.endDate&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),y.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:f.status,onChange:m=>v("status",m.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(Rl,{value:f.color,onChange:m=>v("color",m),disabled:s}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:i.textTertiary},children:r?.parentId?"Esta subtarea hereda el color de su tarea padre":r?.subtasks&&r.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:d,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:f.progress<30?"#EF4444":f.progress<70?"#F59E0B":"#10B981",backgroundColor:f.progress<30?"rgba(239, 68, 68, 0.1)":f.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[f.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress,onChange:m=>v("progress",parseInt(m.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:f.progress<30?"#EF4444":f.progress<70?"#F59E0B":"#10B981"},disabled:s}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${f.progress}%`,backgroundColor:f.progress<30?"rgba(239, 68, 68, 0.3)":f.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(m=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>v("progress",m),disabled:s,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:f.progress===m?m<30?"#EF4444":m<70?"#F59E0B":"#10B981":i.bgSecondary,color:f.progress===m?"#FFFFFF":i.textSecondary,border:`1px solid ${f.progress===m?m<30?"#EF4444":m<70?"#F59E0B":"#10B981":i.borderLight}`},children:[m,"%"]},m))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:i.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:f.isMilestone,onChange:m=>v("isMilestone",m.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),n.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:n.map(m=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:f.assignees?.some(w=>w.name===m.name),onChange:w=>{let k=w.target.checked?[...f.assignees||[],{name:m.name,avatar:m.avatar,initials:m.name.split(" ").map(b=>b[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(f.assignees||[]).filter(b=>b.name!==m.name);v("assignees",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:m.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:m.name})]})]},m.id))})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:a.filter(m=>m.id!==r?.id).map(m=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:f.dependencies?.includes(m.id),onChange:w=>{let k=w.target.checked?[...f.dependencies||[],m.id]:(f.dependencies||[]).filter(b=>b!==m.id);v("dependencies",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:m.name})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:m=>{m.currentTarget.style.color=i.textPrimary,m.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.color=i.textSecondary,m.currentTarget.style.backgroundColor="transparent";},disabled:s,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:h,disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:m=>!s&&(m.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:m=>!s&&(m.currentTarget.style.backgroundColor=i.accent),children:s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),l==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}function Fl(e,t=50){let[r,a]=ve.useState({past:[],present:e,future:[]}),n=ve.useRef(false),o=ve.useCallback((i,u=true)=>{a(d=>{let f=typeof i=="function"?i(d.present):i;if(n.current)return {...d,present:f};if(!u)return {...d,present:f};let p=[...d.past,d.present];return p.length>t&&p.shift(),{past:p,present:f,future:[]}});},[t]),s=ve.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),l=ve.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),c=ve.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:l,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:c}}function Bl({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){ve.useEffect(()=>{if(!n)return;let o=s=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?s.metaKey:s.ctrlKey;if(c&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!l&&c&&s.key==="y"){s.preventDefault(),t();return}if(l&&c&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var Y={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,l=new Set,c=i=>{if(!s.has(i)){s.add(i),l.add(i);let u=a.get(i)||[];for(let d of u){if(!s.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=Y.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=Y.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=Y.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Y.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Ro({templates:e,onSelectTemplate:t,className:r}){let[a,n]=ve.useState(false),o=ve.useRef(null),s=ve.useRef(null);ve.useEffect(()=>{function i(u){o.current&&!o.current.contains(u.target)&&s.current&&!s.current.contains(u.target)&&n(false);}if(a)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]);let l=i=>{t(i),n(false);},c=e.reduce((i,u)=>{let d=u.category||"Other";return i[d]||(i[d]=[]),i[d].push(u),i},{});return jsxRuntime.jsxs("div",{className:ee("relative inline-block",r),children:[jsxRuntime.jsxs("button",{ref:s,onClick:()=>n(!a),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsxRuntime.jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsxRuntime.jsx("span",{children:"Templates"}),jsxRuntime.jsx("svg",{className:ee("w-4 h-4 transition-transform",a&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),a&&jsxRuntime.jsxs("div",{ref:o,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsxRuntime.jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([i,u])=>jsxRuntime.jsxs("div",{className:"py-2",children:[jsxRuntime.jsx("div",{className:"px-4 py-2",children:jsxRuntime.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsxRuntime.jsx("div",{children:u.map(d=>jsxRuntime.jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0",children:[jsxRuntime.jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsxRuntime.jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsxRuntime.jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsxRuntime.jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function Io({board:e,isOpen:t,onClose:r,onImport:a,boardElementRef:n,className:o}){let[s,l]=ve.useState("export"),[c,i]=ve.useState("json"),[u,d]=ve.useState(null),f=ve.useRef(null);if(!t)return null;let p=async()=>{let x=n?.current||void 0,g=await Fs(e,c,x);Bs(g,c);},y=async x=>{let g=x.target.files?.[0];if(g){try{let h=await Hs(g),v=g.name.endsWith(".json")?"json":"csv",m=zs(h,v);d(m),m.success&&a&&a(m,h);}catch(h){d({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}f.current&&(f.current.value="");}};return jsxRuntime.jsxs("div",{className:ee("fixed inset-0 z-[9999] flex items-center justify-center",o),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:r}),jsxRuntime.jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsxRuntime.jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsxRuntime.jsx("button",{onClick:r,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsxs("div",{className:"flex border-b border-white/10",children:[jsxRuntime.jsx("button",{onClick:()=>l("export"),className:ee("flex-1 px-6 py-4 font-semibold transition-colors",s==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsxRuntime.jsx("button",{onClick:()=>l("import"),className:ee("flex-1 px-6 py-4 font-semibold transition-colors",s==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxRuntime.jsxs("div",{className:"p-6",children:[s==="export"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxRuntime.jsxs("button",{onClick:()=>i(x),className:ee("p-4 rounded-lg border-2 transition-all text-center",c===x?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxRuntime.jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsxRuntime.jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxRuntime.jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxRuntime.jsxs("div",{className:"text-xs text-white/60",children:[jsxRuntime.jsxs("div",{children:["Board: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxRuntime.jsxs("div",{children:["Columns: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxRuntime.jsxs("div",{children:["Cards: ",jsxRuntime.jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsxRuntime.jsx("button",{onClick:p,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"})]}),s==="import"&&jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsxRuntime.jsx("input",{ref:f,type:"file",accept:".json,.csv",onChange:y,className:"hidden"}),jsxRuntime.jsxs("button",{onClick:()=>f.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsxRuntime.jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsxRuntime.jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsxRuntime.jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxRuntime.jsxs("div",{className:ee("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:[jsxRuntime.jsx("h3",{className:ee("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxRuntime.jsxs("div",{className:"text-sm text-white/80",children:[jsxRuntime.jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxRuntime.jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsxRuntime.jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,g)=>jsxRuntime.jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},g))})]})]})]})]})]})}var Kp=["URGENT","HIGH","MEDIUM","LOW"],jp=[{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"}],qp=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Mo({filters:e,sort:t,onFiltersChange:r,onSortChange:a,onReset:n,onFilterMyTasks:o,onFilterOverdue:s,onFilterHighPriority:l,availableUsers:c=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:d=true,compact:f=false,groupBy:p="none",onGroupByChange:y}){let[x,g]=ve.useState(true),h=ve.useCallback(b=>{r({search:b.target.value});},[r]),v=ve.useCallback(b=>{r({dateFilter:b.target.value});},[r]),m=ve.useCallback(b=>{a({by:b.target.value});},[a]),w=ve.useCallback(()=>{a({order:t.order==="asc"?"desc":"asc"});},[t.order,a]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxRuntime.jsxs("div",{className:`filter-bar ${f?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxRuntime.jsxs("div",{className:"filter-bar__header",onClick:()=>g(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:b=>{b.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:b=>{b.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})}),jsxRuntime.jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxRuntime.jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxRuntime.jsxs("div",{className:"filter-bar__content",children:[d&&jsxRuntime.jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsxRuntime.jsx("span",{className:"filter-bar__label",children:"Quick:"}),o&&jsxRuntime.jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),s&&jsxRuntime.jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsxRuntime.jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxRuntime.jsxs("div",{className:"filter-bar__main",children:[jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.dateFilter,onChange:v,className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Dates"}),jsxRuntime.jsx("option",{value:"overdue",children:"Overdue"}),jsxRuntime.jsx("option",{value:"today",children:"Today"}),jsxRuntime.jsx("option",{value:"this-week",children:"This Week"})]})}),jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.priorities[0]||"all",onChange:b=>{let C=b.target.value;r({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Priorities"}),Kp.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),c.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.assignees[0]||"all",onChange:b=>{let C=b.target.value;r({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Assignees"}),c.map(b=>jsxRuntime.jsx("option",{value:b.id,children:b.name},b.id))]})}),i.length>0&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsxs("select",{value:e.labels[0]||"all",onChange:b=>{let C=b.target.value;r({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsxRuntime.jsx("option",{value:"all",children:"All Labels"}),i.map(b=>jsxRuntime.jsx("option",{value:b,children:b},b))]})}),jsxRuntime.jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsxRuntime.jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsxRuntime.jsx("select",{value:t.by,onChange:m,className:"filter-bar__select filter-bar__select--sm",children:jp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))}),t.by!=="none"&&jsxRuntime.jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),y&&jsxRuntime.jsx("div",{className:"filter-bar__field",children:jsxRuntime.jsx("select",{value:p,onChange:b=>y(b.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:qp.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})}),k&&jsxRuntime.jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ao({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:r,className:a,viewMode:n="kanban",onExportGanttPDF:o,onExportGanttExcel:s,onExportGanttPNG:l,onExportGanttCSV:c}){let[i,u]=ve.useState(false),d=ve.useRef(null);ve.useEffect(()=>{let p=y=>{d.current&&!d.current.contains(y.target)&&u(false);};return i&&document.addEventListener("mousedown",p),()=>{document.removeEventListener("mousedown",p);}},[i]);let f=p=>{p(),u(false);};return jsxRuntime.jsxs("div",{className:ee("relative",a),ref:d,children:[jsxRuntime.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:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",p.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",p.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"3"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsxRuntime.jsx("span",{children:"Config"})]}),i&&jsxRuntime.jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxRuntime.jsxs("button",{onClick:()=>f(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{onClick:()=>f(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsxRuntime.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsxRuntime.jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxRuntime.jsxs("button",{onClick:()=>f(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsxRuntime.jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxRuntime.jsxs("button",{onClick:()=>f(async()=>await l?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsxRuntime.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsxRuntime.jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxRuntime.jsxs("button",{onClick:()=>f(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsxRuntime.jsx("polyline",{points:"14 2 14 8 20 8"}),jsxRuntime.jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsxRuntime.jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxRuntime.jsxs("button",{onClick:()=>f(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"5"}),jsxRuntime.jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxRuntime.jsxs("button",{onClick:()=>f(r),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsxRuntime.jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Lo={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Fo={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Bo={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"}},Ar={dark:Lo,light:Fo,neutral:Bo},vn="dark";var bn=ve.createContext(void 0),nm="asakaa-theme";function il({children:e,defaultTheme:t=vn,storageKey:r=nm}){let[a,n]=ve.useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(r);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),o=ve.useCallback(l=>{n(l),typeof window<"u"&&localStorage.setItem(r,l);},[r]);ve.useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,c=Ar[a];Object.entries(c.colors).forEach(([u,d])=>{d&&l.style.setProperty(`--theme-${om(u)}`,d);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,d])=>{let f=c.colors[u];f&&l.style.setProperty(d,f);}),l.setAttribute("data-theme",a),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${a}`);},[a]);let s={theme:a,setTheme:o,themes:Ar};return jsxRuntime.jsx(bn.Provider,{value:s,children:e})}function ta(){let e=ve.useContext(bn);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function om(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Oo({isOpen:e,onClose:t,className:r}){let{theme:a,setTheme:n}=ta();return e?jsxRuntime.jsxs("div",{className:ee("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsxRuntime.jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxRuntime.jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsxRuntime.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsxRuntime.jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsxRuntime.jsx("div",{className:"p-6 space-y-3",children:Object.entries(Ar).map(([o,s])=>jsxRuntime.jsxs("button",{onClick:()=>{n(o),t();},className:ee("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",a===o?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:a===o?"var(--theme-accent-primary)20":"transparent"},children:[jsxRuntime.jsx("div",{className:"text-3xl",children:s.emoji}),jsxRuntime.jsxs("div",{className:"text-left flex-1",children:[jsxRuntime.jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:s.displayName}),jsxRuntime.jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[o==="dark"&&"Default dark theme with Linear-inspired colors",o==="light"&&"Clean light theme with high contrast",o==="neutral"&&"Monochrome zen theme"]})]}),a===o&&jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsxRuntime.jsx("path",{d:"M20 6L9 17l-5-5"})})]},o))})]})]}):null}var fe={dark:{bgPrimary:"#1A1D21",bgSecondary:"#23272E",bgGrid:"#1E2228",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#2D3139",borderLight:"#26292F",textPrimary:"#F5F5F7",textSecondary:"#B4B9C5",textTertiary:"#7C8394",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#7C8394",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.05)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F9FAFB",bgGrid:"#FCFCFD",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#E5E7EB",borderLight:"#F0F1F3",textPrimary:"#111827",textSecondary:"#4B5563",textTertiary:"#9CA3AF",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.2)",dependencyHover:"rgba(75, 85, 99, 0.4)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#2563EB",todayLight:"rgba(37, 99, 235, 0.08)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#9CA3AF",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.03)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#FEFEFE",bgWeekend:"rgba(41, 37, 36, 0.025)",border:"#E7E5E4",borderLight:"#F0EFEE",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.06)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.2)",dependencyHover:"rgba(87, 83, 78, 0.35)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.04)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.06)",statusTodo:"#A8A29E",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.025)",focusRing:"#292524"}};function ll(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return fe[e]||fe.dark;let t=document.documentElement,r=getComputedStyle(t),a=(o,s)=>r.getPropertyValue(o).trim()||s;return {bgPrimary:a("--theme-bg-primary",fe[e].bgPrimary),bgSecondary:a("--theme-bg-secondary",fe[e].bgSecondary),bgGrid:a("--theme-bg-card",fe[e].bgGrid),bgWeekend:a("--theme-bg-hover",fe[e].bgWeekend),border:a("--theme-border-primary",fe[e].border),borderLight:a("--theme-border-subtle",fe[e].borderLight),textPrimary:a("--theme-text-primary",fe[e].textPrimary),textSecondary:a("--theme-text-secondary",fe[e].textSecondary),textTertiary:a("--theme-text-tertiary",fe[e].textTertiary),accent:a("--theme-accent-primary",fe[e].accent),accentHover:a("--theme-accent-hover",fe[e].accentHover),accentLight:a("--theme-accent-primary",fe[e].accentLight),taskBarPrimary:a("--theme-accent-primary",fe[e].taskBarPrimary),taskBarProgress:a("--theme-accent-hover",fe[e].taskBarProgress),taskBarHandle:a("--theme-text-inverse",fe[e].taskBarHandle||"#FFFFFF"),dependency:a("--theme-border-secondary",fe[e].dependency),dependencyHover:a("--theme-border-secondary",fe[e].dependencyHover),criticalPath:a("--theme-error",fe[e].criticalPath),criticalPathLight:a("--theme-error",fe[e].criticalPathLight),today:e==="light"?a("--theme-accent-primary",fe[e].today):e==="neutral"?a("--theme-text-primary",fe[e].today):a("--theme-error",fe[e].today),todayLight:e==="light"?a("--theme-accent-primary",fe[e].todayLight):e==="neutral"?a("--theme-text-primary",fe[e].todayLight):a("--theme-error",fe[e].todayLight),milestone:a("--theme-warning",fe[e].milestone),milestoneLight:a("--theme-warning",fe[e].milestoneLight),statusTodo:a("--theme-text-tertiary",fe[e].statusTodo),statusInProgress:a("--theme-accent-primary",fe[e].statusInProgress),statusCompleted:a("--theme-success",fe[e].statusCompleted),hoverBg:a("--theme-bg-hover",fe[e].hoverBg),focusRing:a("--theme-accent-primary",fe[e].focusRing)}}function Go({options:e,value:t,onChange:r,theme:a}){return jsxRuntime.jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`},children:e.map(n=>{let o=t===n.value;return jsxRuntime.jsxs(framerMotion.motion.button,{onClick:()=>r(n.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsxRuntime.jsx(framerMotion.motion.div,{layoutId:"activeSegment",className:"absolute inset-0 rounded-md",style:{backgroundColor:a.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),n.icon&&jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.icon}),jsxRuntime.jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":a.textTertiary},children:n.label})]},n.value)})})}function xn({theme:e,timeScale:t,onTimeScaleChange:r,zoom:a,onZoomChange:n,currentTheme:o,onThemeChange:s,rowDensity:l,onRowDensityChange:c,showThemeSelector:i=true}){let u=[{value:"day",label:"Day",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"week",label:"Week",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})},{value:"month",label:"Month",icon:jsxRuntime.jsx(lucideReact.Calendar,{className:"w-3.5 h-3.5"})}],d=[{value:"dark",label:"Dark",icon:jsxRuntime.jsx(lucideReact.Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsxRuntime.jsx(lucideReact.Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsxRuntime.jsx(lucideReact.Palette,{className:"w-3.5 h-3.5"})}],f=[{value:"compact",label:"Compact",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"comfortable",label:"Comfortable",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})},{value:"spacious",label:"Spacious",icon:jsxRuntime.jsx(lucideReact.AlignJustify,{className:"w-3.5 h-3.5"})}];return jsxRuntime.jsxs("div",{className:"h-14 px-6 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(Go,{options:u,value:t,onChange:p=>r(p),theme:e}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsxs("div",{className:"flex items-center gap-1",children:[jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.max(.5,a-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomOut,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})}),jsxRuntime.jsxs("div",{className:"px-3 py-1 rounded-md text-xs tabular-nums min-w-[50px] text-center",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`,color:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[Math.round(a*100),"%"]}),jsxRuntime.jsx(framerMotion.motion.button,{onClick:()=>n(Math.min(2,a+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.borderLight}`},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.ZoomIn,{className:"w-3.5 h-3.5",style:{color:e.textSecondary}})})]}),jsxRuntime.jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),jsxRuntime.jsx(Go,{options:f,value:l,onChange:p=>c(p),theme:e})]}),i&&jsxRuntime.jsx(Go,{options:d,value:o,onChange:p=>s(p),theme:e})]})}function kn({columns:e,onToggleColumn:t,theme:r}){let[a,n]=ve.useState(false),[o,s]=ve.useState({x:0,y:0}),l=ve.useRef(null),c=ve.useRef(null);ve.useEffect(()=>{if(!a)return;let u=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[a]);let i=e.filter(u=>u.id!=="name");return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.button,{ref:c,onClick:()=>{if(!a&&c.current){let u=c.current.getBoundingClientRect();s({x:u.left,y:u.bottom+4});}n(!a);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`,color:r.textSecondary},whileHover:{backgroundColor:r.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"})}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:a&&jsxRuntime.jsx(Xe,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:l,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:`${o.x}px`,top:`${o.y}px`,backgroundColor:r.bgSecondary,border:`1px solid ${r.border}`},children:jsxRuntime.jsxs("div",{className:"py-1",children:[jsxRuntime.jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(u=>jsxRuntime.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:r.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=r.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsxRuntime.jsx("span",{children:u.label}),u.visible&&jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4",style:{color:r.accent}})]},u.id))]})})})})]})}function aa({isOpen:e,x:t,y:r,items:a,onClose:n,theme:o}){let s=ve.useRef(null);return ve.useEffect(()=>{if(!e)return;let l=i=>{s.current&&!s.current.contains(i.target)&&n();},c=i=>{i.key==="Escape"&&n();};return document.addEventListener("mousedown",l),document.addEventListener("keydown",c),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",c);}},[e,n]),e?jsxRuntime.jsx(framerMotion.AnimatePresence,{children:jsxRuntime.jsx(framerMotion.motion.div,{ref:s,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 shadow-xl",style:{left:`${t}px`,top:`${r}px`,backgroundColor:o.bgSecondary,border:`1px solid ${o.border}`},children:jsxRuntime.jsx("div",{className:"py-1",children:a.map(l=>jsxRuntime.jsxs("div",{children:[l.separator&&jsxRuntime.jsx("div",{className:"my-1 h-px",style:{backgroundColor:o.borderLight}}),jsxRuntime.jsxs("button",{onClick:()=>{l.disabled||(l.onClick(),n());},disabled:l.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:l.disabled?o.textTertiary:o.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:l.disabled?"not-allowed":"pointer",opacity:l.disabled?.5:1},onMouseEnter:c=>{l.disabled||(c.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[l.icon&&jsxRuntime.jsx("span",{style:{color:o.textSecondary},children:l.icon}),jsxRuntime.jsx("span",{className:"flex-1",children:l.label}),l.submenu&&jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-3.5 h-3.5",style:{color:o.textTertiary}})]})]},l.id))})})}):null}var St={Edit:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-4 h-4"}),Delete:jsxRuntime.jsx(lucideReact.Trash2,{className:"w-4 h-4"}),Add:jsxRuntime.jsx(lucideReact.Plus,{className:"w-4 h-4"}),Remove:jsxRuntime.jsx(lucideReact.Minus,{className:"w-4 h-4"}),Link:jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),Progress:jsxRuntime.jsx(lucideReact.BarChart3,{className:"w-4 h-4"}),Sort:jsxRuntime.jsx(lucideReact.ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsxRuntime.jsx(lucideReact.ArrowUp,{className:"w-4 h-4"}),SortDesc:jsxRuntime.jsx(lucideReact.ArrowDown,{className:"w-4 h-4"}),Hide:jsxRuntime.jsx(lucideReact.EyeOff,{className:"w-4 h-4"}),Show:jsxRuntime.jsx(lucideReact.Eye,{className:"w-4 h-4"}),Settings:jsxRuntime.jsx(lucideReact.Settings,{className:"w-4 h-4"}),Split:jsxRuntime.jsx(lucideReact.Scissors,{className:"w-4 h-4"})};function ml({tasks:e,selectedTaskIds:t,onTaskSelect:r,onTaskCreate:a,onTaskDelete:n,onTaskDuplicate:o,onTaskMove:s,onTaskIndent:l,onTaskOutdent:c,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:f=true}){let p=ve.useRef(false),y=ve.useCallback(m=>{p.current=m;},[]),x=ve.useCallback(m=>{let w=[],k=b=>{for(let C of b)w.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&k(C.subtasks);};return k(m),w},[]),g=ve.useCallback(()=>{let m=x(e);for(let w of m)if(t.has(w.id))return w;return null},[e,t,x]),h=ve.useCallback((m,w)=>{let k=x(e);if(k.length===0)return;let b=g();if(!b){r(k[0].id,false);return}let C=k.findIndex(S=>S.id===b.id);if(C===-1)return;let T=m==="up"?C-1:C+1;if(T<0||T>=k.length)return;let D=k[T];r(D.id,w);},[e,g,x,r]),v=ve.useCallback(m=>{if(!f)return;let w=m.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||p.current){m.key==="Escape"&&(w.blur(),p.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?m.metaKey:m.ctrlKey,T=Array.from(t),D=g();if(m.key==="ArrowUp"){m.preventDefault(),h("up",m.shiftKey);return}if(m.key==="ArrowDown"){m.preventDefault(),h("down",m.shiftKey);return}if(D&&(m.key==="ArrowRight"||m.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(m.preventDefault(),(m.key==="ArrowRight"&&!D.isExpanded||m.key==="ArrowLeft"&&D.isExpanded)&&u(D.id));return}if(m.altKey&&(m.key==="ArrowUp"||m.key==="ArrowDown")){T.length>0&&(m.preventDefault(),s(T,m.key==="ArrowUp"?"up":"down"));return}if(m.key==="Tab"&&!m.shiftKey){T.length>0&&(m.preventDefault(),l(T));return}if(m.key==="Tab"&&m.shiftKey){T.length>0&&(m.preventDefault(),c(T));return}if(m.key==="Enter"&&!m.shiftKey&&!C){D&&(m.preventDefault(),a(D.id,"below"));return}if(m.key==="Enter"&&m.shiftKey&&!C){D&&(m.preventDefault(),a(D.id,"above"));return}if(m.key==="Enter"&&C){D&&(m.preventDefault(),d(D.id));return}if(m.key==="F2"){D&&(m.preventDefault(),i(D.id));return}if(m.key==="Delete"||m.key==="Backspace"&&C){T.length>0&&(m.preventDefault(),n(T));return}if(m.key==="d"&&C&&!m.shiftKey){T.length>0&&(m.preventDefault(),o(T));return}},[f,t,g,h,a,n,o,s,l,c,i,u,d]);return ve.useEffect(()=>{if(f)return window.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",v);}},[f,v]),{setIsEditing:y}}function gl(){let[e,t]=ve.useState(new Set),[r,a]=ve.useState(null),n=ve.useCallback(d=>{t(new Set([d])),a(d);},[]),o=ve.useCallback(d=>{t(f=>{let p=new Set(f);return p.has(d)?p.delete(d):p.add(d),p}),a(d);},[]),s=ve.useCallback((d,f)=>{if(!r){n(d);return}let p=f.indexOf(r),y=f.indexOf(d);if(p===-1||y===-1){n(d);return}let x=Math.min(p,y),g=Math.max(p,y),h=f.slice(x,g+1);t(new Set(h)),a(d);},[r,n]),l=ve.useCallback((d,f,p,y)=>{y?s(d,f):p?o(d):n(d);},[n,o,s]),c=ve.useCallback((d,f)=>{f?t(p=>{let y=new Set(p);return y.add(d),y}):n(d);},[n]),i=ve.useCallback(()=>{t(new Set),a(null);},[]),u=ve.useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:o,selectTaskRange:s,handleTaskClick:l,handleKeyboardSelection:c,clearSelection:i,isTaskSelected:u}}function na(e){let t=[],r=(a,n,o=0)=>{for(let s=0;s<a.length;s++){let l={...a[s],parentId:n,level:o,position:s};t.push(l),l.subtasks&&l.subtasks.length>0&&l.isExpanded&&r(l.subtasks,l.id,o+1);}};return r(e),t}function _o(e,t){for(let r of e)if(r.subtasks){if(r.subtasks.some(n=>n.id===t))return r;let a=_o(r.subtasks,t);if(a)return a}return null}function $o(e,t){if(t.length===0)return e;let r=na(e),a=t[0],n=r.findIndex(d=>d.id===a);if(n<=0)return e;let o=r[n-1],s=(d,f)=>{let p=[];return {tasks:d.filter(x=>{if(f.has(x.id))return p.push(x),false;if(x.subtasks){let g=s(x.subtasks,f);x.subtasks=g.tasks,p.push(...g.removed);}return true}),removed:p}},l=(d,f,p)=>d.map(y=>y.id===f?{...y,subtasks:[...y.subtasks||[],...p],isExpanded:true}:y.subtasks?{...y,subtasks:l(y.subtasks,f,p)}:y),c=new Set(t),{tasks:i,removed:u}=s(e,c);return l(i,o.id,u)}function Wo(e,t){if(t.length===0)return e;let r=[...e];for(let a of t){let n=_o(r,a);if(!n)continue;let o=_o(r,n.id),s=(i,u,d)=>{for(let f=0;f<i.length;f++){let p=i[f];if(p.id===u&&p.subtasks){let y=p.subtasks.findIndex(x=>x.id===d);if(y!==-1){let[x]=p.subtasks.splice(y,1);return x}}if(p.subtasks){let y=s(p.subtasks,u,d);if(y)return y}}return null},l=(i,u,d)=>{let f=i.findIndex(p=>p.id===u);if(f!==-1)return i.splice(f+1,0,d),i;for(let p of i)p.subtasks&&l(p.subtasks,u,d);return i},c=s(r,n.id,a);c&&(o&&o.subtasks?l(o.subtasks,n.id,c):l(r,n.id,c));}return r}function Vo(e,t,r){if(t.length===0)return e;let a=[...e],n=t[0],o=(s,l,c)=>{let i=s.findIndex(d=>d.id===l);if(i===-1){for(let d of s)if(d.subtasks&&o(d.subtasks,l,c))return true;return false}let u=c==="up"?i-1:i+1;return u<0||u>=s.length?false:([s[i],s[u]]=[s[u],s[i]],true)};return o(a,n,r),a}function Ko(e,t){let r=new Set(t),a=n=>n.filter(o=>!r.has(o.id)).map(o=>o.subtasks?{...o,subtasks:a(o.subtasks)}:o);return a(e)}function jo(e,t){let r=[...e];for(let a of t){let n=s=>{let l=s.findIndex(u=>u.id===a);if(l===-1){for(let u of s)if(u.subtasks&&n(u.subtasks))return true;return false}let c=s[l],i={...c,id:`${c.id}-copy-${Date.now()}`,name:`${c.name} (Copy)`,subtasks:c.subtasks?o(c.subtasks):void 0};return s.splice(l+1,0,i),true},o=s=>s.map(l=>({...l,id:`${l.id}-copy-${Date.now()}`,subtasks:l.subtasks?o(l.subtasks):void 0}));n(r);}return r}function hl(e,t,r){let a=[...e],n=new Date,o=new Date(n);o.setDate(o.getDate()+7);let s={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:o,color:"#6366F1"},l=c=>{let i=c.findIndex(d=>d.id===t);if(i===-1){for(let d of c)if(d.subtasks&&l(d.subtasks))return true;return false}let u=r==="above"?i:i+1;return c.splice(u,0,s),true};return l(a),{tasks:a,newTask:s}}function qo(e,t,r){return e.map(a=>a.id===t?{...a,name:r}:a.subtasks?{...a,subtasks:qo(a.subtasks,t,r)}:a)}function Yo(e,t){return e.map(r=>r.id===t?{...r,isExpanded:!r.isExpanded}:r.subtasks?{...r,subtasks:Yo(r.subtasks,t)}:r)}function Xo(e,t){let r=new Date,a=new Date(r);a.setDate(a.getDate()+7);let n=c=>{for(let i of c){if(i.id===t)return i;if(i.subtasks){let u=n(i.subtasks);if(u)return u}}return null},o=n(e),s={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:r,endDate:a,color:o?.color||"#6366F1"},l=c=>c.map(i=>{if(i.id===t){let u=i.subtasks||[];return {...i,subtasks:[...u,s],isExpanded:true}}return i.subtasks?{...i,subtasks:l(i.subtasks)}:i});return {tasks:l(e),newTask:s}}var yl={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},xl=({icon:e,color:t})=>e==="circle"?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsxRuntime.jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function kl({status:e="todo",onChange:t,className:r}){let[a,n]=ve.useState(false),[o,s]=ve.useState({top:0,left:0}),l=ve.useRef(null),c=ve.useRef(null);ve.useEffect(()=>{if(a&&c.current){let f=c.current.getBoundingClientRect();s({top:f.bottom+window.scrollY+8,left:f.left+window.scrollX});}},[a]),ve.useEffect(()=>{let f=p=>{l.current&&!l.current.contains(p.target)&&!c.current?.contains(p.target)&&n(false);};if(a)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[a]),ve.useEffect(()=>{let f=p=>{p.key==="Escape"&&n(false);};if(a)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[a]);let i=f=>{t(f),n(false);},u=yl[e],d=u.color;return jsxRuntime.jsxs("div",{className:`relative ${r||""}`,children:[jsxRuntime.jsx("button",{ref:c,onClick:()=>n(!a),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${d}10`,boxShadow:`0 0 0 2px ${d}30 inset`},title:u.label,children:jsxRuntime.jsx(xl,{icon:u.icon,color:d})}),a&&jsxRuntime.jsx(Xe,{children:jsxRuntime.jsxs("div",{ref:l,className:"status-selector-menu",style:{position:"absolute",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsxRuntime.jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxRuntime.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsxRuntime.jsx("div",{className:"py-1",children:Object.entries(yl).map(([f,p])=>jsxRuntime.jsxs("button",{onClick:()=>i(f),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:p.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx(xl,{icon:p.icon,color:p.color}),jsxRuntime.jsx("span",{className:"font-semibold",children:p.label}),e===f&&jsxRuntime.jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},f))})]})})]})}function wn({tasks:e,theme:t,rowHeight:r,availableUsers:a=[],templates:n,onTaskClick:o,onTaskDblClick:s,onTaskContextMenu:l,onTaskToggle:c,scrollTop:i,columns:u,onToggleColumn:d,onTaskUpdate:f,onTaskIndent:p,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:g,onTaskDuplicate:h,onTaskCreate:v,onTaskRename:m,onCreateSubtask:w,onOpenTaskModal:k}){let[b,C]=ve.useState(null),[T,D]=ve.useState(false),[S,E]=ve.useState(null),[I,R]=ve.useState(""),L=ve.useRef(null),H=ve.useRef(null),[G,J]=ve.useState({isOpen:false,x:0,y:0,type:"header"});ve.useEffect(()=>{function U(z){L.current&&!L.current.contains(z.target)&&D(false);}if(T)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[T]),ve.useEffect(()=>{S&&H.current&&(H.current.focus(),H.current.select());},[S]);let{selectedTaskIds:X,handleTaskClick:ne,isTaskSelected:De}=gl(),{setIsEditing:re}=ml({tasks:e,selectedTaskIds:X,onTaskSelect:(U,z)=>{let ze=na(e).map(Ie=>Ie.id);ne(U,ze,z||false,false);},onTaskCreate:v||(()=>{}),onTaskDelete:g||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:p||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:U=>{let z=na(e).find(Me=>Me.id===U);z&&et(z);},onTaskToggleExpand:c||(()=>{}),onOpenTaskModal:U=>{let z=na(e).find(Me=>Me.id===U);z&&k&&k(z);},enableKeyboard:true}),Ee=(U,z=0)=>{let Me=[];for(let ze of U)Me.push({task:ze,level:z}),ze.subtasks&&ze.subtasks.length>0&&ze.isExpanded&&Me.push(...Ee(ze.subtasks,z+1));return Me},B=Ee(e),j=48,Le=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,et=U=>{E(U.id),R(U.name),re(true);},Rt=U=>{I.trim()&&I!==e.find(z=>z.id===U)?.name&&m?.(U,I.trim()),E(null),R(""),re(false);},ke=()=>{E(null),R(""),re(false);},ae=(U,z)=>{z.stopPropagation(),w?.(U.id);},ie=(U,z,Me)=>{switch(U.id){case "name":let ze=S===z.id,Ie=b===z.id;return jsxRuntime.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Me*24}px`},children:[z.subtasks&&z.subtasks.length>0&&jsxRuntime.jsx("button",{onClick:te=>{te.stopPropagation(),c?.(z.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:z.isExpanded?jsxRuntime.jsx(lucideReact.ChevronDown,{className:"w-4 h-4"}):jsxRuntime.jsx(lucideReact.ChevronRight,{className:"w-4 h-4"})}),jsxRuntime.jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:z.color||"#6366F1",opacity:z.parentId?.6:1,borderColor:z.isMilestone?t.accent:"transparent",borderWidth:z.isMilestone?"2px":"0px"},title:z.isMilestone?"Milestone":z.parentId?"Subtask":"Task"}),ze?jsxRuntime.jsx("input",{ref:H,type:"text",value:I,onChange:te=>R(te.target.value),onKeyDown:te=>{te.key==="Enter"?Rt(z.id):te.key==="Escape"&&ke();},onBlur:()=>Rt(z.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:te=>te.stopPropagation()}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"truncate flex-1",style:{color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:Me===0?"14px":Me===1?"13px":"12px",fontWeight:z.isMilestone?600:z.subtasks&&z.subtasks.length>0?500:400,opacity:Me===0?1:Me===1?.95:.88},children:z.name}),Ie&&!ze&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:te=>te.stopPropagation(),children:[jsxRuntime.jsx("button",{onClick:te=>ae(z,te),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsxRuntime.jsx(lucideReact.Plus,{className:"w-3.5 h-3.5"})}),jsxRuntime.jsx("button",{onClick:te=>{te.stopPropagation(),et(z);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsxRuntime.jsx(lucideReact.Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":let Ht=z.startDate?typeof z.startDate=="string"?z.startDate:z.startDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:te=>te.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:Ht||"",onChange:te=>{f?.(z.id,{startDate:te.target.value?new Date(te.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "endDate":let ht=z.endDate?typeof z.endDate=="string"?z.endDate:z.endDate.toISOString().split("T")[0]:void 0;return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:te=>te.stopPropagation(),children:jsxRuntime.jsx("input",{type:"date",value:ht||"",onChange:te=>{f?.(z.id,{endDate:te.target.value?new Date(te.target.value):void 0});},className:"bg-transparent border-none text-xs cursor-pointer outline-none text-center",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif"}})});case "duration":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",children:jsxRuntime.jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Le(z)})});case "assignees":let It=a.filter(te=>z.assignees?.some(Fe=>Fe.name===te.name||Fe.initials===te.initials));return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:te=>te.stopPropagation(),children:jsxRuntime.jsx(Pr,{assignedUsers:It,availableUsers:a,onChange:te=>{let Fe=te.map(Gt=>({id:Gt.id,name:Gt.name,initials:Gt.initials,color:Gt.color}));f?.(z.id,{assignees:Fe.length>0?Fe:void 0});}})});case "status":return jsxRuntime.jsx("div",{className:"flex items-center justify-center w-full",onClick:te=>te.stopPropagation(),children:jsxRuntime.jsx(kl,{status:z.status||"todo",onChange:te=>{f?.(z.id,{status:te,progress:te==="completed"?100:z.progress});}})});case "progress":return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsxRuntime.jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsxRuntime.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${z.progress}%`,backgroundColor:z.progress===100?t.statusCompleted:t.accent}})}),jsxRuntime.jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[z.progress,"%"]})]});default:return null}},Pt=U=>[{id:"hide",label:"Hide Column",icon:St.Hide,onClick:()=>d(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:St.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:St.SortDesc,onClick:()=>{}}],Ot=U=>[{id:"edit",label:"Edit Task",icon:St.Edit,onClick:()=>{}},{id:"addSubtask",label:"Add Subtask",icon:St.Add,onClick:()=>{}},{id:"addDependency",label:"Add Dependency",icon:St.Link,onClick:()=>{}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markComplete",label:U.status==="completed"?"Mark Incomplete":"Mark Complete",icon:St.Progress,onClick:()=>{let z=U.status==="completed"?"in-progress":"completed",Me=U.status==="completed"?U.progress:100;f?.(U.id,{status:z,progress:Me});}},{id:"setInProgress",label:"Set In Progress",icon:St.Progress,onClick:()=>{f?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"delete",label:"Delete Task",icon:St.Delete,onClick:()=>{window.confirm(`Delete task "${U.name}"?`)&&g?.([U.id]);}}],zt=u.filter(U=>U.visible);return jsxRuntime.jsxs("div",{className:"h-full overflow-auto",style:{backgroundColor:t.bgPrimary,borderRight:`1px solid ${t.border}`},children:[jsxRuntime.jsxs("div",{className:"sticky top-0 z-10 flex items-center border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border,height:`${j}px`,marginLeft:"3px"},children:[zt.map(U=>jsxRuntime.jsx("div",{className:`flex items-center px-4 border-r cursor-pointer hover:bg-opacity-50 transition-colors relative ${U.id==="name"?"justify-start":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.width}px`,maxWidth:`${U.width}px`,borderColor:t.borderLight,height:"100%",boxSizing:"border-box"},onContextMenu:z=>{z.preventDefault(),J({isOpen:true,x:z.clientX,y:z.clientY,type:"header",columnId:U.id});},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent";},children:jsxRuntime.jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:U.label})},U.id)),jsxRuntime.jsxs("div",{className:"px-3 flex items-center gap-2 h-full",children:[jsxRuntime.jsx(kn,{columns:u,onToggleColumn:d,theme:t}),jsxRuntime.jsxs("button",{onClick:()=>D(!T),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:[jsxRuntime.jsx(lucideReact.Keyboard,{className:"w-4 h-4"}),T&&jsxRuntime.jsxs("div",{ref:L,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:U=>U.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsxRuntime.jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsxRuntime.jsx("button",{onClick:()=>D(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxRuntime.jsxs("div",{className:"space-y-3 text-xs",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxRuntime.jsxs("div",{className:"space-y-1",children:[jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxRuntime.jsxs("div",{className:"flex justify-between",children:[jsxRuntime.jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsxRuntime.jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]})]}),B.map(({task:U,level:z},Me)=>{let ze=De(U.id);return jsxRuntime.jsx(framerMotion.motion.div,{className:"flex items-center border-b cursor-pointer group",style:{height:`${r}px`,borderTop:`1px solid ${ze?t.accent:t.borderLight}`,borderRight:`1px solid ${ze?t.accent:t.borderLight}`,borderBottom:`1px solid ${ze?t.accent:t.borderLight}`,borderLeft:ze?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ze?t.accentLight:Me%2===0?t.bgPrimary:t.bgGrid},onMouseEnter:()=>C(U.id),onMouseLeave:()=>C(null),onClick:Ie=>{let ht=na(e).map(Fe=>Fe.id),te=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ie.metaKey:Ie.ctrlKey;ne(U.id,ht,te,Ie.shiftKey),o?.(U);},onDoubleClick:Ie=>{Ie.stopPropagation(),s?.(U);},onContextMenu:Ie=>{Ie.preventDefault(),J({isOpen:true,x:Ie.clientX,y:Ie.clientY,type:"task",task:U}),l?.(U,Ie);},whileHover:{backgroundColor:ze?t.accentLight:t.hoverBg},children:zt.map(Ie=>jsxRuntime.jsx("div",{className:`px-4 border-r flex items-center ${Ie.id==="name"?"justify-start":"justify-center"}`,style:{width:`${Ie.width}px`,minWidth:`${Ie.width}px`,maxWidth:`${Ie.width}px`,borderColor:b===U.id?t.border:t.borderLight,height:"100%",boxSizing:"border-box"},children:ie(Ie,U,Ie.id==="name"?z:0)},`${U.id}-${Ie.id}`))},U.id)}),jsxRuntime.jsx(aa,{isOpen:G.isOpen,x:G.x,y:G.y,items:G.type==="header"&&G.columnId?Pt(G.columnId):G.type==="task"&&G.task?Ot(G.task):[],onClose:()=>J({...G,isOpen:false}),theme:t})]})}function Tl(e,t){let[r,a]=ve.useState("none"),[n,o]=ve.useState(0),[s,l]=ve.useState(e),[c,i]=ve.useState(t),[u,d]=ve.useState(null),[f,p]=ve.useState(null),[y,x]=ve.useState(null),[g,h]=ve.useState(null),[v,m]=ve.useState(0),[w,k]=ve.useState(0),[b,C]=ve.useState(null),[T,D]=ve.useState(false);return {dragMode:r,setDragMode:a,dragOffset:n,setDragOffset:o,ghostX:s,setGhostX:l,ghostWidth:c,setGhostWidth:i,connectionLine:u,setConnectionLine:d,hoveredTaskId:f,setHoveredTaskId:p,activeZone:y,setActiveZone:x,draggedSegmentIndex:g,setDraggedSegmentIndex:h,draggedSegmentStartX:v,setDraggedSegmentStartX:m,segmentDragOffsetX:w,setSegmentDragOffsetX:k,hoveredSegmentIndex:b,setHoveredSegmentIndex:C,isHovered:T,setIsHovered:D,isDragging:r!=="none",isResizing:r==="resize-start"||r==="resize-end",isConnecting:r==="connect",resetDragState:(L,H)=>{a("none"),d(null),p(null),l(L),i(H),k(0),h(null),m(0);}}}function Cn({task:e,x:t,y:r,width:a,theme:n,dayWidth:o,startDate:s,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:f,allTaskPositions:p=[]}){let y=Tl(t,a),x=ve.useRef(null),{dragMode:g,setDragMode:h,dragOffset:v,setDragOffset:m,ghostX:w,setGhostX:k,ghostWidth:b,setGhostWidth:C,connectionLine:T,setConnectionLine:D,hoveredTaskId:S,setHoveredTaskId:E,activeZone:I,setActiveZone:R,draggedSegmentIndex:L,setDraggedSegmentIndex:H,draggedSegmentStartX:G,setDraggedSegmentStartX:J,segmentDragOffsetX:X,setSegmentDragOffsetX:ne,hoveredSegmentIndex:De,setHoveredSegmentIndex:re,isHovered:Ee,setIsHovered:B,isDragging:j,isResizing:Le,isConnecting:et,resetDragState:Rt}=y,ke=32,ae=8,ie=e.endDate&&e.endDate<new Date&&e.progress<100,Pt=e.isCriticalPath,Ot=n.name==="neutral"||n.today==="#1C1917",U=(O=>O>=80?20:O>=60?15:O>=50?12:10)(a),z=a<50,Me=a<40,ze=O=>O.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Ie=()=>{let O=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${O} day${O!==1?"s":""}`},Ht=O=>Math.round(O/o)*o,ht=O=>{let ge=Math.round(O/o),de=new Date(s);return de.setDate(de.getDate()+ge),de},It=(O,ge)=>{for(let de of p){if(de.id===e.id)continue;let N=5;if(O>=de.x-N&&O<=de.x+de.width+N&&ge>=de.y-N&&ge<=de.y+de.height+N)return de.id}return null},te=ve.useCallback((O,ge,de)=>{O.preventDefault(),O.stopPropagation();let N=x.current?.ownerSVGElement;if(!N)return;let _=N.createSVGPoint();_.x=O.clientX,_.y=O.clientY;let ue=_.matrixTransform(N.getScreenCTM()?.inverse()),we=de!==void 0?de:t,Se=ge;if(!Se){let Nt=ue.x-we;O.shiftKey?(Se="connect",D({x:t+a,y:r+ke/2})):O.ctrlKey||O.metaKey?Se="move":O.altKey?Se=Nt<a/2?"resize-start":"resize-end":Me?Nt<a/2?Se="move":Se="resize-end":z?Nt<=U/2?Se="resize-start":Nt>=a-U/2?Se="resize-end":Se="move":Nt<=U?Se="resize-start":Nt>=a-U?Se="resize-end":Se="move";}h(Se),B(false),R(null),Se==="move"?m(ue.x-we):Se==="connect"?D({x:t+a,y:r+ke/2}):m(0),k(we),C(a);},[t,a,r,ke]),Fe=ve.useCallback(O=>{if(g==="none")return;let ge=x.current?.ownerSVGElement;if(!ge)return;let de=ge.createSVGPoint();de.x=O.clientX,de.y=O.clientY;let N=de.matrixTransform(ge.getScreenCTM()?.inverse());if(g==="connect"){D({x:N.x,y:N.y});let _=It(N.x,N.y);E(_);}else if(g==="move"){let _=N.x-v,ue=Ht(_);if(k(ue),C(a),e.segments&&e.segments.length>0&&L!==null){let we=ue-G;ne(we);}}else if(g==="resize-start"){let _=N.x,ue=Ht(_),we=t+a-ue;we>=o&&(k(ue),C(we));}else if(g==="resize-end"){let _=N.x,we=Ht(_)-t;we>=o&&C(we);}},[g,t,a,o,v,e,Ht,L,G,It,E,D,k,C,ne]),Gt=ve.useCallback(()=>{if(g!=="none"){if(g==="connect")S&&f&&f(e,S),D(null),E(null);else {let O=e.endDate.getTime()-e.startDate.getTime(),ge,de,N=true;if(g==="move"){if(ge=ht(w),de=new Date(ge.getTime()+O),e.segments&&e.segments.length>0&&L!==null){let _=Math.round(X/o),ue=e.segments.map((Mt,Gn)=>{if(Gn===L){let la=new Date(Mt.startDate),Wr=new Date(Mt.endDate);return la.setDate(la.getDate()+_),Wr.setDate(Wr.getDate()+_),{startDate:la,endDate:Wr}}return Mt}),we=ue.flatMap(Mt=>[Mt.startDate,Mt.endDate]),Se=new Date(Math.min(...we.map(Mt=>Mt.getTime()))),Nt=new Date(Math.max(...we.map(Mt=>Mt.getTime())));d?.({...e,segments:ue},Se,Nt),Rt(t,a);return}}else g==="resize-start"?(ge=ht(w),de=e.endDate,ge>=de&&(console.warn("Invalid date range: start date must be before end date"),N=false)):g==="resize-end"?(ge=e.startDate,de=ht(w+b),de<=ge&&(console.warn("Invalid date range: end date must be after start date"),N=false)):N=false;N&&ge&&de&&(de.getTime()-ge.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,ge,de));}Rt(t,a);}},[g,w,b,e,d,S,f,t,a,o,ht,X,L,Rt]);ve.useEffect(()=>{if(g==="none")return;let O=de=>{Fe(de);},ge=()=>{Gt();};return window.addEventListener("mousemove",O),window.addEventListener("mouseup",ge),()=>{window.removeEventListener("mousemove",O),window.removeEventListener("mouseup",ge);}},[g,Fe,Gt]);let he=j&&!et?w:t,me=j&&!et?b:a,nr=l.taskTooltip(e),_r=typeof nr=="string"?nr:"",$r=l.taskClass(e);return jsxRuntime.jsxs("g",{ref:x,onMouseEnter:()=>!j&&B(true),onMouseLeave:()=>{j||(B(false),R(null));},onClick:()=>!j&&c?.(e),onDoubleClick:O=>{j||(O.stopPropagation(),i?.(e));},onContextMenu:O=>{O.preventDefault(),u?.(e,O);},children:[_r&&jsxRuntime.jsx("title",{dangerouslySetInnerHTML:{__html:_r}}),Ee&&!j&&!z&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:U,height:ke,fill:I==="resize-start"?n.accent:"transparent",opacity:I==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>R("resize-start"),onMouseDown:O=>te(O,"resize-start")}),jsxRuntime.jsx("rect",{x:t+U,y:r,width:a-U*2,height:ke,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>R("move"),onMouseDown:O=>te(O,"move")}),jsxRuntime.jsx("rect",{x:t+a-U,y:r,width:U,height:ke,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>R("resize-end"),onMouseDown:O=>te(O,"resize-end")})]}),Ee&&!j&&Me&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:t,y:r,width:a/2,height:ke,fill:I==="move"?n.accent:"transparent",opacity:I==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>R("move"),onMouseDown:O=>te(O,"move")}),jsxRuntime.jsx("rect",{x:t+a/2,y:r,width:a/2,height:ke,fill:I==="resize-end"?n.accent:"transparent",opacity:I==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>R("resize-end"),onMouseDown:O=>te(O,"resize-end")}),Ee&&jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a/2,y1:r+4,x2:t+a/2,y2:r+ke-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),j&&!et&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:w,y:r,width:b,height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":n.taskBarPrimary,opacity:.3,stroke:e.isCriticalPath?"#EF4444":n.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.5},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:he,y:r,width:me,height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":e.color?e.color:n.taskBarPrimary,"data-task-class":$r,initial:{opacity:0,scale:.95},animate:{opacity:j&&!et?.15:e.parentId?.6:Ee?.9:.8,scale:Ee&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:O=>te(O),style:{cursor:j?et?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsxRuntime.jsx("rect",{x:he,y:r,width:me*(e.progress/100),height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((O,ge)=>{let de=(O.startDate.getTime()-s.getTime())/864e5*o,_=(O.endDate.getTime()-s.getTime())/(1e3*60*60*24)*o-de+o,ue=j&&g==="move"&&L===ge,we=De===ge,Se=ue?de+X:de;return jsxRuntime.jsxs("g",{onMouseEnter:()=>!j&&re(ge),onMouseLeave:()=>!j&&re(null),children:[jsxRuntime.jsx(framerMotion.motion.rect,{x:Se,y:r,width:_,height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":e.color?e.color:n.taskBarPrimary,initial:{opacity:0,scale:.95},animate:{opacity:ue||e.parentId?.6:we?.9:.8,scale:we&&!j?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Nt=>{Nt.stopPropagation(),H(ge),J(de),te(Nt,void 0,de);},style:{cursor:j?et?"crosshair":Le?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsxRuntime.jsx("rect",{x:Se,y:r,width:_*(e.progress/100),height:ke,rx:ae,fill:e.isCriticalPath?"#DC2626":e.color?e.color:n.taskBarProgress,opacity:1,style:{pointerEvents:"none"}})]},`segment-${ge}`)}),Ot&&(ie||Pt)&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[Pt&&!ie&&jsxRuntime.jsx("rect",{x:he,y:r,width:me,height:ke,rx:ae,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),ie&&jsxRuntime.jsx("rect",{x:he,y:r,width:me,height:ke,rx:ae,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),me>60&&!e.segments&&(()=>{let O=l.taskLabel(e),ge=typeof O=="string"?O:e.name,de=ge.length>Math.floor(me/8)?`${ge.substring(0,Math.floor(me/8))}...`:ge;return jsxRuntime.jsx("text",{x:he+12,y:r+ke/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:de})})(),me>100&&e.progress>0&&e.progress<100&&!j&&!e.segments&&jsxRuntime.jsxs("text",{x:he+me-12,y:r+ke/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&me>80&&!j&&!e.segments&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsxRuntime.jsx("circle",{cx:he+me-8,cy:r+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsxRuntime.jsx("circle",{cx:he+me-8,cy:r+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ee||Le)&&!et&&!e.segments&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:z?he-15:he-10,y:r-5,width:z?25:20,height:ke+10,fill:"transparent",onMouseDown:O=>te(O,"resize-start"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:z?he-8:he-3,y:r+6,width:z?8:6,height:z?ke-12:ke-16,rx:3,fill:g==="resize-start"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxRuntime.jsxs("g",{style:{pointerEvents:"all"},children:[jsxRuntime.jsx("rect",{x:he+me-10,y:r-5,width:z?25:20,height:ke+10,fill:"transparent",onMouseDown:O=>te(O,"resize-end"),style:{cursor:"ew-resize"}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:z?he+me:he+me-3,y:r+6,width:z?8:6,height:z?ke-12:ke-16,rx:3,fill:g==="resize-end"?n.accent:n.taskBarHandle,stroke:n.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:g==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&!j&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsxRuntime.jsx(framerMotion.motion.circle,{cx:t+a+8,cy:r+ke/2,r:6,fill:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:O=>{O.stopPropagation(),te(O,"connect");},style:{cursor:"crosshair"}}),jsxRuntime.jsx("text",{x:t+a+20,y:r+ke/2,dominantBaseline:"middle",fill:n.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),et&&T&&jsxRuntime.jsxs("g",{style:{pointerEvents:"none"},children:[jsxRuntime.jsx(framerMotion.motion.line,{x1:t+a,y1:r+ke/2,x2:T.x,y2:T.y,stroke:S?n.statusCompleted:n.accent,strokeWidth:S?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:S?1:.8},transition:{duration:.15}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:T.x,cy:T.y,r:S?8:6,fill:S?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),S&&jsxRuntime.jsx(framerMotion.motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(Ee||j)&&!et&&!e.segments&&jsxRuntime.jsx(framerMotion.motion.rect,{x:he-2,y:r-2,width:me+4,height:ke+4,rx:ae+2,fill:"none",stroke:j?n.accent:n.taskBarPrimary,strokeWidth:2,opacity:j?.6:.4,initial:{opacity:0},animate:{opacity:j?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Le&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsxRuntime.jsx("line",{x1:w+b,y1:0,x2:w+b,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:Ee&&!j&&!e.segments&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsxRuntime.jsx("rect",{x:he+me/2-120,y:r-95,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${he+me/2-6} ${r-13} L ${he+me/2} ${r-3} L ${he+me/2+6} ${r-13}`,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsxRuntime.jsx("text",{x:he+me/2,y:r-73,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsxRuntime.jsx("text",{x:he+me/2-110,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsxRuntime.jsx("text",{x:he+me/2-70,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ze(e.startDate)}),jsxRuntime.jsx("text",{x:he+me/2-110,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsxRuntime.jsx("text",{x:he+me/2-70,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ze(e.endDate)}),jsxRuntime.jsx("text",{x:he+me/2+10,y:r-55,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsxRuntime.jsx("text",{x:he+me/2+65,y:r-55,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Ie()}),jsxRuntime.jsx("text",{x:he+me/2+10,y:r-40,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxRuntime.jsxs("text",{x:he+me/2+65,y:r-40,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("text",{x:he+me/2-110,y:r-25,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxRuntime.jsxs("text",{x:he+me/2-50,y:r-25,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(O=>O.name).join(", ").substring(0,30),e.assignees.map(O=>O.name).join(", ").length>30?"...":""]})]}),jsxRuntime.jsx("text",{x:he+me/2,y:r-18,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Me?"Left: move \u2022 Right: resize":z?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})]})}function Sn({x1:e,y1:t,x2:r,y2:a,theme:n,onDelete:o}){let[s,l]=ve.useState(false),c=r-e,i=a-t,u=e+c/2,d=`M ${e} ${t} C ${u} ${t}, ${u} ${a}, ${r} ${a}`,f=6,p=Math.atan2(i,c),y=r-f*Math.cos(p-Math.PI/6),x=a-f*Math.sin(p-Math.PI/6),g=r-f*Math.cos(p+Math.PI/6),h=a-f*Math.sin(p+Math.PI/6),v=n.dependency;return jsxRuntime.jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),children:[jsxRuntime.jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsxRuntime.jsx(framerMotion.motion.path,{d,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:s?1:.6,strokeWidth:s?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsxRuntime.jsx(framerMotion.motion.path,{d:`M ${r} ${a} L ${y} ${x} M ${r} ${a} L ${g} ${h}`,fill:"none",stroke:v,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:s?1:.6,scale:s?1.1:1,strokeWidth:s?2.5:2},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.motion.circle,{cx:r,cy:a,r:3,fill:v,initial:{scale:0},animate:{scale:s?1.33:1},transition:{scale:{delay:.3,duration:.2}}}),s&&o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:m=>{m.stopPropagation(),o();},style:{cursor:"pointer"},children:[jsxRuntime.jsx("circle",{cx:u,cy:(t+a)/2,r:10,fill:n.bgSecondary,stroke:n.error||"#ef4444",strokeWidth:2}),jsxRuntime.jsx("line",{x1:u-4,y1:(t+a)/2-4,x2:u+4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:u+4,y1:(t+a)/2-4,x2:u-4,y2:(t+a)/2+4,stroke:n.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Dn({task:e,x:t,y:r,theme:a,onClick:n}){let[o,s]=ve.useState(false),l=16,c=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxRuntime.jsxs("g",{onMouseEnter:()=>s(true),onMouseLeave:()=>s(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsxRuntime.jsx(framerMotion.motion.circle,{cx:t,cy:r+16,r:l+4,fill:a.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsxRuntime.jsx(framerMotion.motion.rect,{x:t-l/2,y:r+16-l/2,width:l,height:l,fill:e.isCriticalPath?a.criticalPath:a.milestone,stroke:a.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsxRuntime.jsx(framerMotion.motion.rect,{x:t-(l+4)/2,y:r+16-(l+4)/2,width:l+4,height:l+4,fill:"none",stroke:e.isCriticalPath?a.criticalPath:a.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${r+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsxRuntime.jsx(framerMotion.AnimatePresence,{children:o&&jsxRuntime.jsxs(framerMotion.motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsxRuntime.jsx("rect",{x:t-80,y:r-50,width:160,height:44,rx:8,fill:a.bgSecondary,stroke:a.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsxRuntime.jsx("path",{d:`M ${t-6} ${r-6} L ${t} ${r+4} L ${t+6} ${r-6}`,fill:a.bgSecondary,stroke:a.border,strokeWidth:1}),jsxRuntime.jsx("rect",{x:t-70,y:r-38,width:8,height:8,fill:e.isCriticalPath?a.criticalPath:a.milestone,transform:`rotate(45 ${t-66} ${r-34})`}),jsxRuntime.jsx("text",{x:t-55,y:r-32,fill:a.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsxRuntime.jsx("text",{x:t-55,y:r-18,fill:a.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:t+10,y:r-40,width:60,height:16,rx:4,fill:a.criticalPathLight}),jsxRuntime.jsx("text",{x:t+40,y:r-30,textAnchor:"middle",fill:a.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}function Rn({tasks:e,theme:t,rowHeight:r,timeScale:a,startDate:n,endDate:o,zoom:s,templates:l,onTaskClick:c,onTaskDblClick:i,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:f,onDependencyDelete:p}){let x=Math.ceil((o.getTime()-n.getTime())/864e5),g=a==="day"?60:a==="week"?20:8,h=x*g*s,v=E=>{let I=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),R=I.getUTCDay()||7;I.setUTCDate(I.getUTCDate()+4-R);let L=new Date(Date.UTC(I.getUTCFullYear(),0,1));return Math.ceil(((I.getTime()-L.getTime())/864e5+1)/7)},m=E=>{let I=E.getDay();return I===0||I===6},w=ve.useCallback(E=>{let I=Math.round(E/(g*s)),R=new Date(n);return R.setDate(R.getDate()+I),R},[n,g,s]),k=ve.useCallback((E,I)=>{if(I.startDate&&I.endDate)return;let R=E.currentTarget.ownerSVGElement;if(!R)return;let L=R.createSVGPoint();L.x=E.clientX,L.y=E.clientY;let H=L.matrixTransform(R.getScreenCTM()?.inverse()),G=w(H.x),J=new Date(G);J.setDate(J.getDate()+1),d?.(I,G,J);},[w,d]),b=ve.useMemo(()=>{let E=H=>H.map(G=>{if(G.subtasks&&G.subtasks.length>0){let J=E(G.subtasks),X=J.filter(ne=>ne.startDate&&ne.endDate);if(X.length>0){let ne=X.map(B=>B.startDate.getTime()),De=X.map(B=>B.endDate.getTime()),re=new Date(Math.min(...ne)),Ee=new Date(Math.max(...De));return {...G,subtasks:J,startDate:re,endDate:Ee}}return {...G,subtasks:J}}return G}),I=(H,G=[])=>{for(let J of H)G.push(J),J.subtasks&&J.subtasks.length>0&&(J.isExpanded===void 0||J.isExpanded)&&I(J.subtasks,G);return G},R=E(e);return I(R)},[e]),C=ve.useCallback(E=>{if(!E.startDate||!E.endDate)return {x:0,width:0};let I=E.startDate.getTime(),R=E.endDate.getTime(),L=n.getTime(),H=(I-L)/(1e3*60*60*24),G=(R-I)/(1e3*60*60*24),J=H*g*s,X=Math.max(g*s,40),ne=Math.max(G*g*s,X);return {x:J,width:ne}},[n,g,s]),T=ve.useMemo(()=>b.filter(E=>E.startDate&&E.endDate).map(E=>{let{x:I,width:R}=C(E),H=48+b.findIndex(G=>G.id===E.id)*r+12;return {id:E.id,x:I,y:H,width:R,height:32}}),[b,C]),D=ve.useMemo(()=>{let E=[],I=new Date(n);for(;I<=o;){let H=(I.getTime()-n.getTime())/864e5*g*s;if(a==="day")E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:H}),I.setDate(I.getDate()+1);else if(a==="week"){let G=v(I);E.push({date:new Date(I),label:`Week ${G}`,x:H}),I.setDate(I.getDate()+7);}else E.push({date:new Date(I),label:I.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:H}),I.setMonth(I.getMonth()+1);}return E},[n,o,a,g,s]),S=ve.useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*g*s,[n,g,s]);return jsxRuntime.jsx("div",{className:"w-full h-full","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},children:jsxRuntime.jsxs("svg",{width:Math.max(h,1e3),height:Math.max(b.length*r+48,600),children:[jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsx("filter",{id:"shadow",children:jsxRuntime.jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsxRuntime.jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsxRuntime.jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsxRuntime.jsx("rect",{x:0,y:0,width:Math.max(h,1e3),height:Math.max(b.length*r+48,600),fill:t.bgPrimary}),jsxRuntime.jsx("rect",{x:0,y:0,width:h,height:48,fill:t.bgGrid}),D.map((E,I)=>{let R=D[I+1]?.x||h,L=m(E.date);return jsxRuntime.jsxs("g",{children:[L&&jsxRuntime.jsx("rect",{x:E.x,y:48,width:R-E.x,height:b.length*r,fill:t.bgWeekend,opacity:1}),jsxRuntime.jsx("line",{x1:E.x,y1:48,x2:E.x,y2:b.length*r+48,stroke:t.border,strokeWidth:1,opacity:.1}),jsxRuntime.jsx("text",{x:E.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:E.label})]},I)}),S>=0&&S<=h&&jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("line",{x1:S,y1:48,x2:S,y2:b.length*r+48,stroke:t.today,strokeWidth:2,opacity:1}),jsxRuntime.jsx("circle",{cx:S,cy:38,r:6,fill:t.today,opacity:1})]}),b.map((E,I)=>{let R=E.startDate&&E.endDate;return jsxRuntime.jsxs("g",{children:[jsxRuntime.jsx("rect",{x:0,y:48+I*r,width:h,height:r,fill:I%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${E.id}`),!R&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("rect",{x:0,y:48+I*r,width:h,height:r,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:L=>k(L,E),onMouseEnter:L=>{L.currentTarget.setAttribute("fill",t.accentLight),L.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:L=>{L.currentTarget.setAttribute("fill","transparent"),L.currentTarget.setAttribute("opacity","1");}},`clickable-${E.id}`),jsxRuntime.jsx("text",{x:S>0?S:100,y:48+I*r+r/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:"Click to set dates..."},`placeholder-${E.id}`)]})]},`row-group-${E.id}`)}),b.map((E,I)=>!E.dependencies||E.dependencies.length===0||!E.startDate||!E.endDate?null:E.dependencies.map(R=>{let L=b.find(X=>X.id===R);if(!L||!L.startDate||!L.endDate)return null;let H=b.findIndex(X=>X.id===R),G=C(L),J=C(E);return jsxRuntime.jsx(Sn,{x1:G.x+G.width,y1:48+H*r+r/2,x2:J.x,y2:48+I*r+r/2,theme:t,onDelete:()=>p?.(E.id,R)},`dep-${R}-${E.id}`)})),b.map((E,I)=>{if(!E.startDate||!E.endDate)return null;let{x:R,width:L}=C(E),H=48+I*r+12,G=E.subtasks&&E.subtasks.length>0&&!E.isMilestone;return E.isMilestone?jsxRuntime.jsx(Dn,{task:E,x:R+L/2,y:H+16,theme:t,onClick:c},E.id):G?jsxRuntime.jsxs("g",{onClick:()=>c?.(E),style:{cursor:"pointer"},children:[jsxRuntime.jsx("rect",{x:R,y:H,width:L,height:32,fill:t.primary,opacity:.25,rx:6}),jsxRuntime.jsx("line",{x1:R,y1:H,x2:R+L,y2:H,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:H,x2:R,y2:H+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R+L,y1:H,x2:R+L,y2:H+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsxRuntime.jsx("line",{x1:R,y1:H+32,x2:R+L,y2:H+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),L>60&&jsxRuntime.jsx("text",{x:R+12,y:H+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:E.name})]},E.id):jsxRuntime.jsx(Cn,{task:E,x:R,y:H,width:L,theme:t,dayWidth:g*s,startDate:n,templates:l,onClick:c,onDoubleClick:i,onContextMenu:u,onDateChange:d,onDependencyCreate:f,allTaskPositions:T},E.id)})]})})}var El=[{name:"Azul",value:"#6366F1",light:"#818CF8"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Gris",value:"#6B7280",light:"#9CA3AF"},{name:"Piedra",value:"#78716C",light:"#A8A29E"}];function Rl({value:e="#6366F1",onChange:t,disabled:r=false}){return jsxRuntime.jsxs("div",{className:"space-y-2",children:[jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:El.map(a=>{let n=e===a.value;return jsxRuntime.jsx(framerMotion.motion.button,{type:"button",onClick:()=>!r&&t(a.value),className:"relative rounded-full transition-all focus:outline-none focus:ring-2 focus:ring-offset-2",style:{width:"32px",height:"32px",backgroundColor:a.value,boxShadow:n?`0 0 0 2px #FFFFFF, 0 0 0 4px ${a.value}`:"0 1px 3px rgba(0, 0, 0, 0.12)",opacity:r?.5:1,cursor:r?"not-allowed":"pointer"},whileHover:r?{}:{scale:1.1},whileTap:r?{}:{scale:.95},title:a.name,disabled:r,children:n&&jsxRuntime.jsx(framerMotion.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute inset-0 flex items-center justify-center",children:jsxRuntime.jsx(lucideReact.Check,{className:"w-4 h-4 text-white drop-shadow-md",strokeWidth:3})})},a.value)})}),e&&jsxRuntime.jsx("div",{className:"text-xs text-center font-medium",style:{color:e},children:El.find(a=>a.value===e)?.name||"Personalizado"})]})}function Pn({isOpen:e,onClose:t,task:r,availableTasks:a=[],availableUsers:n=[],onSubmit:o,isLoading:s=false,mode:l=r?"edit":"create",theme:c="dark"}){let i=fe[c]||fe.dark,u={backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`,color:i.textPrimary},d={color:i.textSecondary},[f,p]=ve.useState({name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[y,x]=ve.useState({});ve.useEffect(()=>{p(r?{name:r.name,startDate:r.startDate,endDate:r.endDate,progress:r.progress,status:r.status||"todo",isMilestone:r.isMilestone||false,color:r.color||"#6366F1",assignees:r.assignees||[],dependencies:r.dependencies||[]}:{name:"",progress:0,status:"todo",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]});},[r,e]);let g=()=>{let m={};return f.name.trim()||(m.name="El nombre es requerido"),f.startDate&&f.endDate&&f.startDate>f.endDate&&(m.endDate="La fecha de fin debe ser posterior a la de inicio"),x(m),Object.keys(m).length===0},h=async m=>{if(m.preventDefault(),!!g())try{await o(f),t();}catch(w){console.error("Error submitting task:",w);}},v=(m,w)=>{p(k=>{let b={...k,[m]:w};if(m==="progress"){let C=typeof w=="number"?w:parseInt(w,10);C===100&&k.status!=="completed"?b.status="completed":C>0&&C<100&&k.status==="todo"?b.status="in-progress":C===0&&k.status==="in-progress"&&(b.status="todo");}return b}),y[m]&&x(k=>{let b={...k};return delete b[m],b});};return jsxRuntime.jsx(framerMotion.AnimatePresence,{children:e&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/50 z-50",onClick:t}),jsxRuntime.jsx(framerMotion.motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.2,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:i.bgPrimary,border:`1px solid ${i.border}`},onClick:m=>m.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-6 py-4",style:{borderBottom:`1px solid ${i.border}`},children:[jsxRuntime.jsx("h2",{className:"text-lg font-semibold",style:{color:i.textPrimary},children:l==="create"?"Crear Nueva Tarea":"Editar Tarea"}),jsxRuntime.jsx("button",{onClick:t,className:"p-2 rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:m=>m.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:m=>m.currentTarget.style.backgroundColor="transparent",disabled:s,children:jsxRuntime.jsx(lucideReact.X,{className:"w-5 h-5"})})]}),jsxRuntime.jsxs("form",{onSubmit:h,className:"p-6 space-y-6 max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-2",style:d,children:"Nombre de la Tarea *"}),jsxRuntime.jsx("input",{type:"text",value:f.name,onChange:m=>v("name",m.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,onFocus:m=>m.currentTarget.style.borderColor=i.accent,onBlur:m=>m.currentTarget.style.borderColor=i.borderLight,placeholder:"Ej: Dise\xF1ar mockups de la aplicaci\xF3n",disabled:s}),y.name&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),y.name]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Inicio"]}),jsxRuntime.jsx("input",{type:"date",value:f.startDate?f.startDate.toISOString().split("T")[0]:"",onChange:m=>v("startDate",m.target.value?new Date(m.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||f.isMilestone})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Calendar,{className:"w-4 h-4"}),"Fecha de Fin"]}),jsxRuntime.jsx("input",{type:"date",value:f.endDate?f.endDate.toISOString().split("T")[0]:"",onChange:m=>v("endDate",m.target.value?new Date(m.target.value):void 0),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s||f.isMilestone}),y.endDate&&jsxRuntime.jsxs("p",{className:"mt-1 text-sm text-red-400 flex items-center gap-1",children:[jsxRuntime.jsx(lucideReact.AlertCircle,{className:"w-4 h-4"}),y.endDate]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),"Estado"]}),jsxRuntime.jsxs("select",{value:f.status,onChange:m=>v("status",m.target.value),className:"w-full px-4 py-2.5 rounded-lg focus:outline-none focus:ring-2 focus:border-transparent",style:u,disabled:s,children:[jsxRuntime.jsx("option",{value:"todo",children:"Por Hacer"}),jsxRuntime.jsx("option",{value:"in-progress",children:"En Progreso"}),jsxRuntime.jsx("option",{value:"completed",children:"Completada"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-3 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Palette,{className:"w-4 h-4"}),"Color de la Tarea"]}),jsxRuntime.jsx(Rl,{value:f.color,onChange:m=>v("color",m),disabled:s}),jsxRuntime.jsx("p",{className:"text-xs mt-2",style:{color:i.textTertiary},children:r?.parentId?"Esta subtarea hereda el color de su tarea padre":r?.subtasks&&r.subtasks.length>0?"Las subtareas heredar\xE1n este color con menor opacidad":"Elige un color para organizar visualmente tus tareas"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center justify-between",style:d,children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(lucideReact.Clock,{className:"w-4 h-4"}),"Progreso"]}),jsxRuntime.jsxs("span",{className:"font-semibold px-2 py-0.5 rounded text-sm",style:{color:f.progress<30?"#EF4444":f.progress<70?"#F59E0B":"#10B981",backgroundColor:f.progress<30?"rgba(239, 68, 68, 0.1)":f.progress<70?"rgba(245, 158, 11, 0.1)":"rgba(16, 185, 129, 0.1)"},children:[f.progress,"%"]})]}),jsxRuntime.jsxs("div",{className:"relative",children:[jsxRuntime.jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress,onChange:m=>v("progress",parseInt(m.target.value)),className:"w-full h-2 rounded-lg appearance-none cursor-pointer",style:{backgroundColor:i.bgSecondary,accentColor:f.progress<30?"#EF4444":f.progress<70?"#F59E0B":"#10B981"},disabled:s}),jsxRuntime.jsx("div",{className:"absolute top-0 left-0 h-2 rounded-lg pointer-events-none transition-all duration-300",style:{width:`${f.progress}%`,backgroundColor:f.progress<30?"rgba(239, 68, 68, 0.3)":f.progress<70?"rgba(245, 158, 11, 0.3)":"rgba(16, 185, 129, 0.3)"}})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between mt-3 gap-2",children:[jsxRuntime.jsx("span",{className:"text-xs",style:{color:i.textTertiary},children:"Accesos r\xE1pidos:"}),jsxRuntime.jsx("div",{className:"flex gap-1.5",children:[0,25,50,75,100].map(m=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>v("progress",m),disabled:s,className:"px-3 py-1 text-xs font-medium rounded-md transition-all duration-200 hover:scale-105 active:scale-95",style:{backgroundColor:f.progress===m?m<30?"#EF4444":m<70?"#F59E0B":"#10B981":i.bgSecondary,color:f.progress===m?"#FFFFFF":i.textSecondary,border:`1px solid ${f.progress===m?m<30?"#EF4444":m<70?"#F59E0B":"#10B981":i.borderLight}`},children:[m,"%"]},m))})]}),jsxRuntime.jsxs("div",{className:"flex justify-between text-xs mt-2",style:{color:i.textTertiary},children:[jsxRuntime.jsx("span",{children:"0%"}),jsxRuntime.jsx("span",{children:"25%"}),jsxRuntime.jsx("span",{children:"50%"}),jsxRuntime.jsx("span",{children:"75%"}),jsxRuntime.jsx("span",{children:"100%"})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:[jsxRuntime.jsx("input",{type:"checkbox",id:"isMilestone",checked:f.isMilestone,onChange:m=>v("isMilestone",m.target.checked),className:"w-4 h-4 rounded focus:ring-2",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("label",{htmlFor:"isMilestone",className:"flex items-center gap-2 text-sm cursor-pointer",style:{color:i.textPrimary},children:[jsxRuntime.jsx(lucideReact.Milestone,{className:"w-4 h-4 text-yellow-500"}),"Marcar como Hito (Milestone)"]})]}),n.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Users,{className:"w-4 h-4"}),"Asignar a"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:n.map(m=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:f.assignees?.some(w=>w.name===m.name),onChange:w=>{let k=w.target.checked?[...f.assignees||[],{name:m.name,avatar:m.avatar,initials:m.name.split(" ").map(b=>b[0]).join("").toUpperCase().slice(0,2),color:i.accent}]:(f.assignees||[]).filter(b=>b.name!==m.name);v("assignees",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-semibold",style:{backgroundColor:i.accent},children:m.name.charAt(0).toUpperCase()}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:m.name})]})]},m.id))})]}),a.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-2 flex items-center gap-2",style:d,children:[jsxRuntime.jsx(lucideReact.Link2,{className:"w-4 h-4"}),"Dependencias"]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-32 overflow-y-auto p-3 rounded-lg",style:{backgroundColor:i.bgSecondary,border:`1px solid ${i.borderLight}`},children:a.filter(m=>m.id!==r?.id).map(m=>jsxRuntime.jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded",onMouseEnter:w=>w.currentTarget.style.backgroundColor=i.hoverBg,onMouseLeave:w=>w.currentTarget.style.backgroundColor="transparent",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:f.dependencies?.includes(m.id),onChange:w=>{let k=w.target.checked?[...f.dependencies||[],m.id]:(f.dependencies||[]).filter(b=>b!==m.id);v("dependencies",k);},className:"w-4 h-4 rounded",style:{accentColor:i.accent},disabled:s}),jsxRuntime.jsx("span",{className:"text-sm",style:{color:i.textPrimary},children:m.name})]},m.id))})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-3 px-6 py-4",style:{borderTop:`1px solid ${i.border}`,backgroundColor:i.bgPrimary},children:[jsxRuntime.jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:i.textSecondary},onMouseEnter:m=>{m.currentTarget.style.color=i.textPrimary,m.currentTarget.style.backgroundColor=i.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.color=i.textSecondary,m.currentTarget.style.backgroundColor="transparent";},disabled:s,children:"Cancelar"}),jsxRuntime.jsx("button",{onClick:h,disabled:s,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",style:{backgroundColor:i.accent,color:"#FFFFFF"},onMouseEnter:m=>!s&&(m.currentTarget.style.backgroundColor=i.accentHover),onMouseLeave:m=>!s&&(m.currentTarget.style.backgroundColor=i.accent),children:s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(lucideReact.CheckCircle2,{className:"w-4 h-4"}),l==="create"?"Crear Tarea":"Guardar Cambios"]})})]})]})})]})})}function Fl(e,t=50){let[r,a]=ve.useState({past:[],present:e,future:[]}),n=ve.useRef(false),o=ve.useCallback((i,u=true)=>{a(d=>{let f=typeof i=="function"?i(d.present):i;if(n.current)return {...d,present:f};if(!u)return {...d,present:f};let p=[...d.past,d.present];return p.length>t&&p.shift(),{past:p,present:f,future:[]}});},[t]),s=ve.useCallback(()=>{a(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:d,present:u,future:[i.present,...i.future]}});},[]),l=ve.useCallback(()=>{a(i=>{if(i.future.length===0)return i;let u=i.future[0],d=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:d}});},[]),c=ve.useCallback(()=>{a(i=>({past:[],present:i.present,future:[]}));},[]);return {state:r.present,setState:o,undo:s,redo:l,canUndo:r.past.length>0,canRedo:r.future.length>0,clearHistory:c}}function Bl({undo:e,redo:t,canUndo:r,canRedo:a,enabled:n=true}){ve.useEffect(()=>{if(!n)return;let o=s=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=l?s.metaKey:s.ctrlKey;if(c&&s.key==="z"&&!s.shiftKey&&r){s.preventDefault(),e();return}if(a){if(!l&&c&&s.key==="y"){s.preventDefault(),t();return}if(l&&c&&s.shiftKey&&s.key==="z"){s.preventDefault(),t();return}}};return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o);}},[e,t,r,a,n]);}var Y={calculateEndDate:(e,t)=>{let r=new Date(e);return r.setDate(r.getDate()+t),r},calculateDuration:(e,t)=>{let r=t.getTime()-e.getTime();return Math.ceil(r/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let r=0,a=new Date(e);for(;a<=t;){let n=a.getDay();n!==0&&n!==6&&r++,a.setDate(a.getDate()+1);}return r},addWorkingDays:(e,t)=>{let r=new Date(e),a=0;for(;a<t;){r.setDate(r.getDate()+1);let n=r.getDay();n!==0&&n!==6&&a++;}return r},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,r)=>{let a=new Map,n=i=>{i.forEach(u=>{u.dependencies&&a.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let o=a.get(r)||[];a.set(r,[...o,t]);let s=new Set,l=new Set,c=i=>{if(!s.has(i)){s.add(i),l.add(i);let u=a.get(i)||[];for(let d of u){if(!s.has(d)&&c(d))return true;if(l.has(d))return true}}return l.delete(i),false};return c(r)},flattenTasks:e=>{let t=[],r=a=>{a.forEach(n=>{t.push(n),n.subtasks&&n.subtasks.length>0&&r(n.subtasks);});};return r(e),t},findTaskById:(e,t)=>{for(let r of e){if(r.id===t)return r;if(r.subtasks){let a=Y.findTaskById(r.subtasks,t);if(a)return a}}},getParentTasks:(e,t)=>{let r=[],a=Y.findTaskById(e,t);if(!a||!a.parentId)return r;let n=a.parentId;for(;n;){let o=Y.findTaskById(e,n);if(o)r.unshift(o),n=o.parentId;else break}return r},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((r,a)=>{if(!r.id||!r.name)throw new Error(`Invalid task at index ${a}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Y.flattenTasks(e),a=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let o=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];a.push(o.join(","));}),a.join(`
|
|
46
46
|
`)},formatDate:e=>{let t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return `${t}-${r}-${a}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let r=Y.flattenTasks(e).filter(a=>a.startDate);return r.length===0?null:new Date(Math.min(...r.map(a=>a.startDate.getTime())))},getLatestEndDate:e=>{let r=Y.flattenTasks(e).filter(a=>a.endDate);return r.length===0?null:new Date(Math.max(...r.map(a=>a.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>Y.flattenTasks(e).filter(a=>a.dependencies&&a.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let r=Y.findTaskById(e,t);return !r||!r.dependencies?[]:Y.flattenTasks(e).filter(n=>r.dependencies.includes(n.id))},filterByStatus:(e,t)=>Y.flattenTasks(e).filter(r=>r.status===t),filterByDateRange:(e,t,r)=>Y.flattenTasks(e).filter(a=>!a.startDate||!a.endDate?false:a.startDate<=r&&a.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.startDate||!a.startDate)return 0;let n=r.startDate.getTime()-a.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((r,a)=>{if(!r.endDate||!a.endDate)return 0;let n=r.endDate.getTime()-a.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((r,a)=>{let n=r.progress-a.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Y.flattenTasks(e);if(t.length===0)return 0;let r=t.reduce((a,n)=>a+n.progress,0);return Math.round(r/t.length)},getTaskByPath:(e,t)=>{let r=e,a;for(let n=0;n<t.length;n++){let o=t[n];if(!r||o===void 0||o>=r.length||(a=r[o],!a))return;n<t.length-1&&(r=a.subtasks||[]);}return a},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(r=>Y.cloneTask(r))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:r}=await import('jspdf'),{default:a}=await import('jspdf-autotable'),n=new r,o=Y.flattenTasks(e);if(o.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let s=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=o.map(c=>{let i=c.startDate&&c.endDate?Y.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?Y.formatDate(c.startDate):"N/A",c.endDate?Y.formatDate(c.endDate):"N/A",i>0?`${i} days`:"N/A",`${c.progress}%`,c.status||"N/A"]});a(n,{head:s,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(r){throw r}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let r=await import('xlsx'),n=Y.flattenTasks(e).map(c=>{let i=c.startDate&&c.endDate?Y.calculateDuration(c.startDate,c.endDate):0;return {"Task ID":c.id,"Task Name":c.name,"Start Date":c.startDate?Y.formatDate(c.startDate):"","End Date":c.endDate?Y.formatDate(c.endDate):"","Duration (days)":i>0?i:"","Progress (%)":c.progress,Status:c.status||"",Assignees:c.assignees?.map(u=>u.name).join(", ")||"",Dependencies:c.dependencies?.join(", ")||"","Is Milestone":c.isMilestone?"Yes":"No","Parent ID":c.parentId||"",Level:c.level||0}}),o=r.utils.json_to_sheet(n),s=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];o["!cols"]=s;let l=r.utils.book_new();r.utils.book_append_sheet(l,o,"Gantt Tasks"),r.writeFile(l,t);},calculateCriticalPath:e=>{let t=Y.flattenTasks(e),r=t.filter(i=>i.startDate&&i.endDate);if(r.length===0)return [];let a=new Map,n=i=>{if(a.has(i.id))return;let u=i.startDate&&i.endDate?Y.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let p of i.dependencies){let y=t.find(x=>x.id===p);if(y){n(y);let x=a.get(p)?.ef||0;d=Math.max(d,x);}}let f=d+u;a.set(i.id,{es:d,ef:f});};r.forEach(n);let o=Math.max(...Array.from(a.values()).map(i=>i.ef)),s=new Map,l=i=>{if(s.has(i.id))return;let u=i.startDate&&i.endDate?Y.calculateDuration(i.startDate,i.endDate):0,d=t.filter(y=>y.dependencies&&y.dependencies.includes(i.id)),f=o;if(d.length>0)for(let y of d){l(y);let x=s.get(y.id)?.ls||0;f=Math.min(f,x);}let p=f-u;s.set(i.id,{ls:p,lf:f});};r.forEach(l);let c=[];for(let i of r){let u=a.get(i.id),d=s.get(i.id);if(u&&d){let f=d.ls-u.es;Math.abs(f)<.01&&c.push(i.id);}}return c},calculateSlack:(e,t)=>{let r=Y.findTaskById(e,t);if(!r||!r.startDate||!r.endDate)return null;if(Y.calculateCriticalPath(e).includes(t))return 0;let n=Y.getDependentTasks(e,t);if(n.length===0){let l=Y.getLatestEndDate(e);if(!l)return null;let c=Y.calculateDuration(r.endDate,l);return Math.max(0,c)}let o=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,c)=>l-c)[0];if(!o)return null;let s=Y.calculateDuration(r.endDate,new Date(o));return Math.max(0,s)},isOnCriticalPath:(e,t)=>Y.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t)=>{let r=Y.findTaskById(e,t);if(!r||!r.endDate)return e;let a=Y.getDependentTasks(e,t);if(a.length===0)return e;let n=[...e];for(let o of a){if(!o.startDate||!o.endDate)continue;let s=Y.calculateDuration(o.startDate,o.endDate),l=new Date(r.endDate);l.setDate(l.getDate()+1);let c=Y.calculateEndDate(l,s),i=u=>u.map(d=>d.id===o.id?{...d,startDate:l,endDate:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);n=i(n),n=Y.autoScheduleDependents(n,o.id);}return n},splitTask:(e,t,r,a=3)=>{let n=Y.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(r<=n.startDate||r>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let o=new Date(r);o.setDate(o.getDate()-1);let s=new Date(r);s.setDate(s.getDate()+a);let l=new Date(n.endDate);l.setDate(l.getDate()+a);let c=[{startDate:new Date(n.startDate),endDate:o},{startDate:s,endDate:l}],i=u=>u.map(d=>d.id===n.id?{...d,endDate:l,segments:c}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};var df={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Y.formatDate(e.startDate)} - ${Y.formatDate(e.endDate)}`);let r=Y.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${r} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let r=e.assignees.map(a=>a.name).join(", ");t.push(`Assigned: ${r}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,r)=>r,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Y.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Ol(e){return {...df,...e}}var hf=e=>{switch(e){case "compact":return 40;case "comfortable":return 48;case "spacious":return 56;default:return 48}},Hl=ve.forwardRef(function({tasks:t,config:r={},onTasksChange:a},n){let{theme:o,timeScale:s="week",rowDensity:l="comfortable",showThemeSelector:c=true,availableUsers:i=[],templates:u,enableAutoCriticalPath:d=true,onThemeChange:f,onTaskClick:p,onTaskDblClick:y,onTaskContextMenu:x,onTaskUpdate:g,onProgressChange:h,onDependencyCreate:v,onDependencyDelete:m,onBeforeTaskAdd:w,onAfterTaskAdd:k,onBeforeTaskUpdate:b,onAfterTaskUpdate:C}=r,D=ve.useContext(bn)?.theme,[S,E]=ve.useState(D||o||"dark"),[I,R]=ve.useState(s),[L,H]=ve.useState(l),[G,J]=ve.useState(1),[X,ne]=ve.useState(0),[De,re]=ve.useState(false),[Ee,B]=ve.useState(null),[j,Le]=ve.useState({isOpen:false,x:0,y:0,task:null}),[et,Rt]=ve.useState(null);ve.useEffect(()=>{D&&D!==S&&E(D);},[D]),ve.useEffect(()=>{o&&o!==S&&E(o);},[o]);let ke=ve.useCallback(P=>{E(P),f?.(P);},[f]),{state:ae,setState:ie,undo:Pt,redo:Ot,canUndo:zt,canRedo:U,clearHistory:z}=Fl(t,50);ve.useEffect(()=>{ie(t);},[t,ie]),ve.useEffect(()=>{a&&a(ae);},[ae,a]);let[Me,ze]=ve.useState([{id:"name",label:"TASK NAME",width:240,visible:true,sortable:true},{id:"startDate",label:"Start Date",width:110,visible:false,sortable:true},{id:"endDate",label:"End Date",width:110,visible:false,sortable:true},{id:"duration",label:"Duration",width:80,visible:false,sortable:true},{id:"assignees",label:"Assignees",width:120,visible:false,sortable:false},{id:"status",label:"Status",width:80,visible:false,sortable:true},{id:"progress",label:"% Complete",width:120,visible:false,sortable:true}]),Ie=ve.useMemo(()=>Me.filter(P=>P.visible).reduce((P,F)=>P+F.width,0)+60,[Me]),Ht=Ee||Ie,ht=ve.useRef(null),It=ve.useRef(null),te=ve.useRef(null),Fe=ve.useMemo(()=>ll(S),[S]),Gt=ve.useMemo(()=>({theme:Fe,themeName:S}),[Fe,S]),he=ve.useMemo(()=>Ol(u),[u]),me=ve.useMemo(()=>{if(!d)return ae;let P=Y.calculateCriticalPath(ae),F=V=>V.map(q=>({...q,isCriticalPath:P.includes(q.id),subtasks:q.subtasks?F(q.subtasks):void 0}));return F(ae)},[ae,d]),nr=hf(L);Bl({undo:Pt,redo:Ot,canUndo:zt,canRedo:U,enabled:true}),ve.useImperativeHandle(n,()=>({getTask:P=>Y.findTaskById(ae,P),addTask:(P,F)=>{ie(V=>{if(!F)return [...V,{...P,level:0}];let q=Z=>Z.map(oe=>oe.id===F?{...oe,subtasks:[...oe.subtasks||[],{...P,parentId:F,level:(oe.level||0)+1}],isExpanded:true}:oe.subtasks?{...oe,subtasks:q(oe.subtasks)}:oe);return q(V)});},updateTask:(P,F)=>{ie(V=>{let q=Z=>Z.map(oe=>oe.id===P?{...oe,...F}:oe.subtasks?{...oe,subtasks:q(oe.subtasks)}:oe);return q(V)});},deleteTask:P=>{ie(F=>{let V=q=>q.filter(Z=>Z.id===P?false:(Z.subtasks&&(Z.subtasks=V(Z.subtasks)),true));return V(F)});},deleteTasks:P=>{ie(F=>Ko(F,P));},duplicateTask:P=>{ie(F=>jo(F,[P]));},splitTask:(P,F,V=3)=>{ie(q=>Y.splitTask(q,P,F,V));},calculateEndDate:Y.calculateEndDate,calculateDuration:Y.calculateDuration,validateDependency:(P,F)=>!Y.validateDependencies(ae,P,F),getAllTasks:()=>Y.flattenTasks(ae),getTasksByStatus:P=>Y.flattenTasks(ae).filter(F=>F.status===P),getTasksByParent:P=>P?Y.findTaskById(ae,P)?.subtasks||[]:ae.filter(V=>!V.parentId),getCriticalPath:()=>Y.flattenTasks(ae).filter(P=>P.isCriticalPath),indentTask:P=>{ie(F=>$o(F,[P]));},outdentTask:P=>{ie(F=>Wo(F,[P]));},moveTask:(P,F)=>{ie(V=>Vo(V,[P],F));},createSubtask:async P=>{let{tasks:F,newTask:V}=Xo(ae,P);if(w){let q=w({...V,parentId:P});if((q instanceof Promise?await q:q)===false)return}ie(F),k&&k({...V,parentId:P});},scrollToTask:P=>{let V=Y.flattenTasks(ae).findIndex(q=>q.id===P);if(V!==-1&&ht.current){let q=V*nr;ht.current.scrollTo({top:q,behavior:"smooth"}),It.current&&It.current.scrollTo({top:q,behavior:"smooth"});}},highlightTask:(P,F=2e3)=>{},expandTask:P=>{ie(F=>{let V=q=>q.map(Z=>Z.id===P?{...Z,isExpanded:true}:Z.subtasks?{...Z,subtasks:V(Z.subtasks)}:Z);return V(F)});},collapseTask:P=>{ie(F=>{let V=q=>q.map(Z=>Z.id===P?{...Z,isExpanded:false}:Z.subtasks?{...Z,subtasks:V(Z.subtasks)}:Z);return V(F)});},expandAll:()=>{ie(P=>{let F=V=>V.map(q=>({...q,isExpanded:true,subtasks:q.subtasks?F(q.subtasks):void 0}));return F(P)});},collapseAll:()=>{ie(P=>{let F=V=>V.map(q=>({...q,isExpanded:false,subtasks:q.subtasks?F(q.subtasks):void 0}));return F(P)});},undo:Pt,redo:Ot,canUndo:()=>zt,canRedo:()=>U,clearHistory:z,exportToPNG:async()=>{if(!te.current)throw new Error("Gantt container not found");let P=await Vc__default.default(te.current,{backgroundColor:Fe.bgPrimary,scale:2});return new Promise((F,V)=>{P.toBlob(q=>{q?F(q):V(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async P=>{await Y.exportToPDF(ae,P);},exportToExcel:async P=>{await Y.exportToExcel(ae,P);},exportToJSON:()=>Y.exportToJSON(ae),exportToCSV:()=>Y.exportToCSV(ae),importFromJSON:P=>{let F=Y.importFromJSON(P);ie(F);},getTasks:()=>ae,refresh:()=>{ie(P=>[...P]);},clearAll:()=>{ie([]);}}),[ae,Pt,Ot,zt,U,z,Fe,nr]);let _r=ve.useCallback(P=>{ze(F=>F.map(V=>V.id===P?{...V,visible:!V.visible}:V));},[]),$r=ve.useCallback(P=>{ie(F=>Yo(F,P)),r.onTaskToggleExpand?.(P);},[r]),O=ve.useCallback((P,F)=>{if(b&&b(P,F)===false)return;let q=Y.findTaskById(ae,P)?.progress,Z=ut=>ut.map(_e=>_e.id===P?{..._e,...F}:_e.subtasks?{..._e,subtasks:Z(_e.subtasks)}:_e);ie(Z(ae));let oe=Y.findTaskById(Z(ae),P);oe&&(g?.(oe),C?.(oe),F.progress!==void 0&&q!==void 0&&F.progress!==q&&h?.(P,q,F.progress));},[ae,g,b,C,h]),ge=ve.useCallback(P=>{P.length!==0&&(ie(F=>$o(F,P)),r.onTaskIndent?.(P[0]));},[r]),de=ve.useCallback(P=>{P.length!==0&&(ie(F=>Wo(F,P)),r.onTaskOutdent?.(P[0]));},[r]),N=ve.useCallback((P,F)=>{P.length!==0&&(ie(V=>Vo(V,P,F)),r.onTaskMove?.(P[0],F));},[r]),_=ve.useCallback(P=>{r.onMultiTaskDelete?r.onMultiTaskDelete(P):(ie(F=>Ko(F,P)),P.forEach(F=>r.onTaskDelete?.(F)));},[r]),ue=ve.useCallback(P=>{ie(F=>jo(F,P)),P.forEach(F=>r.onTaskDuplicate?.(F));},[r]),we=ve.useCallback((P,F)=>{ie(V=>{let{tasks:q,newTask:Z}=hl(V,P,F);return w&&w(Z)===false?V:(r.onTaskCreate?.(Z.parentId,Z.position||0),k?.(Z),q)});},[r,w,k]),Se=ve.useCallback((P,F)=>{ie(V=>qo(V,P,F)),r.onTaskRename?.(P,F);},[r]),Nt=ve.useCallback(P=>{ie(F=>{let{tasks:V}=Xo(F,P);return r.onTaskCreate?.(P,0),V});},[r]),Mt=ve.useCallback((P,F,V)=>{let q=ut=>ut.map(_e=>_e.id===P.id?{..._e,startDate:F,endDate:V,...P.segments&&{segments:P.segments}}:_e.subtasks?{..._e,subtasks:q(_e.subtasks)}:_e),Z=q(ae);Z=Y.autoScheduleDependents(Z,P.id),ie(Z);let oe={...P,startDate:F,endDate:V};g?.(oe);},[ae,g]),Gn=ve.useCallback((P,F)=>{x?.(P,F),Le({isOpen:true,x:F.clientX,y:F.clientY,task:P});},[x]),la=ve.useCallback((P,F)=>{let V=Y.splitTask(ae,P.id,F);ie(V),Le({isOpen:false,x:0,y:0,task:null});},[ae]),Wr=ve.useCallback(P=>{y?.(P),Rt(P);},[y]),Ps=ve.useCallback((P,F,V)=>{let q=new Map,Z=Cr=>{Cr.forEach(Tr=>{Tr.dependencies&&q.set(Tr.id,Tr.dependencies),Tr.subtasks&&Z(Tr.subtasks);});};Z(V);let oe=q.get(F)||[];q.set(F,[...oe,P]);let ut=new Set,_e=new Set,Vr=Cr=>{if(!ut.has(Cr)){ut.add(Cr),_e.add(Cr);let Tr=q.get(Cr)||[];for(let Un of Tr){if(!ut.has(Un)&&Vr(Un))return true;if(_e.has(Un))return true}}return _e.delete(Cr),false};return Vr(F)},[]),Ac=ve.useCallback((P,F)=>{if(Ps(P.id,F,ae)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
47
47
|
|
|
48
48
|
Task dependencies must flow in one direction only.`);return}let V=q=>q.map(Z=>{if(Z.id===F){let oe=Z.dependencies||[];if(!oe.includes(P.id))return {...Z,dependencies:[...oe,P.id]}}return Z.subtasks?{...Z,subtasks:V(Z.subtasks)}:Z});ie(V(ae)),v?.(P.id,F);},[ae,v,Ps]),Lc=ve.useCallback((P,F)=>{let V=q=>q.map(Z=>{if(Z.id===P&&Z.dependencies){let oe=Z.dependencies.filter(ut=>ut!==F);return {...Z,dependencies:oe}}return Z.subtasks?{...Z,subtasks:V(Z.subtasks)}:Z});ie(V(ae)),m?.(P,F);},[ae,m]),{startDate:Fc,endDate:Bc}=ve.useMemo(()=>{let P=ae.filter(oe=>oe.startDate&&oe.endDate);if(P.length===0){let oe=new Date,ut=new Date(oe);ut.setDate(ut.getDate()-30);let _e=new Date(oe);return _e.setDate(_e.getDate()+60),{startDate:ut,endDate:_e}}let F=P.flatMap(oe=>[oe.startDate,oe.endDate]).filter(oe=>oe!==void 0),V=new Date(Math.min(...F.map(oe=>oe.getTime()))),q=new Date(Math.max(...F.map(oe=>oe.getTime()))),Z=I==="day"?7:I==="week"?14:30;return V.setDate(V.getDate()-Z),q.setDate(q.getDate()+Z),{startDate:V,endDate:q}},[ae,I]),Oc=P=>{P.preventDefault(),re(true);};return ve.useEffect(()=>{let P=ht.current,F=It.current;if(!P||!F)return;let V=r.disableScrollSync||false,q=()=>{if(V){ne(P.scrollTop);return}F.scrollTop!==P.scrollTop&&(F.scrollTop=P.scrollTop),ne(P.scrollTop);},Z=()=>{if(V){ne(F.scrollTop);return}P.scrollTop!==F.scrollTop&&(P.scrollTop=F.scrollTop),ne(F.scrollTop);},oe=_e=>{if(De){let Vr=_e.clientX;Vr>300&&Vr<window.innerWidth-400&&B(Vr);}},ut=()=>{re(false);};return P.addEventListener("scroll",q),F.addEventListener("scroll",Z),document.addEventListener("mousemove",oe),document.addEventListener("mouseup",ut),()=>{P.removeEventListener("scroll",q),F.removeEventListener("scroll",Z),document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ut);}},[De,r.disableScrollSync]),jsxRuntime.jsx(oo.Provider,{value:Gt,children:jsxRuntime.jsxs("div",{ref:te,className:"flex flex-col h-full w-full",style:{backgroundColor:Fe.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsxRuntime.jsx(xn,{theme:Fe,timeScale:I,onTimeScaleChange:R,zoom:G,onZoomChange:J,currentTheme:S,onThemeChange:ke,rowDensity:L,onRowDensityChange:H,showThemeSelector:c}),jsxRuntime.jsxs("div",{className:"flex-1 flex min-h-0",children:[jsxRuntime.jsx("div",{ref:ht,className:"gantt-grid-scroll overflow-y-auto overflow-x-hidden",style:{width:Ht,minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(wn,{tasks:me,theme:Fe,rowHeight:nr,availableUsers:i,templates:he,onTaskClick:p,onTaskDblClick:Wr,onTaskContextMenu:x,onTaskToggle:$r,scrollTop:X,columns:Me,onToggleColumn:_r,onTaskUpdate:O,onTaskIndent:ge,onTaskOutdent:de,onTaskMove:N,onMultiTaskDelete:_,onTaskDuplicate:ue,onTaskCreate:we,onTaskRename:Se,onCreateSubtask:Nt,onOpenTaskModal:p?P=>p(P):void 0})}),jsxRuntime.jsx("div",{className:"relative flex-shrink-0 cursor-col-resize group",style:{width:8,backgroundColor:De?Fe.accent:Fe.border,transition:"background-color 0.2s"},onMouseDown:Oc,children:jsxRuntime.jsx(framerMotion.motion.div,{className:"absolute inset-y-0 left-1/2 -translate-x-1/2",style:{width:2,backgroundColor:Fe.accent},initial:{opacity:0},animate:{opacity:De?1:0},whileHover:{opacity:1}})}),jsxRuntime.jsx("div",{ref:It,className:"gantt-timeline-scroll flex-1 overflow-auto",style:{minHeight:0,...r.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsxRuntime.jsx(Rn,{tasks:me,theme:Fe,rowHeight:nr,timeScale:I,startDate:Fc,endDate:Bc,zoom:G,templates:he,onTaskClick:p,onTaskDblClick:Wr,onTaskContextMenu:Gn,onTaskDateChange:Mt,onDependencyCreate:Ac,onDependencyDelete:Lc})})]}),j.task&&jsxRuntime.jsx(aa,{isOpen:j.isOpen,x:j.x,y:j.y,theme:Fe,onClose:()=>Le({isOpen:false,x:0,y:0,task:null}),items:[{id:"split",label:"Split Task",icon:St.Split,onClick:()=>{if(!j.task?.startDate||!j.task?.endDate){console.warn("Cannot split task without dates");return}let P=j.task.startDate.getTime(),F=j.task.endDate.getTime(),V=P+(F-P)/2,q=new Date(V);la(j.task,q);},disabled:!j.task?.startDate||!j.task?.endDate}]}),et&&jsxRuntime.jsx(Pn,{isOpen:true,onClose:()=>Rt(null),task:et,onSubmit:P=>{O(et.id,P),Rt(null);},mode:"edit",theme:S})]})})});function vf(e){if(e)switch(e.toUpperCase()){case "TODO":case "BLOCKED":return "todo";case "IN_PROGRESS":case "REVIEW":return "in-progress";case "DONE":return "completed";default:return "todo"}}function bf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return "TODO"}}function Mn(e,t=[],r=[]){let a=e.assignedUserIds?.map(u=>{let d=r.find(f=>f.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Mn(u,t,r)),o;e.dependencies&&(typeof e.dependencies[0]=="string"?o=e.dependencies:o=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let s=u=>{if(u)return typeof u=="string"?new Date(u):u},l=s(e.startDate),c=s(e.endDate),i=e.metadata?.isMilestone===true||l&&c&&Math.abs(c.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:c,progress:e.progress||0,status:vf(e.metadata?.status),assignees:a?.length?a:void 0,dependencies:o?.length?o:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function Gl(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(o=>o.name===a.name||o.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:bf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Ul(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>Mn(a,e,t))}function xf({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:o,onDeleteStack:s,className:l}){let[c,i]=ve.useState(false),u=ve.useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),d=ve.useMemo(()=>{let p=u.length,y=new Set(u.flatMap(h=>h.assignedUserIds||[])).size,x=u.map(h=>h.priority).filter(Boolean),g=new Set(u.flatMap(h=>h.labels||[])).size;return {totalCards:p,uniqueAssignees:y,priorities:x,labels:g}},[u]),f=()=>{n?.(e.id);};return jsxRuntime.jsxs("div",{className:ee("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxRuntime.jsxs("div",{className:"card-stack-header",onClick:f,children:[jsxRuntime.jsxs("div",{className:"card-stack-header-left",children:[jsxRuntime.jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:ee("card-stack-chevron",e.isExpanded&&"expanded"),children:jsxRuntime.jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsxRuntime.jsx("h3",{className:"card-stack-title",children:e.title}),jsxRuntime.jsx("div",{className:"card-stack-badge",children:d.totalCards}),jsxRuntime.jsxs("div",{className:"card-stack-strategy",children:[e.strategy==="ai-similarity"&&"\u2728 AI",e.strategy==="manual"&&"\u{1F464} Manual",e.strategy==="labels"&&"\u{1F3F7}\uFE0F Labels",e.strategy==="assignee"&&"\u{1F465} Assignee",e.strategy==="priority"&&"\u{1F3AF} Priority",e.strategy==="epic"&&"\u{1F4DA} Epic"]})]}),c&&jsxRuntime.jsx("div",{className:"card-stack-actions",children:jsxRuntime.jsx("button",{className:"card-stack-action",onClick:p=>{p.stopPropagation(),s?.(e.id);},"aria-label":"Delete stack",children:jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polyline",{points:"3 6 5 6 21 6"}),jsxRuntime.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})})]}),!e.isExpanded&&jsxRuntime.jsxs("div",{className:"card-stack-summary",children:[jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsxRuntime.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxRuntime.jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxRuntime.jsxs("div",{className:"card-stack-summary-item",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"}),jsxRuntime.jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxRuntime.jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsxRuntime.jsx("div",{className:"card-stack-summary-item",children:jsxRuntime.jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsxRuntime.jsx("div",{className:"card-stack-content",children:u.length===0?jsxRuntime.jsxs("div",{className:"card-stack-empty",children:[jsxRuntime.jsx("p",{children:"No cards in this stack"}),jsxRuntime.jsx("span",{children:"Drag cards here or delete this stack"})]}):jsxRuntime.jsx("div",{className:"card-stack-cards",children:u.map(p=>jsxRuntime.jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsxRuntime.jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxRuntime.jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsxRuntime.jsx("h4",{children:p.title}),p.description&&jsxRuntime.jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsxRuntime.jsx("button",{className:"card-stack-unstack-btn",onClick:y=>{y.stopPropagation(),o?.(e.id,p.id);},"aria-label":"Remove from stack",children:jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},p.id))})})]})}var $l={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function La(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function Fa(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function Wl(e){return {created:"#10b981",status_changed:"#3b82f6",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#06b6d4",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#14b8a6",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function Vl({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:o,config:s,className:l}){let c=ve.useMemo(()=>({...$l,...s}),[s]),[i,u]=ve.useState(new Set),d=ve.useRef(null),f=ve.useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let v=new Map;return e.forEach(m=>{let w=m.timestamp.toISOString().split("T")[0],k=v.get(w);k?k.push(m):v.set(w,[m]);}),Array.from(v.entries()).sort((m,w)=>w[0].localeCompare(m[0])).map(([m,w])=>({date:new Date(m),events:w.sort((k,b)=>b.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:p,uniqueTypes:y}=ve.useMemo(()=>{let v=new Set,m=new Set;return e.forEach(w=>{v.add(w.userId),m.add(w.type);}),{uniqueUsers:Array.from(v),uniqueTypes:Array.from(m)}},[e]),x=v=>{u(m=>{let w=new Set(m);return w.has(v)?w.delete(v):w.add(v),w});},g=v=>{let w=new Date().getTime()-v.getTime(),k=Math.floor(w/6e4),b=Math.floor(w/36e5),C=Math.floor(w/864e5);return k<1?"just now":k<60?`${k}m ago`:b<24?`${b}h ago`:C<7?`${C}d ago`:v.toLocaleDateString()},h=ve.useMemo(()=>{let v=0;return t.types&&t.types.length>0&&v++,t.users&&t.users.length>0&&v++,t.dateRange&&v++,t.searchTerm&&v++,v},[t]);return ve.useEffect(()=>{if(o&&d.current){let v=d.current.querySelector(`[data-event-id="${o}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"center"});}},[o]),e.length===0?jsxRuntime.jsxs("div",{className:ee("history-timeline-empty",l),children:[jsxRuntime.jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsxRuntime.jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxRuntime.jsxs("div",{className:ee("history-timeline",c.compact&&"compact",l),children:[jsxRuntime.jsxs("div",{className:"history-timeline-filters",children:[jsxRuntime.jsxs("div",{className:"history-timeline-filter-group",children:[jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:v=>{let m=v.target.value;r({...t,types:m?[m]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Events"}),y.map(v=>jsxRuntime.jsxs("option",{value:v,children:[Fa(v)," ",v.replace("_"," ")]},v))]}),p.length>1&&jsxRuntime.jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:v=>{let m=v.target.value;r({...t,users:m?[m]:void 0});},children:[jsxRuntime.jsx("option",{value:"",children:"All Users"}),p.map(v=>jsxRuntime.jsx("option",{value:v,children:v},v))]}),jsxRuntime.jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:v=>r({...t,searchTerm:v.target.value})})]}),h>0&&jsxRuntime.jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",h,")"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-container",ref:d,children:f.map(v=>jsxRuntime.jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&v.date&&jsxRuntime.jsxs("div",{className:"history-timeline-day-header",children:[jsxRuntime.jsx("span",{className:"history-timeline-day-date",children:v.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxRuntime.jsxs("span",{className:"history-timeline-day-count",children:[v.events.length," events"]})]}),jsxRuntime.jsx("div",{className:"history-timeline-events",children:v.events.map((m,w)=>{let k=i.has(m.id),b=o===m.id,C=Wl(m.type);return jsxRuntime.jsxs("div",{"data-event-id":m.id,className:ee("history-timeline-event",k&&"expanded",b&&"selected"),onClick:()=>n?.(m),children:[jsxRuntime.jsxs("div",{className:"history-timeline-line",children:[jsxRuntime.jsx("div",{className:"history-timeline-dot",style:{backgroundColor:C},children:c.showIcons&&jsxRuntime.jsx("span",{className:"history-timeline-dot-icon",children:Fa(m.type)})}),w<v.events.length-1&&jsxRuntime.jsx("div",{className:"history-timeline-connector",style:{borderColor:C}})]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-content",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header",children:[jsxRuntime.jsxs("div",{className:"history-timeline-event-header-left",children:[c.showAvatars&&m.userAvatar&&jsxRuntime.jsx("img",{src:m.userAvatar,alt:m.userName||m.userId,className:"history-timeline-event-avatar"}),jsxRuntime.jsxs("div",{className:"history-timeline-event-description",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-user",children:m.userName||m.userId}),jsxRuntime.jsx("span",{className:"history-timeline-event-action",children:La(m)})]})]}),jsxRuntime.jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?g(m.timestamp):m.timestamp.toLocaleString()})]}),Object.keys(m.changes).length>0&&jsxRuntime.jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),x(m.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxRuntime.jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(m.changes).map(([T,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-change",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxRuntime.jsxs("div",{className:"history-timeline-event-change-values",children:[jsxRuntime.jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsxRuntime.jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},T)),m.metadata&&Object.keys(m.metadata).length>0&&jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata",children:[jsxRuntime.jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(m.metadata).map(([T,D])=>jsxRuntime.jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxRuntime.jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsxRuntime.jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},T))]})]})]})]},m.id)})})]},v.date?.toISOString()||"all"))})]})}function jl({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:o,onNext:s,onGoToEvent:l,onSpeedChange:c,className:i}){let u=[.5,1,1.5,2,3],d=ve.useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),f=ve.useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxRuntime.jsxs("div",{className:ee("history-replay-empty",i),children:[jsxRuntime.jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsxRuntime.jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxRuntime.jsxs("div",{className:ee("history-replay",i),children:[jsxRuntime.jsxs("div",{className:"history-replay-current-event",children:[jsxRuntime.jsx("div",{className:"history-replay-event-icon",children:d&&Fa(d.type)}),jsxRuntime.jsxs("div",{className:"history-replay-event-info",children:[jsxRuntime.jsx("div",{className:"history-replay-event-description",children:d&&La(d)}),jsxRuntime.jsxs("div",{className:"history-replay-event-meta",children:[jsxRuntime.jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsxRuntime.jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxRuntime.jsxs("div",{className:"history-replay-progress-container",children:[jsxRuntime.jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:p=>l(parseInt(p.target.value))}),jsxRuntime.jsx("div",{className:"history-replay-progress-fill",style:{width:`${f}%`}}),jsxRuntime.jsx("div",{className:"history-replay-progress-markers",children:t.map((p,y)=>jsxRuntime.jsx("div",{className:ee("history-replay-progress-marker",y===e.currentIndex&&"active"),style:{left:`${y/(e.totalEvents-1)*100}%`},onClick:()=>l(y),title:La(p)},p.id))})]}),jsxRuntime.jsxs("div",{className:"history-replay-controls",children:[jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsxRuntime.jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsxRuntime.jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsxRuntime.jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsxRuntime.jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsxRuntime.jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsxRuntime.jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxRuntime.jsxs("div",{className:"history-replay-speed",children:[jsxRuntime.jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsxRuntime.jsx("div",{className:"history-replay-speed-buttons",children:u.map(p=>jsxRuntime.jsxs("button",{className:ee("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>c(p),children:[p,"x"]},p))})]}),jsxRuntime.jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,title:"Stop replay (Esc)",children:jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsxRuntime.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxRuntime.jsxs("div",{className:"history-replay-shortcuts",children:[jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2190"})," Previous"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"\u2192"})," Next"]}),jsxRuntime.jsxs("span",{className:"history-replay-shortcut",children:[jsxRuntime.jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-header",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-content",children:[jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsxRuntime.jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxRuntime.jsxs("div",{className:"history-replay-card-preview-field",children:[jsxRuntime.jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsxRuntime.jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(p=>jsxRuntime.jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxRuntime.jsxs("div",{className:ee("history-replay-start",i),children:[jsxRuntime.jsxs("button",{className:"history-replay-start-button",onClick:r,children:[jsxRuntime.jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsxRuntime.jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsxRuntime.jsx("span",{children:"Start Time Travel"})]}),jsxRuntime.jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function as(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#3b82f6",child_of:"#2563eb",similar_to:"#10b981"}[e]||"#6b7280"}function ns(e){return {blocks:"Blocks",blocked_by:"Blocked by",depends_on:"Depends on",required_by:"Required by",relates_to:"Relates to",duplicates:"Duplicates",parent_of:"Parent of",child_of:"Child of",similar_to:"Similar to"}[e]||e}function ql(e){return {blocks:"\u{1F6AB}",blocked_by:"\u26D4",depends_on:"\u{1F517}",required_by:"\u{1F4CC}",relates_to:"\u{1F504}",duplicates:"\u{1F4CB}",parent_of:"\u{1F4C2}",child_of:"\u{1F4C4}",similar_to:"\u{1F50D}"}[e]||"\u{1F517}"}function Yl(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Nf(e,t,r,a,n,o=100){let s=e.map(c=>({...c,x:c.x??r/2+Math.random()*100-50,y:c.y??a/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(s.map(c=>[c.id,c]));for(let c=0;c<o;c++){let i=1-c/o;s.forEach(u=>{let d=r/2,f=a/2;u.vx+=(d-u.x)*n.centerForce*i,u.vy+=(f-u.y)*n.centerForce*i,s.forEach(p=>{if(u.id===p.id)return;let y=u.x-p.x,x=u.y-p.y,g=Math.sqrt(y*y+x*x)||1,h=n.chargeStrength*i/(g*g);u.vx+=y/g*h,u.vy+=x/g*h;});}),t.forEach(u=>{let d=l.get(typeof u.source=="string"?u.source:u.source.id),f=l.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!f)return;let p=f.x-d.x,y=f.y-d.y,x=Math.sqrt(p*p+y*y)||1,g=(x-n.linkDistance)/x*n.forceStrength*i;d.vx+=p*g,d.vy+=y*g,f.vx-=p*g,f.vy-=y*g;}),s.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return s}function Xl({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:o,stats:s,onInteraction:l,className:c}){let i=ve.useRef(null),[u,d]=ve.useState([]),[f,p]=ve.useState(null),[y,x]=ve.useState(null),[g,h]=ve.useState(null),[v,m]=ve.useState(1),[w,k]=ve.useState({x:0,y:0});ve.useEffect(()=>{if(e.length===0)return;let R=Nf(e,t,r.width,r.height,r,150);d(R);},[e,t,r]);let b=ve.useCallback((R,L)=>{r.enableDragging&&(L.stopPropagation(),p(R));},[r.enableDragging]),C=ve.useCallback(R=>{if(!f||!i.current)return;let H=i.current.getBoundingClientRect(),G=(R.clientX-H.left-w.x)/v,J=(R.clientY-H.top-w.y)/v;d(X=>X.map(ne=>ne.id===f?{...ne,x:G,y:J,fx:G,fy:J}:ne));},[f,v,w]),T=ve.useCallback(()=>{p(null);},[]),D=ve.useCallback((R,L)=>{L.stopPropagation(),l?.({type:"node-click",node:R,position:{x:L.clientX,y:L.clientY}});},[l]),S=ve.useCallback((R,L)=>{L.stopPropagation(),l?.({type:"edge-click",edge:R,position:{x:L.clientX,y:L.clientY}});},[l]),E=ve.useCallback(R=>{let L=u.find(H=>H.id===R);return L?{x:L.x,y:L.y}:{x:0,y:0}},[u]),I=ve.useCallback(R=>{if(R.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return R.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let L=R.card.priority;return L==="URGENT"?"#ef4444":L==="HIGH"?"#f59e0b":L==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return R.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[r.colorScheme]);return e.length===0?jsxRuntime.jsxs("div",{className:ee("relationships-graph-empty",c),children:[jsxRuntime.jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsxRuntime.jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxRuntime.jsxs("div",{className:ee("relationships-graph",c),children:[jsxRuntime.jsxs("div",{className:"relationships-graph-controls",children:[jsxRuntime.jsxs("div",{className:"relationships-graph-stats",children:[jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.totalNodes}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxRuntime.jsxs("span",{className:"relationships-graph-stat",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:s.totalEdges}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),o&&jsxRuntime.jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsxRuntime.jsx("span",{className:"relationships-graph-stat-value",children:o.cardIds.length}),jsxRuntime.jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),r.enableZoom&&jsxRuntime.jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>m(R=>Math.min(R+.2,3)),children:"+"}),jsxRuntime.jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(v*100),"%"]}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>m(R=>Math.max(R-.2,.5)),children:"\u2212"}),jsxRuntime.jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{m(1),k({x:0,y:0});},children:"Reset"})]})]}),jsxRuntime.jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(R=>R.type))).map(R=>jsxRuntime.jsxs("div",{className:"relationships-graph-legend-item",children:[jsxRuntime.jsx("div",{className:"relationships-graph-legend-color",style:{background:as(R)}}),jsxRuntime.jsxs("span",{className:"relationships-graph-legend-label",children:[ql(R)," ",ns(R)]})]},R))}),jsxRuntime.jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:C,onMouseUp:T,onMouseLeave:T,children:[jsxRuntime.jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${v})`,children:[jsxRuntime.jsx("g",{className:"relationships-graph-edges",children:t.map(R=>{let L=E(typeof R.source=="string"?R.source:R.source.id),H=E(typeof R.target=="string"?R.target:R.target.id),G=Yl(R.type),J=g===R.id,X=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:ee("relationships-graph-edge",J&&"hovered",X&&"critical"),onMouseEnter:()=>h(R.id),onMouseLeave:()=>h(null),onClick:ne=>S(R,ne),children:[jsxRuntime.jsx("line",{x1:L.x,y1:L.y,x2:H.x,y2:H.y,stroke:as(R.type),strokeWidth:X?r.edgeWidth*2:r.edgeWidth,strokeOpacity:J?1:.6,markerEnd:G?"url(#arrowhead)":void 0}),r.showEdgeLabels&&J&&jsxRuntime.jsx("text",{x:(L.x+H.x)/2,y:(L.y+H.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ns(R.type)})]},R.id)})}),jsxRuntime.jsx("g",{className:"relationships-graph-nodes",children:u.map(R=>{let L=y===R.id,H=R.onCriticalPath;return jsxRuntime.jsxs("g",{className:ee("relationships-graph-node",L&&"hovered",H&&"critical"),transform:`translate(${R.x}, ${R.y})`,onMouseDown:G=>b(R.id,G),onMouseEnter:()=>x(R.id),onMouseLeave:()=>x(null),onClick:G=>D(R,G),children:[jsxRuntime.jsx("circle",{r:H?r.nodeSize*1.2:r.nodeSize,fill:I(R),stroke:H?"#fbbf24":"#ffffff",strokeWidth:H?3:2,opacity:L?1:.9}),r.showLabels&&jsxRuntime.jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:R.card.title.length>20?R.card.title.substring(0,20)+"...":R.card.title})]},R.id)})})]}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntime.jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function Ql({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[o,s]=ve.useState(""),[l,c]=ve.useState(false),[i,u]=ve.useState(null),[d,f]=ve.useState(null),p=ve.useRef(null),y=l||n;ve.useEffect(()=>{e&&p.current&&p.current.focus();},[e]),ve.useEffect(()=>{let v=m=>{m.key==="Escape"&&!y&&x();};if(e)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,y]);let x=()=>{y||(s(""),u(null),f(null),t());},g=async()=>{if(!(!o.trim()||y)){c(true),u(null),f(null);try{let v=await a(o.trim());f(v);}catch(v){u(v instanceof Error?v.message:"Failed to generate plan");}finally{c(false);}}},h=()=>{d&&(r(d),x());};return e?jsxRuntime.jsxs(Xe,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:v=>v.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsxRuntime.jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsxRuntime.jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((v,m)=>jsxRuntime.jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:v.title},m))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxRuntime.jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((v,m)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:v.title}),v.description&&jsxRuntime.jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:v.description})]}),v.priority&&jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${v.priority==="URGENT"?"bg-red-500/20 text-red-400":v.priority==="HIGH"?"bg-orange-500/20 text-orange-400":v.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:v.priority})]})},m)),d.cards.length>10&&jsxRuntime.jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsxRuntime.jsx("textarea",{ref:p,value:o,onChange:v=>s(v.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:y}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),i&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((v,m)=>jsxRuntime.jsx("button",{onClick:()=>s(v),disabled:y,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:v},m))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:y&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:x,disabled:y,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),d?jsxRuntime.jsx("button",{onClick:h,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsxRuntime.jsx("button",{onClick:g,disabled:!o.trim()||y,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:y?"Generating...":"Generate Plan"})]})]})]})})]}):null}var os={"gpt-4-turbo":{provider:"openai",name:"GPT-4 Turbo",contextWindow:128e3,costPer1kInput:.01,costPer1kOutput:.03,supportsVision:true,supportsJSON:true},"gpt-4":{provider:"openai",name:"GPT-4",contextWindow:8192,costPer1kInput:.03,costPer1kOutput:.06,supportsVision:false,supportsJSON:true},"gpt-3.5-turbo":{provider:"openai",name:"GPT-3.5 Turbo",contextWindow:16385,costPer1kInput:5e-4,costPer1kOutput:.0015,supportsVision:false,supportsJSON:true},"claude-3-5-sonnet-20241022":{provider:"anthropic",name:"Claude 3.5 Sonnet",contextWindow:2e5,costPer1kInput:.003,costPer1kOutput:.015,supportsVision:true,supportsJSON:true},"claude-3-opus-20240229":{provider:"anthropic",name:"Claude 3 Opus",contextWindow:2e5,costPer1kInput:.015,costPer1kOutput:.075,supportsVision:true,supportsJSON:true},"claude-3-haiku-20240307":{provider:"anthropic",name:"Claude 3 Haiku",contextWindow:2e5,costPer1kInput:25e-5,costPer1kOutput:.00125,supportsVision:true,supportsJSON:true}};var Ef={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Rf={generatePlan:{enabled:true,minPlanTier:"hobby",estimatedTokens:2e3},predictRisks:{enabled:true,minPlanTier:"pro",estimatedTokens:1500},suggestAssignee:{enabled:true,minPlanTier:"hobby",estimatedTokens:800},generateReport:{enabled:true,minPlanTier:"enterprise",estimatedTokens:3e3},generateSubtasks:{enabled:true,minPlanTier:"hobby",estimatedTokens:1e3}};function Pf(e,t,r){let a=os[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,o=r/1e3*a.costPer1kOutput;return n+o}function Ba(e){return `$${e.toFixed(4)}`}var ss=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=Pf(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let a=r.length,n=r.reduce((d,f)=>d+f.cost,0),o=r.reduce((d,f)=>d+f.inputTokens,0),s=r.reduce((d,f)=>d+f.outputTokens,0),l=r.filter(d=>d.success),c=r.reduce((d,f)=>d+f.duration,0),i={},u={};return r.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:o,totalOutputTokens:s,operationsByFeature:i,costsByFeature:u,averageDuration:a>0?c/a:0,successRate:a>0?l.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],o=new Date,s=new Date;r==="month"?s.setMonth(o.getMonth()-1):s.setDate(o.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=s).length,c=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:c,percentUsed:i,isExceeded:l>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},zr=new ss;function rc({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=ve.useState(zr.getStats()),[o,s]=ve.useState(zr.checkLimit(r));if(ve.useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(zr.getStats()),s(zr.checkLimit(r));},1e3);return ()=>clearInterval(c)},[e,r]),ve.useEffect(()=>{let c=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let l=zr.getRecentOperations(5);return jsxRuntime.jsxs(Xe,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:c=>c.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsxRuntime.jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-blue-500/10 to-purple-500/10 border border-blue-500/30",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",r.toUpperCase(),")"]}),jsxRuntime.jsxs("span",{className:"text-sm font-bold text-white",children:[o.used," / ",o.limit]})]}),jsxRuntime.jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,o.percentUsed)}%`,background:o.percentUsed>90?"#EF4444":o.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxRuntime.jsxs("p",{className:"text-xs text-white/60 mt-2",children:[o.remaining," operations remaining this month"]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ba(a.totalCost)})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:a.totalOperations})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.totalOutputTokens.toLocaleString()," out"]})]}),jsxRuntime.jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxRuntime.jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(a.successRate*100).toFixed(1),"%"]}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.averageDuration.toFixed(0),"ms"]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsxRuntime.jsx("div",{className:"space-y-2",children:Object.entries(a.operationsByFeature).map(([c,i])=>{let u=a.costsByFeature[c]||0,d=a.totalOperations>0?i/a.totalOperations*100:0;return jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ba(u)})]})]}),jsxRuntime.jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsxRuntime.jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},c)})})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.length===0?jsxRuntime.jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsxRuntime.jsx("div",{className:"space-y-2",children:l.map(c=>jsxRuntime.jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxRuntime.jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsxRuntime.jsx("span",{className:"text-xs font-semibold text-green-400",children:Ba(c.cost)}),jsxRuntime.jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.id))})]})]}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),jsxRuntime.jsx("button",{onClick:t,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80",children:"Close"})]})]})})]})}function oc({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:o}){let[s,l]=ve.useState(""),[c,i]=ve.useState(""),[u,d]=ve.useState(""),[f,p]=ve.useState(false),[y,x]=ve.useState(null),[g,h]=ve.useState(null),[v,m]=ve.useState(null),w=ve.useRef(null),k=f||n;ve.useEffect(()=>{e&&w.current&&w.current.focus();},[e]),ve.useEffect(()=>{let S=E=>{E.key==="Escape"&&!k&&b();};if(e)return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[e,k]);let b=()=>{k||(l(""),i(""),d(""),x(null),h(null),m(null),t());},C=async()=>{if(!(!s.trim()||k)){p(true),x(null),h(null),m(null);try{let S=await a({prompt:s.trim(),projectName:o||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});h(S.tasks.tasks),m({from_cache:S.from_cache,tokens_used:S.tokens_used,mock_mode:S.mock_mode,similarity:S.similarity,tokens_saved:S.tokens_saved});}catch(S){x(S instanceof Error?S.message:"Failed to generate tasks");}finally{p(false);}}},T=()=>{g&&(r(g),b());};if(!e)return null;let D=v?.similarity?((v.similarity||0)*100).toFixed(0):"0";return jsxRuntime.jsxs(Xe,{children:[jsxRuntime.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:b}),jsxRuntime.jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxRuntime.jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:S=>S.stopPropagation(),children:[jsxRuntime.jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-blue-400",children:[jsxRuntime.jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsxRuntime.jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsxRuntime.jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsxRuntime.jsx("button",{onClick:b,disabled:k,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsxRuntime.jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxRuntime.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:g?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs("div",{className:"space-y-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsxRuntime.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsxRuntime.jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsxRuntime.jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-2",children:[v?.mock_mode&&jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),v?.from_cache?jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-blue-500/20 text-blue-400 border border-blue-500/30",children:["From Cache (",D,"% similar)"]}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[v?.tokens_used||0," tokens"]}),v?.tokens_saved&&jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[v.tokens_saved," tokens saved"]}),jsxRuntime.jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[g.length," tasks"]})]}),jsxRuntime.jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((S,E)=>jsxRuntime.jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxRuntime.jsxs("span",{className:"text-xs text-white/50",children:["#",E+1]}),jsxRuntime.jsx("p",{className:"text-sm font-medium text-white/90",children:S.name})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxRuntime.jsxs("span",{className:"flex items-center gap-1",children:[jsxRuntime.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsxRuntime.jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsxRuntime.jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),S.start," \u2192 ",S.end]}),jsxRuntime.jsxs("span",{children:[S.duration," days"]}),S.dependencies.length>0&&jsxRuntime.jsxs("span",{className:"text-blue-400",children:["Depends: ",S.dependencies.join(", ")]})]})]}),jsxRuntime.jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${S.priority==="high"?"bg-red-500/20 text-red-400":S.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:S.priority})]})},S.id))})]})}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsxRuntime.jsx("textarea",{ref:w,value:s,onChange:S=>l(S.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-blue-500/50 transition-all resize-none",disabled:k}),jsxRuntime.jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:c,onChange:S=>i(S.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsxRuntime.jsx("input",{type:"date",value:u,onChange:S=>d(S.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-blue-500/50 transition-all",disabled:k})]})]}),y&&jsxRuntime.jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:y}),jsxRuntime.jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsxRuntime.jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsxRuntime.jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((S,E)=>jsxRuntime.jsx("button",{onClick:()=>l(S),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:S},E))})]})]})}),jsxRuntime.jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsxRuntime.jsx("div",{children:k&&jsxRuntime.jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsxRuntime.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),jsxRuntime.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),jsxRuntime.jsx("span",{children:"Generating with AI..."})]})}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx("button",{onClick:b,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsxRuntime.jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsxRuntime.jsx("button",{onClick:C,disabled:!s.trim()||k,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#ffffff"},children:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Fn({initialBoard:e,onPersist:t}){let[r,a]=ve.useState(e),n=ve.useCallback(g=>{t&&Wa(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,v,m)=>{console.warn(`Retry attempt ${v} after ${m}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),o=ve.useCallback(async(g,h,v)=>{a(m=>{let w=m.cards.find(S=>S.id===g);if(!w)return m;let k=w.columnId,b={...w,columnId:h,position:v},C=m.cards.map(S=>S.id===g?b:S),T=m.columns.map(S=>{if(S.id===k)return {...S,cardIds:S.cardIds.filter(E=>E!==g)};if(S.id===h){let E=C.filter(I=>I.columnId===h).sort((I,R)=>I.position-R.position);return {...S,cardIds:E.map(I=>I.id)}}return S}),D={...m,cards:C,columns:T};return n(D),D});},[n]),s=ve.useCallback(async(g,h)=>{a(v=>{let m=v.cards.map(k=>k.id===g?{...k,...h}:k),w={...v,cards:m};return n(w),w});},[n]),l=ve.useCallback(async g=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(v=>{let m={...g,id:h},w=v.columns.map(b=>b.id===g.columnId?{...b,cardIds:[...b.cardIds,h]}:b),k={...v,cards:[...v.cards,m],columns:w};return n(k),k});},[n]),c=ve.useCallback(async g=>{a(h=>{let v=h.cards.find(b=>b.id===g);if(!v)return h;let m=h.cards.filter(b=>b.id!==g),w=h.columns.map(b=>b.id===v.columnId?{...b,cardIds:b.cardIds.filter(C=>C!==g)}:b),k={...h,cards:m,columns:w};return n(k),k});},[n]),i=ve.useCallback(async g=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(v=>{let m={...g,id:h,cardIds:[]},w={...v,columns:[...v.columns,m]};return n(w),w});},[n]),u=ve.useCallback(async(g,h)=>{a(v=>{let m=v.columns.map(k=>k.id===g?{...k,...h}:k),w={...v,columns:m};return n(w),w});},[n]),d=ve.useCallback(async g=>{a(h=>{let v=h.cards.filter(k=>k.columnId!==g),m=h.columns.filter(k=>k.id!==g),w={...h,cards:v,columns:m};return n(w),w});},[n]),f=ve.useCallback(g=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),h},[l]),p=ve.useCallback(g=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),h},[i]),y=ve.useCallback(()=>{a(g=>{let h={...g,cards:[],columns:[]};return n(h),h});},[n]);return {board:r,callbacks:{onCardMove:o,onCardUpdate:s,onCardCreate:l,onCardDelete:c,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:d},setBoard:a,helpers:{addCard:f,addColumn:p,deleteCard:c,deleteColumn:d,clearBoard:y}}}function ic({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:o}=Fn({initialBoard:e,onPersist:r}),s=ve.useMemo(()=>({addCard:(c,i,u={})=>{o.addCard({title:i,columnId:c,position:a.cards.filter(d=>d.columnId===c).length,...u});},addColumn:(c,i)=>{let u=a.columns.length>0?Math.max(...a.columns.map(d=>d.position)):0;o.addColumn({title:c,position:i??u+1e3});},reset:o.clearBoard}),[a.cards,a.columns,o]);return {props:ve.useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:s}}var Oa={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},cc={by:"none",order:"asc"};function dc({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=ve.useState({...Oa,...e}),[o,s]=ve.useState({...cc,...t}),l=ve.useCallback(x=>{n(g=>({...g,...x}));},[]),c=ve.useCallback(x=>{s(g=>({...g,...x}));},[]),i=ve.useCallback(()=>{n(Oa),s(cc);},[]),u=ve.useCallback(()=>{r&&n({...Oa,assignees:[r]});},[r]),d=ve.useCallback(()=>{n({...Oa,dateFilter:"overdue"});},[]),f=ve.useCallback(()=>{n({...Oa,priorities:["HIGH","URGENT"]});},[]),p=ve.useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||o.by!=="none",[a,o]),y=ve.useCallback(x=>{let g=[...x];if(a.search){let h=a.search.toLowerCase();g=g.filter(v=>v.title.toLowerCase().includes(h)||v.description?.toLowerCase().includes(h));}if(a.dateFilter!=="all"){let h=new Date,v=h.getFullYear(),m=String(h.getMonth()+1).padStart(2,"0"),w=String(h.getDate()).padStart(2,"0"),k=`${v}-${m}-${w}`;g=g.filter(b=>{if(!b.endDate&&!b.dueDate)return false;let C=b.endDate||b.dueDate;if(!C)return false;let T;if(typeof C=="string")T=C.split("T")[0]||C;else {let D=C.getUTCFullYear(),S=String(C.getUTCMonth()+1).padStart(2,"0"),E=String(C.getUTCDate()).padStart(2,"0");T=`${D}-${S}-${E}`;}switch(a.dateFilter){case "overdue":return T<k;case "today":return T===k;case "this-week":let D=new Date(k+"T00:00:00"),S=new Date(T+"T00:00:00"),E=new Date(D);return E.setDate(E.getDate()+7),S>=D&&S<=E;case "custom":if(a.dateRange){let I=typeof C=="string"?new Date(C):C;return I>=a.dateRange.start&&I<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(g=g.filter(h=>h.priority&&a.priorities.includes(h.priority))),a.assignees.length>0&&(g=g.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(m=>a.assignees.includes(m)))),a.labels.length>0&&(g=g.filter(h=>h.labels&&h.labels.some(v=>a.labels.includes(v)))),a.columns.length>0&&(g=g.filter(h=>a.columns.includes(h.columnId))),o.by!=="none"&&g.sort((h,v)=>{let m=0;switch(o.by){case "created":let w=h.createdAt?new Date(h.createdAt).getTime():0,k=v.createdAt?new Date(v.createdAt).getTime():0;m=w-k;break;case "priority":let b={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},C=b[h.priority||"LOW"],T=b[v.priority||"LOW"];m=C-T;break;case "dueDate":let D=h.endDate||h.dueDate,S=v.endDate||v.dueDate;if(!D)return 1;if(!S)return -1;let E=typeof D=="string"?new Date(D).getTime():D.getTime(),I=typeof S=="string"?new Date(S).getTime():S.getTime();m=E-I;break;case "title":m=h.title.localeCompare(v.title);break;case "estimate":let R=h.estimatedTime||0,L=v.estimatedTime||0;m=R-L;break;default:m=0;}return o.order==="asc"?m:-m}),g},[a,o]);return {filters:a,sort:o,setFilters:l,setSort:c,resetFilters:i,filterMyTasks:u,filterOverdue:d,filterHighPriority:f,applyFilters:y,hasActiveFilters:p}}var pc,mc;if(typeof window<"u")try{let e=Ua("ai");pc=e.generateObject,mc=e.generateText;}catch{}function fc(e={}){let[t,r]=ve.useState(false),[a,n]=ve.useState(null),o=!!(pc&&mc&&e.apiKey),s=ve.useCallback(async d=>{if(!o)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');r(true),n(null);try{return console.log("Generating plan for:",d),{columns:[{title:"To Do",position:1e3,cardIds:[]},{title:"In Progress",position:2e3,cardIds:[]},{title:"Done",position:3e3,cardIds:[]}],cards:[{title:"Generated task from AI",description:`Based on: ${d}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(f){let p=f instanceof Error?f:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[o]),l=ve.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(f){let p=f instanceof Error?f:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[o]),c=ve.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(f){let p=f instanceof Error?f:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[o]),i=ve.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Generating subtasks for:",d.title),[{title:`Subtask 1 for: ${d.title}`,position:d.position+.1,columnId:d.columnId},{title:`Subtask 2 for: ${d.title}`,position:d.position+.2,columnId:d.columnId}]}catch(f){let p=f instanceof Error?f:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[o]),u=ve.useCallback(async d=>{if(!o)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(f){let p=f instanceof Error?f:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[o]);return {onGeneratePlan:s,onSuggestAssignee:l,onPredictRisks:c,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:o,isLoading:t,error:a}}function ls(){let[e,t]=ve.useState(()=>core.selectionStore.getState());ve.useEffect(()=>core.selectionStore.subscribe(n=>{t(n);}),[]);let r=ve.useCallback(a=>{core.selectionStore.setState(a);},[]);return [e,r]}function gc(e){let{cards:t}=e,[r,a]=ls(),n=ve.useCallback(d=>r.selectedCardIds.includes(d),[r.selectedCardIds]),o=ve.useCallback((d,f)=>{if(!f){a({selectedCardIds:[d],lastSelectedCardId:d});return}let p=f.ctrlKey||f.metaKey,y=f.shiftKey;if(p)r.selectedCardIds.includes(d)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==d),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,d],lastSelectedCardId:d});else if(y&&r.lastSelectedCardId){let x=t.find(h=>h.id===d),g=t.find(h=>h.id===r.lastSelectedCardId);if(x&&g&&x.columnId===g.columnId){let h=t.filter(T=>T.columnId===x.columnId).sort((T,D)=>T.position-D.position),v=h.findIndex(T=>T.id===r.lastSelectedCardId),m=h.findIndex(T=>T.id===d),[w,k]=v<m?[v,m]:[m,v],b=h.slice(w,k+1).map(T=>T.id),C=Array.from(new Set([...r.selectedCardIds,...b]));a({selectedCardIds:C,lastSelectedCardId:d});}else a({selectedCardIds:[d],lastSelectedCardId:d});}else a({selectedCardIds:[d],lastSelectedCardId:d});},[t,r,a]),s=ve.useCallback(d=>{a({selectedCardIds:r.selectedCardIds.filter(f=>f!==d),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),l=ve.useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),c=ve.useCallback(()=>{a({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=ve.useCallback(d=>{r.selectedCardIds.includes(d)?s(d):a({selectedCardIds:[...r.selectedCardIds,d],lastSelectedCardId:d});},[r,s,a]),u=ve.useCallback(()=>t.filter(d=>r.selectedCardIds.includes(d.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:o,deselectCard:s,clearSelection:l,selectAll:c,toggleCard:i,getSelectedCards:u}}var hc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function vc(e){let{cards:t,config:r,aiService:a}=e,n=ve.useMemo(()=>({...hc,...r}),[r]),[o,s]=ve.useState([]),l=ve.useCallback((x,g,h,v,m)=>{if(g.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:g,columnId:h,strategy:v,color:m,isExpanded:true,position:o.filter(k=>k.columnId===h).length,createdAt:new Date};s(k=>[...k,w]);},[n.minCardsPerStack,o]),c=ve.useCallback(x=>{s(g=>g.filter(h=>h.id!==x));},[]),i=ve.useCallback(x=>{s(g=>g.map(h=>h.id===x?{...h,isExpanded:!h.isExpanded}:h));},[]),u=ve.useCallback((x,g)=>{s(h=>h.map(v=>v.id===x&&!v.cardIds.includes(g)?{...v,cardIds:[...v.cardIds,g]}:v));},[]),d=ve.useCallback((x,g)=>{s(h=>h.map(v=>{if(v.id===x){let m=v.cardIds.filter(w=>w!==g);return m.length<n.minCardsPerStack?null:{...v,cardIds:m}}return v}).filter(v=>v!==null));},[n.minCardsPerStack]),f=ve.useCallback(x=>o.filter(g=>g.columnId===x).sort((g,h)=>g.position-h.position),[o]),p=ve.useCallback(async x=>{let g=t.filter(k=>k.columnId===x);if(g.length<n.minCardsPerStack*2)return [];let h=[],v=new Map;g.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(b=>{v.has(b)||v.set(b,[]),v.get(b).push(k);});}),v.forEach((k,b)=>{k.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F4CC} ${b}`,cardIds:k.map(C=>C.id),columnId:x,strategy:"labels",color:"#3b82f6"},reason:`${k.length} cards with label "${b}"`,confidence:.85});});let m=new Map;g.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(b=>{m.has(b)||m.set(b,[]),m.get(b).push(k);});}),m.forEach((k,b)=>{k.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${b.slice(-4)}`,cardIds:k.map(C=>C.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(g.forEach(k=>{k.priority&&(w.has(k.priority)||w.set(k.priority,[]),w.get(k.priority).push(k));}),w.forEach((k,b)=>{if(k.length>=n.minCardsPerStack){let C={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[b.toLowerCase()]||"\u26AA";h.push({stack:{title:`${C} ${b} Priority`,cardIds:k.map(T=>T.id),columnId:x,strategy:"priority",color:b==="high"||b==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${b} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let k of g){let C=(await a.findSimilar(k,g)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(C.length>=n.minCardsPerStack-1){let T=[k.id,...C.map(S=>S.card.id)],D=C.reduce((S,E)=>S+E.similarity,0)/C.length;h.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:T,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${C.length+1} similar tasks`,confidence:D});}}return h.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,b)=>b.confidence-k.confidence).slice(0,5)},[t,n,a]),y=ve.useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return ve.useEffect(()=>{n.enableAutoStacking&&o.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let h=await p(g),v=h[0];h.length>0&&v&&v.confidence>=.9&&y(v);});},[]),{stacks:o,createStack:l,deleteStack:c,toggleStack:i,addToStack:u,removeFromStack:d,getStacksForColumn:f,getSuggestions:p,applySuggestion:y,config:n}}var bc=ve.createContext(null);function yc({children:e,initialData:t,onStateChange:r}){let a=ve.useRef();if(!a.current){let o=new Map,s=new Map;t?.columns?.forEach(c=>{let{Column:i}=Ua("@libxai/core");o.set(c.id,new i(c));}),t?.cards?.forEach(c=>{let{Card:i}=Ua("@libxai/core");s.set(c.id,new i(c));});let l=null;if(t?.board){let{Board:c}=Ua("@libxai/core");l=new c(t.board);}a.current=new core.BoardStore({board:l,columns:o,cards:s});}let n=a.current;return ve.useEffect(()=>{if(r)return n.subscribeAll(o=>{r(n.getState());})},[n,r]),jsxRuntime.jsx(bc.Provider,{value:{store:n},children:e})}function Bn(){let e=ve.useContext(bc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ha(){let e=Bn(),[t,r]=ve.useState(e.getBoard()),[a,n]=ve.useState(e.getAllColumns()),[o,s]=ve.useState(e.getAllCards());ve.useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),s(e.getAllCards());}),[e]);let l=ve.useCallback(v=>{e.updateBoard(v);},[e]),c=ve.useCallback(v=>{e.addColumn(v);},[e]),i=ve.useCallback((v,m)=>{e.updateColumn(v,m);},[e]),u=ve.useCallback(v=>{e.deleteColumn(v);},[e]),d=ve.useCallback(v=>e.getColumn(v),[e]),f=ve.useCallback(v=>{e.addCard(v);},[e]),p=ve.useCallback((v,m)=>{e.updateCard(v,m);},[e]),y=ve.useCallback(v=>{e.deleteCard(v);},[e]),x=ve.useCallback((v,m,w)=>{e.moveCard(v,m,w);},[e]),g=ve.useCallback(v=>e.getCard(v),[e]),h=ve.useCallback(v=>e.getCardsByColumn(v),[e]);return {board:t,columns:a,cards:o,updateBoard:l,addColumn:c,updateColumn:i,deleteColumn:u,getColumn:d,addCard:f,updateCard:p,deleteCard:y,moveCard:x,getCard:g,getCardsByColumn:h}}function kc(e){let{cards:t}=Ha();return ve.useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),o=r.description?.toLowerCase().includes(a);if(!n&&!o)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function wc(e="position",t="asc"){let{cards:r}=Ha();return ve.useMemo(()=>[...r].sort((n,o)=>{let s=0;switch(e){case "title":s=n.title.localeCompare(o.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?l[n.priority]:0,i=o.priority?l[o.priority]:0;s=c-i;break}case "createdAt":s=n.createdAt.getTime()-o.createdAt.getTime();break;case "updatedAt":s=n.updatedAt.getTime()-o.updatedAt.getTime();break;case "position":s=n.position-o.position;break}return t==="asc"?s:-s}),[r,e,t])}var On=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=As.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];if(typeof s=="function")try{let l=await Promise.resolve(s.apply(o,r));l!==void 0&&(n=l,r[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let o=n[t];typeof o=="function"&&a.push(Promise.resolve(o.apply(n,r)).catch(s=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,s,{plugin:n.id,hook:t});}));}await Promise.all(a);}},jf=new On;function Tc({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:o=5,horizontal:s=false,gap:l=0,getItemKey:c}){let i=ve.useRef(null),u=reactVirtual.useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:o,horizontal:s,gap:l}),d=u.getVirtualItems(),f={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=s?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:i,style:f,className:n,children:jsxRuntime.jsx("div",{style:p,children:d.map(y=>{let x=e[y.index];if(!x)return null;let g=c?c(x,y.index):y.index,h={position:"absolute",top:s?0:y.start,left:s?y.start:0,width:s?y.size:"100%",height:s?"100%":y.size};return jsxRuntime.jsx("div",{style:h,"data-index":y.index,children:a(x,y.index)},g)})})})}function Sc(e){return reactVirtual.useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Dc({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:o="",overscan:s=3,gap:l=16,getItemKey:c,horizontal:i=true}){let u=ve.useRef(null),d=reactVirtual.useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>a,overscan:s,gap:l}),f=d.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},y={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsxRuntime.jsx("div",{ref:u,style:p,className:o,children:jsxRuntime.jsx("div",{style:y,children:f.map(x=>{let g=e[x.index];if(!g)return null;let h=c?c(g,x.index):x.index,v={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsxRuntime.jsx("div",{style:v,"data-index":x.index,children:n(g,x.index)},h)})})})}function Ec(e){let t=reactVirtual.useVirtualizer({horizontal:true,count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateColumnWidth,overscan:e.overscan??3,gap:e.gap??0});return {columnVirtualizer:t,virtualColumns:t.getVirtualItems(),totalWidth:t.getTotalSize()}}function Rc(e,t=10){return e>t}var ps={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ms={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},fs={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},gs={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},hs={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},vs={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},bs={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ys={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",smooth:"cubic-bezier(0.4, 0.0, 0.2, 1)",sharp:"cubic-bezier(0.4, 0.0, 0.6, 1)",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},xs={none:"none",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",inner:"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},ks={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ws={column:{width:320,minWidth:280,maxWidth:400,gap:16,padding:12,headerHeight:48},card:{minHeight:80,maxHeight:400,padding:12,gap:8},board:{padding:16,gap:16}},Cs={timeline:{headerHeight:60,rowHeight:44,minRowHeight:32,maxRowHeight:80,taskPadding:4,gridLineWidth:1},task:{height:28,minHeight:20,maxHeight:40,borderRadius:4,padding:6},dependency:{lineWidth:2,arrowSize:8},scale:{day:{columnWidth:40,minColumnWidth:30,maxColumnWidth:60},week:{columnWidth:80,minColumnWidth:60,maxColumnWidth:120},month:{columnWidth:120,minColumnWidth:80,maxColumnWidth:200},quarter:{columnWidth:200,minColumnWidth:150,maxColumnWidth:300}},milestone:{size:16,rotation:45}},zn={spacing:ps,borderRadius:ms,fontSize:fs,fontWeight:gs,lineHeight:hs,zIndex:vs,duration:bs,easing:ys,shadows:xs,opacity:ks,kanban:ws,gantt:Cs};function Pc(e,t,r){return e[t]??r}function Ts(e,t="",r={}){for(let[a,n]of Object.entries(e)){let o=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?Ts(n,o,r):(typeof n=="string"||typeof n=="number")&&(r[o]=n);}return r}function Xf(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ss(e="asakaa"){let t=Ts(zn),r=[];for(let[a,n]of Object.entries(t)){let o=`--${e}-${a}`,s=Xf(n);r.push(` ${o}: ${s};`);}return `:root {
|