@libxai/board 0.17.157 → 0.17.159
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 +26 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1109 -1056
- package/dist/index.d.ts +1109 -1056
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/dist/styles.css +20 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useEffect,useCallback,useMemo,useImperativeHandle,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Fi(t[0]),r=[],o=new Map,s=[];for(let d=1;d<t.length;d++)try{let c=Fi(t[d]||"");if(c.length>a.length){s.push(`Line ${d+1}: Too many columns`);continue}if(a.length-c.length>3){s.push(`Line ${d+1}: Column count mismatch (expected ${a.length}, got ${c.length})`);continue}for(;c.length<a.length;)c.push("");let n={};a.forEach((u,v)=>{n[u]=c[v]||"";});let m=n.Column||"Unnamed";o.has(m)||o.set(m,{id:`col-${o.size+1}`,title:m,position:o.size+1,cardIds:[]});let l=o.get(m),i={id:n["Card ID"]||`card-${d}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:l.id,position:l.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),l.cardIds.push(i.id);}catch(c){s.push(`Line ${d+1}: ${c instanceof Error?c.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Fi(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],d=e[o+1];s==='"'&&r&&d==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Bi(e,t){switch(t){case "json":return ep(e);case "csv":return tp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Ri(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var Pn=createContext(null);function Oi(){return useContext(Pn)}var $i=createContext(null);function zi({children:e,themeName:t}){return jsx($i.Provider,{value:{themeName:t},children:e})}function Sr(){return useContext($i)}function Qe({children:e,container:t}){let[a,r]=useState(false),o=Oi(),s=Sr();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let d=t||(typeof document<"u"?document.body:null);if(!d)return null;if(o){let{theme:c,themeName:p}=o,n={"--asakaa-color-background-primary":c.bgPrimary,"--asakaa-color-background-secondary":c.bgSecondary,"--asakaa-color-background-card":c.bgGrid,"--asakaa-color-background-hover":c.hoverBg,"--asakaa-color-text-primary":c.textPrimary,"--asakaa-color-text-secondary":c.textSecondary,"--asakaa-color-text-tertiary":c.textTertiary,"--asakaa-color-text-inverse":c.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":c.border,"--asakaa-color-border-hover":c.borderLight,"--asakaa-color-border-subtle":c.borderLight,"--asakaa-color-interactive-primary":c.accent,"--asakaa-color-interactive-primaryHover":c.accentHover,"--asakaa-color-interactive-primaryBorder":`${c.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${c.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${c.accent}33`,"--asakaa-color-status-success":c.statusCompleted,"--asakaa-color-status-warning":c.milestone,"--asakaa-color-status-error":c.criticalPath,"--asakaa-color-danger":c.criticalPath,"--asakaa-color-danger-border":`${c.criticalPath}4D`,"--asakaa-color-danger-background":`${c.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${c.criticalPath}26`};return createPortal(jsx("div",{"data-theme":p,"data-gantt-portal":"true",style:n,children:e}),d)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),d):createPortal(e,d)}var _i={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},dp="#BDC3C7",cp=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function lr({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,d]=useState({top:0,left:0}),c=useRef(null),p=useRef(null),n=()=>{if(!p.current)return;let u=p.current.getBoundingClientRect(),v=window.innerHeight,f=window.innerWidth,y=160,x=220,b=4,g=u.right-y;g<10&&(g=u.left),g+y>f-10&&(g=f-y-10);let k=v-u.bottom,N=u.top,h;k>=x+b?h=u.bottom+b:N>=x+b?h=u.top-x-b:h=k>=N?u.bottom+b:Math.max(10,u.top-x-b),d({top:h,left:g}),o(true);};useEffect(()=>{let u=v=>{c.current&&!c.current.contains(v.target)&&!p.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]),useEffect(()=>{let u=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[r]);let m=u=>{t(u),o(false);},l=e?_i[e]:null,i=l?.color||dp;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:p,onClick:()=>r?o(false):n(),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:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:l?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Qe,{children:jsxs("div",{ref:c,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(_i).map(([u,v])=>jsxs("button",{onClick:()=>m(u),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(cp,{color:v.color}),jsx("span",{className:"font-semibold text-sm",children:v.label}),e===u&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},u)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>m(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:u=>{u.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:u=>{u.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var pp=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function jr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[d,c]=useState({top:0,left:0}),p=useRef(null),n=useRef(null),i=(Sr()?.themeName||"dark")==="dark",u=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),k=window.innerHeight,N=window.innerWidth,h=320,E=380,C=4,F=g.left;F+h>N-10&&(F=N-h-10),F<10&&(F=10);let T=k-g.bottom,$=g.top,W;T>=E+C?W=g.bottom+C:$>=E+C?W=g.top-E-C:W=T>=$?g.bottom+C:Math.max(10,g.top-E-C),c({top:W,left:F}),s(true);};useEffect(()=>{let g=k=>{p.current&&!p.current.contains(k.target)&&!n.current?.contains(k.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),useEffect(()=>{let g=k=>{k.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let v=g=>{let k=new Date,N=F=>{let T=F.getFullYear(),$=String(F.getMonth()+1).padStart(2,"0"),W=String(F.getDate()).padStart(2,"0");return `${T}-${$}-${W}`},h=N(k),E=new Date(k);E.setDate(E.getDate()+g);let C=N(E);a(h,C),s(false);},f=()=>{if(!e||!t)return "Set date";let g=E=>{if(E instanceof Date)return E;if(typeof E!="string"||!E.match(/^\d{4}-\d{2}-\d{2}$/))return null;let C=E.split("-").map(Number);if(C.length!==3||C.some(W=>isNaN(W)))return null;let F=C[0],T=C[1],$=C[2];return F===void 0||T===void 0||$===void 0?null:new Date(F,T-1,$)},k=g(e),N=g(t);if(!k||!N||isNaN(k.getTime())||isNaN(N.getTime()))return "Set date";let h=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${h[k.getMonth()]} ${k.getDate()} \u2013 ${h[N.getMonth()]} ${N.getDate()}`},y=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,k=new Date;return k.setHours(0,0,0,0),g<k})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:n,onClick:()=>o?s(false):u(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${f()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:f()})]}),o&&jsx(Qe,{children:jsxs("div",{ref:p,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:pp.map(g=>jsx("button",{onClick:()=>v(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:k=>{k.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",k.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function cr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,d]=useState(false),[c,p]=useState(""),[n,m]=useState({top:0,left:0}),l=useRef(null),i=useRef(null),u=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,k=window.innerWidth,N=300,h=380,E=4,C=b.right-N;C<10&&(C=b.left),C+N>k-10&&(C=k-N-10);let F=g-b.bottom,T=b.top,$;F>=h+E?$=b.bottom+E:T>=h+E?$=b.top-h-E:$=F>=T?b.bottom+E:Math.max(10,b.top-h-E),m({top:$,left:C}),d(true);};useEffect(()=>{let b=g=>{l.current&&!l.current.contains(g.target)&&!i.current?.contains(g.target)&&(d(false),p(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=g=>{g.key==="Escape"&&(d(false),p(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let v=b=>{let g=e.some(k=>k.id===b.id);a(g?e.filter(k=>k.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:i,onClick:()=>s?d(false):u(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[y.map(b=>jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),x>0&&jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(Qe,{children:jsxs("div",{ref:l,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:c,onChange:b=>p(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:f.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):f.map(b=>{let g=e.some(k=>k.id===b.id);return jsxs("button",{onClick:()=>v(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:g?"#3b82f6":"transparent"},children:g?"\u2713":""})]},b.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),d(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Mo(e,t,a){let r=new Map;e.forEach(p=>{if(p.dependencies&&Array.isArray(p.dependencies)){let n=p.dependencies.map(m=>{if(typeof m=="string")return m;let l=m;return l.taskId||l.targetId||""}).filter(Boolean);r.set(p.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,d=new Set,c=p=>{if(!s.has(p)){s.add(p),d.add(p);let n=r.get(p)||[];for(let m of n){if(!s.has(m)&&c(m))return true;if(d.has(m))return true}}return d.delete(p),false};return c(a)}function Yr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:d}){let[c,p]=useState(false),[n,m]=useState(""),[l,i]=useState(t.length>0),[u,v]=useState({top:0,left:0}),[f,y]=useState(null),x=useRef(null),b=useRef(null),g=()=>{if(!b.current)return;let C=b.current.getBoundingClientRect(),F=window.innerHeight,T=window.innerWidth,$=300,W=l?380:120,L=4,G=C.right-$;G<10&&(G=C.left),G+$>T-10&&(G=T-$-10);let ee=F-C.bottom,he=C.top,ye;ee>=W+L?ye=C.bottom+L:he>=W+L?ye=C.top-W-L:ye=ee>=he?C.bottom+L:Math.max(10,C.top-W-L),v({top:ye,left:G}),p(true);};useEffect(()=>{if(!c||!b.current)return;let C=b.current.getBoundingClientRect(),F=window.innerHeight,T=window.innerWidth,$=300,W=l?380:120,L=4,G=C.right-$;G<10&&(G=C.left),G+$>T-10&&(G=T-$-10);let ee=F-C.bottom,he=C.top,ye;ee>=W+L?ye=C.bottom+L:he>=W+L?ye=C.top-W-L:ye=ee>=he?C.bottom+L:Math.max(10,C.top-W-L),v({top:ye,left:G});},[l,c]),useEffect(()=>{let C=F=>{x.current&&!x.current.contains(F.target)&&!b.current?.contains(F.target)&&(p(false),m(""));};if(c)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]),useEffect(()=>{let C=F=>{F.key==="Escape"&&(p(false),m(""));};if(c)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[c]);let k=C=>{let F=t.includes(C),T=a.find($=>$.id===C);if(y(null),F){let $=t.filter(W=>W!==C);r($),$.length===0&&i(false);}else {if(s&&Mo(a,C,e)){let W=`Cannot add "${T?.title||C}" as dependency - would create circular reference`;y(W),d?.(C,T?.title||C),setTimeout(()=>y(null),3e3);return}r([...t,C]),i(true);}},N=()=>{let C=!l;i(C),C||r([]);},h=a.filter(C=>C.id!==e).filter(C=>C.title.toLowerCase().includes(n.toLowerCase())||C.id.toLowerCase().includes(n.toLowerCase())),E=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>c?p(false):g(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:E,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:E},children:t.length})]}),c&&jsx(Qe,{children:jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${u.top}px`,left:`${u.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[f&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:f})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:l?"#3b82f6":"transparent",borderColor:l?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:l&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),l&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:n,onChange:C=>m(C.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:h.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):h.map(C=>{let F=t.includes(C.id);return jsxs("button",{onClick:()=>k(C.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:T=>{T.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:T=>{T.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:F?"#3b82f6":"transparent",borderColor:F?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:F&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:C.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:C.id})]})]},C.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),i(false),p(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var Oa=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:d,availableUsers:c=[],allCards:p=[]})=>{let{attributes:n,listeners:m,setNodeRef:l,transform:i,transition:u,isDragging:v}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:No.Transform.toString(i),transition:u};if(t)return jsx("div",{ref:l,style:f,...n,...m,onClick:()=>a?.(e),children:t(e)});let y=c.filter(g=>e.assignedUserIds?.includes(g.id)),x=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:l,style:b,className:w("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...m,onClick:g=>{g.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:g=>{g.currentTarget.style.display="none";}})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:g=>g.stopPropagation(),className:"priority-selector",children:jsx(lr,{priority:e.priority,onChange:g=>d?.(e.id,{priority:g})})}),jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsx(jr,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(g,k)=>d?.(e.id,{startDate:g,endDate:k})})}),c.length>0&&jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsx(cr,{assignedUsers:y,availableUsers:c,onChange:g=>d?.(e.id,{assignedUserIds:g.map(k=>k.id)})})}),jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsx(Yr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:p,onChange:g=>d?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsx("span",{className:"asakaa-label",children:g},g))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies));Oa.displayName="Card";var Ao={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"}},el=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function tl({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[d,c]=useState({top:0,left:0}),p=useRef(null),n=useRef(null),m=[...Object.entries(Ao).map(([y,x])=>({id:y,label:x.label,color:x.color,icon:x.icon})),...r.filter(y=>!Object.keys(Ao).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],l=()=>{let y=Ao[e];if(y)return {...y,id:e};let x=r.find(b=>b.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Ao.todo,id:"todo"}},i=()=>{if(!n.current)return;let y=n.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,g=180,k=280,N=4,h=y.right-g;h<10&&(h=y.left),h+g>b-10&&(h=b-g-10);let E=x-y.bottom,C=y.top,F;E>=k+N?F=y.bottom+N:C>=k+N?F=y.top-k-N:F=E>=C?y.bottom+N:Math.max(10,y.top-k-N),c({top:F,left:h}),s(true);};useEffect(()=>{let y=x=>{p.current&&!p.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),useEffect(()=>{let y=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let u=y=>{t(y),s(false);},v=l(),f=v.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:n,onClick:()=>o?s(false):i(),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:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:v.label,children:jsx(el,{icon:v.icon,color:f})}),o&&jsx(Qe,{children:jsxs("div",{ref:p,className:"status-selector-menu",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsx("div",{className:"py-1",children:m.map(y=>jsxs("button",{onClick:()=>u(y.id),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:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(el,{icon:y.icon,color:y.color}),jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}function al({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,d]=useState(false),[c,p]=useState(false),[n,m]=useState(e),[l,i]=useState({top:0,left:0}),u=useRef(null),v=useRef(null),f=useRef(null);useEffect(()=>{if(s&&v.current){let g=v.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),useEffect(()=>{let g=k=>{u.current&&!u.current.contains(k.target)&&!v.current?.contains(k.target)&&(d(false),p(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),useEffect(()=>{let g=k=>{k.key==="Escape"&&(d(false),p(false),m(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),useEffect(()=>{c&&f.current&&(f.current.focus(),f.current.select());},[c]);let y=()=>{p(true),m(e);},x=()=>{let g=n.trim();g&&g!==e&&t(g),p(false),d(false),m(e);},b=g=>{g.key==="Enter"?x():g.key==="Escape"&&(p(false),m(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>d(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsx(Qe,{children:jsx("div",{ref:u,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${l.top}px`,left:`${l.left}px`,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)",zIndex:99999},children:c?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:f,type:"text",value:n,onChange:g=>m(g.target.value),onKeyDown:b,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),d(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Mr=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:d,onCardUpdate:c,availableUsers:p,allCards:n,enableVirtualization:m,cardHeight:l=120,isCollapsed:i,onToggleCollapse:u,onColumnRename:v,onColumnDelete:f,isDeletable:y=false,className:x})=>{let{setNodeRef:b,isOver:g}=useDroppable({id:e.id,data:{type:"column",column:e}}),k=useRef(null),N=m??Ei(t.length),h=useVirtualizer({count:t.length,getScrollElement:()=>k.current,estimateSize:()=>l,enabled:N});if(a)return jsx("div",{ref:b,className:x,children:a(e,t)});let C=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),F=C.state==="exceeded",T=()=>"asakaa-column-count";return jsxs("div",{ref:b,className:w("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",F&&"ring-2 ring-asakaa-accent-red",x),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:w(T()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&C.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${C.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[C.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),C.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),C.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),C.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||f)&&jsx(al,{columnTitle:e.title,onRename:$=>v?.(e.id,$),onDelete:f?()=>f(e.id):void 0,isDeletable:y}),u&&jsx("button",{onClick:u,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsx("div",{ref:k,className:"asakaa-column-cards",style:{maxHeight:N?"600px":void 0},children:jsx(SortableContext,{items:t.map($=>$.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):N?jsx("div",{style:{height:`${h.getTotalSize()}px`,position:"relative"},children:h.getVirtualItems().map($=>{let W=t[$.index];return W?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsx(Oa,{card:W,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n})},W.id):null})}):t.map($=>jsx(Oa,{card:$,render:r,onClick:d,onUpdate:c,availableUsers:p,allCards:n},$.id))})})]})});Mr.displayName="Column";function Fn({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,d]=useState(e),c=useRef(null);useEffect(()=>{r&&c.current&&(c.current.focus(),c.current.select());},[r]);let p=()=>{let m=s.trim();m&&m!==e?t(m):d(e),o(false);},n=m=>{m.key==="Enter"?p():m.key==="Escape"&&(d(e),o(false));};return r?jsx("input",{ref:c,type:"text",value:s,onChange:m=>d(m.target.value),onBlur:p,onKeyDown:n,className:w("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:w("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Rn(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Xa({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:d,style:c,isLoading:p,error:n,children:m}){let[l,i]=Rn(),u=o?.theme||"dark",f=u==="dark"||u==="neutral"?"dark":"",y=useCallback((T,$)=>{t.onCardUpdate?.(T,$);},[t]),x=useCallback((T,$)=>{t.onColumnUpdate?.(T,{title:$});},[t]),b=useCallback(T=>{t.onColumnDelete?.(T);},[t]),g=["todo","in-progress","completed"],k=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),N=useMemo(()=>{let T=new Map;return e.columns.forEach($=>{let W=$.cardIds.map(L=>e.cards.find(G=>G.id===L)).filter(L=>L!==void 0).sort((L,G)=>L.position-G.position);T.set($.id,W);}),T},[e.cards,e.columns]),h=useCallback(T=>{let{active:$}=T,W=e.cards.find(L=>L.id===$.id);W&&i({isDragging:true,draggedCardId:W.id,sourceColumnId:W.columnId,targetColumnId:W.columnId});},[e.cards,i]),E=useCallback(T=>{let{active:$,over:W}=T;if(!W||!e.cards.find(ee=>ee.id===$.id))return;let G=null;W.data.current?.type==="column"?G=W.id:W.data.current?.type==="card"&&(G=e.cards.find(he=>he.id===W.id)?.columnId||null),G&&G!==l.targetColumnId&&i({...l,targetColumnId:G});},[e.cards,l,i]),C=useCallback(async T=>{let{active:$,over:W}=T;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!W)return;let L=e.cards.find(ye=>ye.id===$.id);if(!L)return;let G,ee;if(W.data.current?.type==="column"){G=W.id;let ye=N.get(G)||[];ee=Dn(ye,0);}else {let ye=e.cards.find(B=>B.id===W.id);if(!ye)return;G=ye.columnId;let Me=N.get(G)||[],V=Me.findIndex(B=>B.id===W.id);ee=Dn(Me,V);}let he=e.columns.find(ye=>ye.id===G);if(he&&he.wipLimit&&he.wipLimitType==="hard"){let ye=N.get(G)||[];if(L.columnId!==G&&ye.length>=he.wipLimit){t.onWipLimitExceeded?.(he,L);return}}(L.columnId!==G||L.position!==ee)&&await t.onCardMove?.(L.id,G,ee);},[e.cards,e.columns,N,t,i]),F=useCallback(T=>{a?.(T);},[a]);return p?jsx("div",{className:w("asakaa-board",f,d),style:c,children:jsx(Bp,{columnCount:3})}):n?jsx("div",{className:w("asakaa-board",f,d),style:c,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsx(zi,{themeName:u,children:jsxs(DndContext,{sensors:k,collisionDetection:closestCorners,onDragStart:h,onDragOver:E,onDragEnd:C,children:[jsxs("div",{className:w("asakaa-board",f,d),style:c,"data-theme":u,children:[e.columns.sort((T,$)=>T.position-$.position).map(T=>{let $=N.get(T.id)||[],W=!g.includes(T.id);return jsx(Mr,{column:T,cards:$,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:F,onCardUpdate:y,onColumnRename:x,onColumnDelete:b,isDeletable:W,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},T.id)}),m]}),jsx(DragOverlay,{children:l.draggedCardId?jsx(Oa,{card:e.cards.find(T=>T.id===l.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Bp({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Up={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},Wp={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Gp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Hp={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function _p({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,d]=useState(false),c=useRef(null);useEffect(()=>{let n=m=>{c.current&&!c.current.contains(m.target)&&d(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let p=n=>{t(n),d(false);};return jsxs("div",{ref:c,className:"relative",children:[jsxs(motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((n,m)=>n.position-m.position).map((n,m)=>jsxs(motion.button,{onClick:()=>p(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:m<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:n.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function Vp({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,d]=useState(false),[c,p]=useState(null),n=useRef(null);if(useEffect(()=>{let u=v=>{n.current&&!n.current.contains(v.target)&&d(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]),!(a||r||o))return null;let l=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(u=>u.handler),i=async(u,v)=>{if(v){p(u);try{await v();}catch(f){console.error(`Export ${u} failed:`,f);}finally{p(null),d(false);}}};return jsxs("div",{ref:n,className:"relative",children:[jsxs(motion.button,{onClick:()=>d(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:l.map((u,v)=>jsxs(motion.button,{onClick:()=>i(u.id,u.handler),disabled:c!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<l.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:c===u.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):u.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:u.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:u.description})]})]},u.id))})})})]})}function jp({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function $n({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:d,onExportJSON:c,onExportExcel:p,translations:n}){let m=r==="dark"?Up:Wp,l={...o==="es"?Gp:Hp,...n},i=d||c||p;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:m.bgGrid,borderColor:m.border},children:jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxs(Fragment,{children:[jsx(Vp,{theme:m,t:l,onExportCSV:d,onExportJSON:c,onExportExcel:p}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),t&&(s?jsx(_p,{columns:e,onSelect:t,theme:m,t:l,createTaskLabel:a}):jsx(jp,{onClick:()=>t(),label:a||l.newTask}))]})})}function Un({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,d]=useState(false),[c,p]=useState(""),n=useCallback(()=>{let i=c.trim();i&&(e(i),p(""),d(false));},[c,e]),m=useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(p(""),d(false));},[n]),l=useCallback(()=>{setTimeout(()=>{c.trim()||d(false);},150);},[c]);return s?jsx("div",{className:w("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:c,onChange:i=>p(i.target.value),onKeyDown:m,onBlur:l,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:n,disabled:!c.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{p(""),d(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:w("asakaa-add-column",t),children:jsxs("button",{onClick:()=>d(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Wn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:d=false,theme:c="dark",locale:p="es"}){let[n,m]=useState(false),[l,i]=useState(false),[u,v]=useState(""),[f,y]=useState([]),[x,b]=useState(""),[g,k]=useState(""),[N,h]=useState(""),[E,C]=useState(false),[F,T]=useState(false),[$,W]=useState(false),L=useRef(null),G=useRef(null),ee={placeholder:o||(p==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(p==="es"?"Agregar Tarea":"Add Task"),save:p==="es"?"Guardar":"Save",addAssignee:p==="es"?"Agregar asignado":"Add assignee",addDates:p==="es"?"Agregar fechas":"Add dates",addPriority:p==="es"?"Agregar prioridad":"Add priority",startDate:p==="es"?"Inicio":"Start",endDate:p==="es"?"Fin":"End",low:p==="es"?"Baja":"Low",medium:p==="es"?"Media":"Medium",high:p==="es"?"Alta":"High",urgent:p==="es"?"Urgente":"Urgent"},he=useCallback(()=>{v(""),y([]),b(""),k(""),h(""),C(false),T(false),W(false),m(false);},[]);useEffect(()=>{n&&L.current&&L.current.focus();},[n]),useEffect(()=>{if(!n)return;let I=R=>{G.current&&!G.current.contains(R.target)&&(u.trim()||he());};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[n,u,he]);let ye=useCallback(async()=>{let I=u.trim();if(!(!I||l)){i(true);try{await t({name:I,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:x?new Date(x):void 0,endDate:g?new Date(g):void 0,priority:N||void 0}),v(""),y([]),b(""),k(""),h(""),C(!1),T(!1),W(!1),L.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{i(false);}}},[u,e,f,x,g,N,t,l]),Me=useCallback(I=>{I.key==="Enter"&&!I.shiftKey?(I.preventDefault(),ye()):I.key==="Escape"&&he();},[ye,he]),V=useCallback(I=>{y(R=>R.includes(I)?R.filter(M=>M!==I):[...R,I]);},[]),B=c==="dark";return n?jsxs("div",{ref:G,className:w("rounded-lg overflow-hidden shadow-lg",B?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:L,type:"text",value:u,onChange:I=>v(I.target.value),onKeyDown:Me,placeholder:ee.placeholder,disabled:l,className:w("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",B?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>C(!E),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",E||f.length>0?"bg-emerald-500/20 text-emerald-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ee.addAssignee,children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),f.length>0&&jsx("span",{className:"ml-0.5",children:f.length})]}),jsx("button",{onClick:()=>T(!F),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",F||x||g?"bg-blue-500/20 text-blue-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ee.addDates,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsx("button",{onClick:()=>W(!$),className:w("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",$||N?N==="urgent"?"bg-red-500/20 text-red-400":N==="high"?"bg-orange-500/20 text-orange-400":N==="medium"?"bg-yellow-500/20 text-yellow-400":N==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:ee.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:ye,disabled:!u.trim()||l,className:w("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:l?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):ee.save})]})]}),E&&a.length>0&&jsx("div",{className:w("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(I=>jsxs("button",{onClick:()=>V(I.id),className:w("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(I.id)?"bg-emerald-500 text-white":B?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[I.avatar?jsx("img",{src:I.avatar,alt:I.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:w("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(I.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:I.name.charAt(0).toUpperCase()}),jsx("span",{children:I.name.split(" ")[0]})]},I.id))})}),F&&jsx("div",{className:w("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",B?"text-gray-500":"text-gray-400"),children:ee.startDate}),jsx("input",{type:"date",value:x,onChange:I=>b(I.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",B?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:w("block text-[10px] uppercase tracking-wide mb-1",B?"text-gray-500":"text-gray-400"),children:ee.endDate}),jsx("input",{type:"date",value:g,onChange:I=>k(I.target.value),className:w("w-full px-2 py-1.5 rounded text-xs border",B?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),$&&jsx("div",{className:w("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(I=>jsx("button",{onClick:()=>h(N===I?"":I),className:w("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",N===I?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[I]} text-white`:B?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:ee[I]},I))})})]}):jsxs("button",{onClick:()=>m(true),disabled:d,className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",B?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",d&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsx("span",{className:"text-sm font-medium",children:ee.buttonLabel})]})}var Qr=class extends BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(Xa,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(d=>{d?o(d):s(new Error("Failed to create PNG blob"));},"image/png");})}};function fl(e={}){return new Qr(e)}var Ar=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(d){console.error("Error in error handler:",d);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:d}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:d?`Error in ${d}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Gn(e,t){let a=r=>jsx(Ar,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function _n({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:d,onPredictRisks:c,onOpenAIUsage:p,shortcut:n="k",className:m=""}){let[l,i]=useState(false),[u,v]=useState(""),[f,y]=useState("home"),[x,b]=useState(""),[g,k]=useState("");useEffect(()=>{let C=F=>{(F.metaKey||F.ctrlKey)&&F.key===n&&(F.preventDefault(),i(T=>!T)),F.key==="Escape"&&(i(false),y("home"),v(""));};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[n]),useEffect(()=>{l||(y("home"),v(""),b(""),k(""));},[l]);let N=useCallback(()=>{i(false);},[]),h=useCallback(C=>{let[F,T]=C.split(":");switch(F){case "create-card":y("create-card");break;case "create-card-in":b(T||"");break;case "navigate":T?(a?.(T),N()):y("navigate");break;case "search":r?.(u),N();break;case "priority":y("priority");break;case "set-priority":g&&T&&(o?.(g,T),N());break;case "assign":y("assign");break;case "assign-user":g&&T&&(s?.(g,T),N());break;case "ai":y("ai");break;case "ai-generate-plan":d?.(),N();break;case "ai-predict-risks":c?.(),N();break;case "ai-usage":p?.(),N();break;case "back":y("home");break;}},[u,g,t,a,r,o,s,d,c,p,N]),E=useCallback(()=>{x&&u.trim()&&(t?.(x,u.trim()),N());},[x,u,t,N]);return l?jsx(Qe,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${m}`,onClick:C=>C.stopPropagation(),children:jsxs(Command,{value:u,onValueChange:v,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:f==="create-card"&&x?"Type card title and press Enter...":f==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:C=>{C.key==="Enter"&&f==="create-card"&&x&&E();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),f==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:h,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:h,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:h,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:h,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(C=>jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:h,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:C.title}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(F=>jsx("span",{className:"command-palette-item-label",children:F},F))})]},C.id))})]}),f==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:h,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(C=>jsxs(Command.Item,{value:`create-card-in:${C.id}`,onSelect:h,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:C.title}),jsxs("div",{className:"command-palette-item-count",children:[C.cardIds.length," cards"]})]},C.id))})]}),f==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:h,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(C=>{let F=e.columns.find(T=>T.id===C.columnId);return jsxs(Command.Item,{value:`navigate:${C.id}`,onSelect:h,className:"command-palette-item",keywords:[C.title,C.description||"",...C.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:C.priority==="URGENT"?"#EF4444":C.priority==="HIGH"?"#F59E0B":C.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:C.title}),jsx("div",{className:"command-palette-item-meta",children:F?.title})]}),C.labels&&C.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:C.labels.slice(0,2).map(T=>jsx("span",{className:"command-palette-item-label",children:T},T))})]},C.id)})})]}),f==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:h,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:h,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:h,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:h,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function Qp(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function em(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function tm(e){return e.startsWith("image/")}function to({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[d,c]=useState(false),[p,n]=useState(false),[m,l]=useState(null),i=useRef(null),u=useCallback(h=>{let E=[],C=[];return e.length+h.length>s?(C.push(`Maximum ${s} files allowed`),{valid:E,errors:C}):(h.forEach(F=>{if(F.size/1048576>r){C.push(`${F.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>F.type.match($))){C.push(`${F.name} has invalid file type`);return}E.push(F);}),{valid:E,errors:C})},[e.length,s,r,o]),v=useCallback(async h=>{let{valid:E,errors:C}=u(h);if(C.length>0){l(C.join(", ")),setTimeout(()=>l(null),5e3);return}if(E.length!==0){n(true),l(null);try{await t?.(E);}catch(F){l(F instanceof Error?F.message:"Upload failed"),setTimeout(()=>l(null),5e3);}finally{n(false);}}},[u,t]),f=useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(true);},[]),y=useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);},[]),x=useCallback(h=>{h.preventDefault(),h.stopPropagation();},[]),b=useCallback(h=>{h.preventDefault(),h.stopPropagation(),c(false);let E=Array.from(h.dataTransfer.files);v(E);},[v]),g=useCallback(h=>{let E=h.target.files?Array.from(h.target.files):[];v(E),i.current&&(i.current.value="");},[v]),k=useCallback(()=>{i.current?.click();},[]),N=useCallback(h=>{confirm("Are you sure you want to delete this attachment?")&&a?.(h);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${d?"dragging":""} ${p?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:x,onDrop:b,onClick:k,children:[jsx("input",{ref:i,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:p?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:d?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),m&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:m})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(h=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:tm(h.type)&&h.url?jsx("img",{src:h.thumbnailUrl||h.url,alt:h.name,className:"attachment-thumbnail"}):jsx("div",{className:"attachment-icon",children:em(h.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:h.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:h.name,children:h.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Qp(h.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(h.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>N(h.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},h.id))})]})}function jn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],aiInsights:p=[],attachments:n=[],onAddComment:m,onDeleteComment:l,onUploadAttachments:i,onDeleteAttachment:u,onSuggestAssignee:v,onGenerateSubtasks:f,onEstimateEffort:y,currentUserId:x="user-1"}){let[b,g]=useState("details"),[k,N]=useState(false),[h,E]=useState({}),[C,F]=useState(""),[T,$]=useState(false),[W,L]=useState({});if(!t||!e)return null;let G=useCallback(()=>{N(false),E({}),g("details"),F(""),L({}),a();},[a]),ee=useCallback(()=>{r&&Object.keys(h).length>0&&(r(e.id,h),E({}),N(false));},[e.id,h,r]),he=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),G());},[e.id,o,G]),ye=useCallback(()=>{m&&C.trim()&&(m(e.id,C.trim()),F(""));},[e.id,C,m]),Me=useCallback(async()=>{if(v){$(true);try{let M=await v(e);L(Y=>({...Y,assignees:M}));}catch(M){console.error("Failed to suggest assignee:",M);}finally{$(false);}}},[e,v]),V=useCallback(async()=>{if(f){$(true);try{let M=await f(e);L(Y=>({...Y,subtasks:M}));}catch(M){console.error("Failed to generate subtasks:",M);}finally{$(false);}}},[e,f]),B=useCallback(async()=>{if(y){$(true);try{let M=await y(e);L(Y=>({...Y,effort:M}));}catch(M){console.error("Failed to estimate effort:",M);}finally{$(false);}}},[e,y]),I={...e,...h},R=s.filter(M=>I.assignedUserIds?.includes(M.id));return jsx(Qe,{children:jsx("div",{className:"card-detail-overlay",onClick:G,children:jsxs("div",{className:"card-detail-modal",onClick:M=>M.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:I.priority==="URGENT"?"#EF4444":I.priority==="HIGH"?"#F59E0B":I.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),k?jsx("input",{type:"text",value:h.title??I.title,onChange:M=>E({...h,title:M.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:I.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[k?jsxs(Fragment,{children:[jsx("button",{onClick:ee,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),E({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:he,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:G,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>g("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>g("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",d.length>0&&jsx("span",{className:"card-detail-tab-badge",children:d.length})]}),jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",c.length>0&&jsx("span",{className:"card-detail-tab-badge",children:c.length})]}),jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),k?jsx("textarea",{value:h.description??I.description??"",onChange:M=>E({...h,description:M.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:I.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),k?jsx("select",{multiple:true,value:h.assignedUserIds??I.assignedUserIds??[],onChange:M=>{let Y=Array.from(M.target.selectedOptions,K=>K.value);E({...h,assignedUserIds:Y});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(M=>jsx("option",{value:M.id,children:M.name},M.id))}):jsx("div",{className:"card-detail-users",children:R.length>0?R.map(M=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:M.color},children:M.initials}),jsx("span",{children:M.name})]},M.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),k?jsxs("select",{value:h.priority??I.priority??"",onChange:M=>E({...h,priority:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:I.priority==="URGENT"?"#EF4444":I.priority==="HIGH"?"#F59E0B":I.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:I.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:I.labels&&I.labels.length>0?I.labels.map(M=>jsx("span",{className:"card-detail-label-tag",children:M},M)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),k?jsx("input",{type:"date",value:h.startDate?new Date(h.startDate).toISOString().split("T")[0]:I.startDate?new Date(I.startDate).toISOString().split("T")[0]:"",onChange:M=>E({...h,startDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:I.startDate?new Date(I.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),k?jsx("input",{type:"date",value:h.endDate?new Date(h.endDate).toISOString().split("T")[0]:I.endDate?new Date(I.endDate).toISOString().split("T")[0]:"",onChange:M=>E({...h,endDate:M.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:I.endDate?new Date(I.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),k?jsx("input",{type:"number",min:"0",step:"0.5",value:h.estimatedTime??I.estimatedTime??"",onChange:M=>E({...h,estimatedTime:M.target.value?parseFloat(M.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:I.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:I.dependencies&&I.dependencies.length>0?I.dependencies.map(M=>{let Y=typeof M=="string"?M:M.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",Y.slice(-4)]},Y)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:I.createdAt?new Date(I.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:C,onChange:M=>F(M.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ye,disabled:!C.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:d.length>0?d.map(M=>{let Y=s.find(K=>K.id===M.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[Y&&jsx("div",{className:"card-detail-user-avatar",style:{background:Y.color},children:Y.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:Y?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(M.createdAt).toLocaleString()})]})]}),l&&jsx("button",{onClick:()=>l(M.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:M.content})]},M.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsx("div",{className:"card-detail-activity",children:c.length>0?jsx("div",{className:"card-detail-activity-list",children:c.map(M=>{let Y=s.find(K=>K.id===M.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[M.type.includes("CREATED")&&"\u2795",M.type.includes("UPDATED")&&"\u270F\uFE0F",M.type.includes("MOVED")&&"\u27A1\uFE0F",M.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",M.type.includes("COMMENT")&&"\u{1F4AC}",M.type.includes("ASSIGNED")&&"\u{1F464}",M.type.includes("PRIORITY")&&"\u{1F3AF}",M.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",M.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:Y?.name||"Unknown"})," ",M.type.replace(/_/g," ").toLowerCase(),M.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:M.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(M.timestamp).toLocaleString()})]})]},M.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(to,{cardId:e.id,attachments:n,onUpload:i?M=>i(e.id,M):void 0,onDelete:u,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:Me,disabled:T||!v,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:V,disabled:T||!f,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:B,disabled:T||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((M,Y)=>{let K=s.find(q=>q.id===M.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[K&&jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:K?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:M.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(M.confidence*100).toFixed(0),"%"]})]})]},Y)})]}),W.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((M,Y)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:M.title}),M.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:M.description}),M.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",M.estimatedTime,"h"]})]},Y))]}),W.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),p.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),p.map(M=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${M.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:M.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:M.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:M.description}),M.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",M.suggestedAction]})]},M.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&p.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function ao({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:d=""}){let[c,p]=useState({top:0,left:0}),n=useRef(null),m=useCallback(()=>{if(!e.current)return {top:0,left:0};let l=e.current.getBoundingClientRect(),i=window.innerHeight,u=window.innerWidth,v=4,f=l.left;f+o>u-10&&(f=u-o-10),f<10&&(f=10);let y=i-l.bottom,x=l.top,b;return y>=s+v?b=l.bottom+v:x>=s+v?b=l.top-s-v:y>=x?b=l.bottom+v:b=Math.max(10,l.top-s-v),{top:b,left:f}},[e,o,s]);return useEffect(()=>{t&&p(m());},[t,m]),useEffect(()=>{if(!t)return;let l=u=>{let v=u.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",l);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",l);}},[t,a,e]),useEffect(()=>{if(!t)return;let l=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),t?jsx(Qe,{children:jsx("div",{ref:n,className:`smart-popover ${d}`,style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var dm=["LOW","MEDIUM","HIGH","URGENT"],cm=["todo","in-progress","review","done"];function qn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:d=[],activities:c=[],onAddComment:p,onDeleteComment:n,currentUser:m,onAIGenerateDescription:l,onAICreateSubtasks:i,onAIFindSimilar:u,availableColumns:v=[],availableLabels:f=[],onUploadCoverImage:y,unsplashAccessKey:x,theme:b,onSubtasksChange:g}){let k=Sr(),N=b||k?.themeName||"dark",[h,E]=useState(e),[C,F]=useState(false),[T,$]=useState(e?.subtasks||[]),[W,L]=useState(false),[G,ee]=useState(""),[he,ye]=useState(""),[Me,V]=useState("all"),[B,I]=useState(false),[R,M]=useState(false),[Y,K]=useState(false),[q,Ee]=useState(false),[we,Ue]=useState(false),[P,te]=useState(false),fe=useRef(null),Ie=useRef(null),Oe=useRef(null),Ke=useRef(null),ot=useRef(null),Se=useRef(null),St=useRef(null),Ze=useRef(null),Je=useRef(null),Ye=useRef(null),it=useRef(null),$t=useRef(null);useEffect(()=>{e&&!h?(E({...e}),$(e.subtasks||[])):e&&h&&e.id!==h.id&&(E({...e}),$(e.subtasks||[]));},[e,h]),useEffect(()=>{let D=X=>{let pe=X.target;Ke.current&&!Ke.current.contains(pe)&&I(false),ot.current&&!ot.current.contains(pe)&&M(false),Se.current&&!Se.current.contains(pe)&&K(false),St.current&&!St.current.contains(pe)&&Ee(false);};if(B||R||Y||q)return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[B,R,Y,q]),useEffect(()=>{if(!t)return;let D=X=>{let pe=X.target,Ne=pe.tagName==="INPUT"||pe.tagName==="TEXTAREA"||pe.isContentEditable;if(X.key==="Escape"){X.preventDefault(),B||R||Y||q||we||P?(I(false),M(false),K(false),Ee(false),Ue(false),te(false)):Ne||a();return}if(Ne&&X.key!=="Escape")return;let At=X.metaKey||X.ctrlKey;switch(X.key.toLowerCase()){case "s":X.preventDefault(),I(true);break;case "a":X.preventDefault(),K(true);break;case "p":X.preventDefault(),M(true);break;case "l":X.preventDefault(),Ee(true);break;case "d":At||(X.preventDefault(),Ue(true),setTimeout(()=>Ze.current?.focus(),0));break;case "e":At||(X.preventDefault(),te(true));break;case "i":X.preventDefault(),F(true),setTimeout(()=>Ie.current?.focus(),0);break;case "t":X.preventDefault(),L(true);break;case "c":X.preventDefault(),Oe.current?.focus();break}};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[t,a,B,R,Y,q,we,P]);let xe=useCallback(D=>{let X=D.currentTarget.textContent?.trim()||"";if(h&&X!==h.title){let pe={...h,title:X};E(pe),r?.(h.id,{title:X});}},[h,r]),O=useCallback(D=>{D.key==="Enter"&&(D.preventDefault(),D.currentTarget.blur()),D.key==="Escape"&&(D.preventDefault(),D.currentTarget.textContent=h?.title||"",D.currentTarget.blur());},[h]),Ce=useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),F(false);},[h,e,r]),Ve=useCallback(D=>{if(h){let X={...h,columnId:D};E(X),r?.(h.id,{columnId:D}),I(false);}},[h,r]),He=useCallback(D=>{if(h){let X={...h,priority:D};E(X),r?.(h.id,{priority:D}),M(false);}},[h,r]),xt=useCallback(D=>{if(h){let X=h.assignedUserIds||[],pe=X.includes(D)?X.filter(At=>At!==D):[...X,D],Ne={...h,assignedUserIds:pe};E(Ne),r?.(h.id,{assignedUserIds:pe});}},[h,r]),J=useCallback(D=>{if(h){let X=h.labels||[],pe=X.includes(D)?X.filter(At=>At!==D):[...X,D],Ne={...h,labels:pe};E(Ne),r?.(h.id,{labels:pe});}},[h,r]),Q=useCallback(D=>{if(h){let X=D.target.value,pe={...h,endDate:X};E(pe),r?.(h.id,{endDate:X}),Ue(false);}},[h,r]),ke=useCallback(D=>{if(h){let X={...h,estimatedTime:parseFloat(D)||0};E(X),r?.(h.id,{estimatedTime:parseFloat(D)||0});}},[h,r]),ge=useCallback(()=>{if(G.trim()&&h){let D={id:`subtask-${Date.now()}`,title:G.trim(),completed:false,createdAt:new Date},X=[...T,D];$(X),ee(""),L(false),g?.(h.id,X);}},[G,T,h,g]),ae=useCallback(D=>{let X=T.map(pe=>pe.id===D?{...pe,completed:!pe.completed,updatedAt:new Date}:pe);$(X),h&&g?.(h.id,X);},[T,h,g]),De=useCallback(D=>{let X=T.filter(pe=>pe.id!==D);$(X),h&&g?.(h.id,X);},[T,h,g]),me=useCallback(()=>{he.trim()&&h&&p&&(p(h.id,he.trim()),ye(""));},[he,h,p]),Te=useCallback(D=>{(D.metaKey||D.ctrlKey)&&D.key==="Enter"&&(D.preventDefault(),me());},[me]),ue=D=>jsx(sm,{remarkPlugins:[im],rehypePlugins:[lm],components:{a:({node:X,...pe})=>jsx("a",{...pe,target:"_blank",rel:"noopener noreferrer"})},children:D}),Ae=c.filter(D=>Me==="comments"?D.type.includes("COMMENT"):Me==="history"?!D.type.includes("COMMENT"):true);if(!t||!e)return null;let ce=h||e,Le=s.filter(D=>ce.assignedUserIds?.includes(D.id)),U=T.filter(D=>D.completed).length;return jsx(Qe,{children:jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxs("div",{className:"modal-v2-container",onClick:D=>D.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:fe,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:xe,onKeyDown:O,children:ce.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:Ke,children:[jsxs("button",{ref:Je,className:"modal-v2-field",onClick:()=>I(!B),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:ce.columnId||"No status"})]}),jsx(ao,{triggerRef:Je,isOpen:B,onClose:()=>I(false),width:250,estimatedHeight:200,children:(v.length>0?v:cm.map(D=>({id:D,title:D}))).map(D=>jsx("button",{className:`modal-v2-popover-item ${ce.columnId===D.id?"active":""}`,onClick:()=>Ve(D.id),children:D.title},D.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Se,children:[jsxs("button",{ref:Ye,className:"modal-v2-field",onClick:()=>K(!Y),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:Le.length>0?jsx("div",{className:"modal-v2-avatars",children:Le.map(D=>jsx("div",{className:"modal-v2-avatar",style:{background:D.color},title:D.name,children:D.initials},D.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(ao,{triggerRef:Ye,isOpen:Y,onClose:()=>K(false),width:280,estimatedHeight:300,children:s.map(D=>jsxs("button",{className:`modal-v2-popover-item ${ce.assignedUserIds?.includes(D.id)?"active":""}`,onClick:()=>xt(D.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:D.color},children:D.initials}),D.name,ce.assignedUserIds?.includes(D.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},D.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:ot,children:[jsxs("button",{ref:it,className:"modal-v2-field",onClick:()=>M(!R),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:ce.priority||"None"})]}),jsxs(ao,{triggerRef:it,isOpen:R,onClose:()=>M(false),width:180,estimatedHeight:220,children:[dm.map(D=>jsx("button",{className:`modal-v2-popover-item priority-${D.toLowerCase()} ${ce.priority===D?"active":""}`,onClick:()=>He(D),children:D},D)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>He(""),children:"None"})]})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:St,children:[jsxs("button",{ref:$t,className:"modal-v2-field",onClick:()=>Ee(!q),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:ce.labels&&ce.labels.length>0?jsx("span",{children:ce.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(ao,{triggerRef:$t,isOpen:q,onClose:()=>Ee(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(D=>jsxs("button",{className:`modal-v2-popover-item ${ce.labels?.includes(D)?"active":""}`,onClick:()=>J(D),children:[D,ce.labels?.includes(D)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},D))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{Ue(!we),setTimeout(()=>Ze.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:ce.endDate?new Date(ce.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Ze,type:"date",value:typeof ce.endDate=="string"?ce.endDate.split("T")[0]:ce.endDate?(()=>{let D=new Date(ce.endDate),X=D.getUTCFullYear(),pe=String(D.getUTCMonth()+1).padStart(2,"0"),Ne=String(D.getUTCDate()).padStart(2,"0");return `${X}-${pe}-${Ne}`})():"",onChange:Q,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>te(!P),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:ce.estimatedTime?`${ce.estimatedTime}h`:"Not set"})]}),P&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:ce.estimatedTime||"",onChange:D=>ke(D.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>te(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),C?jsx("textarea",{className:"modal-v2-textarea",value:ce.description||"",onChange:D=>{if(h){let X={...h,description:D.target.value};E(X);}},onBlur:Ce,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>F(true),children:ce.description?jsx("div",{className:"modal-v2-markdown",children:ue(ce.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),T.length>0&&jsxs("span",{className:"modal-v2-count",children:[U,"/",T.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>L(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[T.map(D=>jsxs("div",{className:`modal-v2-subtask ${D.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>ae(D.id),children:D.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:D.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>De(D.id),children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},D.id)),W&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:G,onChange:D=>ee(D.target.value),onKeyDown:D=>{D.key==="Enter"&&ge(),D.key==="Escape"&&(L(false),ee(""));},onBlur:ge,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${Me==="all"?"active":""}`,onClick:()=>V("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${Me==="comments"?"active":""}`,onClick:()=>V("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${Me==="history"?"active":""}`,onClick:()=>V("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[m&&jsx("div",{className:"modal-v2-avatar",style:{background:m.color},children:m.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Oe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:he,onChange:D=>ye(D.target.value),onKeyDown:Te,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:me,disabled:!he.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Ae.map(D=>{let X=s.find(Ne=>Ne.id===D.userId);if(D.type.includes("COMMENT")){let Ne=d.find(At=>At.id===D.metadata?.commentId);return Ne?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[X&&jsx("div",{className:"modal-v2-avatar",style:{background:X.color},children:X.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:X?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(D.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Ne.content})]})]},D.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[D.type.includes("CREATED")&&"\u2795",D.type.includes("UPDATED")&&"\u270F\uFE0F",D.type.includes("MOVED")&&"\u27A1\uFE0F",D.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",D.type.includes("ASSIGNED")&&"\u{1F464}",D.type.includes("PRIORITY")&&"\u{1F3AF}",D.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:X?.name||"Unknown"})," ",D.type.replace(/_/g," ").toLowerCase(),D.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:D.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(D.timestamp).toLocaleString()})]})]},D.id)}),Ae.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function vm({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function Jn({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(d=>({...d,average:d.average??e.reduce((c,p)=>c+p.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(vm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((d,c)=>d+c.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((d,c)=>d+c.completed,0)/e.length).toFixed(1)})]}),o&&e.some(d=>d.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((d,c)=>d+(c.planned||0),0)})]})]})]})}function Em({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function Zn({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),d=e[e.length-1]?.remaining||0,c=e[e.length-1]?.ideal||0,p=s>0?(s-d)/s*100:0,n=d<=c;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Em,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:p>=50?"#10B981":"#F59E0B"},children:[p.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:d})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Om={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Dl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function $m({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let d=r+(o-r)*.5,c=e+d*Math.cos(-a*(Math.PI/180)),p=t+d*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:c,y:p,fill:"white",textAnchor:c>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Nl({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[o,"%"]})]})]})}function Qn({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((p,n)=>p+n.value,0),d=e.map(p=>({...p,totalValue:s,color:p.color||Om[p.name]||Dl[e.indexOf(p)%Dl.length]})),c=d.map(p=>p.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:d,cx:"50%",cy:"50%",labelLine:false,label:o?$m:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:d.map((p,n)=>jsx(Cell,{fill:c[n]},`cell-${n}`))}),jsx(Tooltip,{content:jsx(Nl,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(p,n)=>{let m=n.payload,l=s>0?(m.value/s*100).toFixed(0):"0";return `${p} (${m.value} - ${l}%)`}})]}):jsxs(BarChart,{data:d,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Nl,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:d.map((p,n)=>jsx(Cell,{fill:c[n]},`cell-${n}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((p,n)=>n.value>p.value?n:p).name})]})]})]})}var $o=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[d,c]=useState(false),[p,n]=useState(false),[m,l]=useState(false),[i,u]=useState(false);if(e.length===0)return null;let v=e.map(k=>k.id),f=k=>{r.onBulkUpdate?.(v,{priority:k}),c(false);},y=k=>{r.onBulkMove?.(v,k),n(false),a();},x=k=>{r.onBulkUpdate?.(v,{assignedUserIds:k}),l(false);},b=k=>{let N=new Set;e.forEach(E=>{E.labels?.forEach(C=>N.add(C));});let h=Array.from(new Set([...N,...k]));r.onBulkUpdate?.(v,{labels:h}),u(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!d),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(k=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(k),children:[jsx("span",{className:w("asakaa-priority-dot",k==="LOW"&&"bg-asakaa-priority-low",k==="MEDIUM"&&"bg-asakaa-priority-medium",k==="HIGH"&&"bg-asakaa-priority-high",k==="URGENT"&&"bg-asakaa-priority-urgent")}),k]},k))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!p),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(k=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(k.id),children:k.title},k.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!m),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(k=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([k.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:k.color},children:k.initials}),k.name]},k.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!i),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(k=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([k]),children:k},k))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});$o.displayName="BulkOperationsToolbar";function Hm(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,d,c,p,n;switch(t){case "assignee":let m=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);m.length>0?m.forEach(u=>{let v=a?.find(f=>f.id===u);d=`assignee-${u}`,c=v?.name||`User ${u}`,p=v?.color,n=v?.avatar,r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:p,icon:n}),r.get(d).cardIds.push(o.id);}):(d="assignee-unassigned",c="Unassigned",p="#6b7280",n="\u{1F464}",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:p,icon:n}),r.get(d).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",d=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];c=i.title,p=i.color,r.has(d)||r.set(d,{id:d,title:c,groupValue:s,cardIds:[],color:p}),r.get(d).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(u=>{d=`label-${u}`,c=u,p="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:u,cardIds:[],color:p}),r.get(d).cardIds.push(o.id);}):(d="label-none",c="No Labels",p="#6b7280",r.has(d)||r.set(d,{id:d,title:c,groupValue:null,cardIds:[],color:p}),r.get(d).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function es({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,d]=useState(new Set),c=useMemo(()=>Hm(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),p=useCallback(n=>{d(m=>{let l=new Set(m);return l.has(n)?l.delete(n):l.add(n),l});},[]);return t.groupBy==="none"||c.length===0?jsx(Xa,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:w("asakaa-swimlane-view",o),children:[c.map(n=>{let m=s.has(n.id),l=e.cards.filter(u=>n.cardIds.includes(u.id)),i={...e,cards:l};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&p(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":m?"Expand lane":"Collapse lane",children:m?"\u25B6":"\u25BC"})]}),!m&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Xa,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),c.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ts=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function as({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),d=useRef(null),c=ts.find(n=>n.value===e)||ts[0];useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&d.current&&!d.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);};return jsxs("div",{className:w("relative inline-block",a),children:[jsxs("button",{ref:d,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:c.icon}),jsx("span",{children:c.label}),jsx("svg",{className:w("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:ts.map(n=>jsxs("button",{onClick:()=>p(n.value),className:w("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var ro=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function jm(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,d=o.shift?e.shiftKey:!e.shiftKey,c=o.alt?e.altKey:!e.altKey,p=o.meta?e.metaKey:true;return s&&d&&c&&p}function Al(e={}){let{shortcuts:t=ro,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let d=useCallback(p=>{o.current=[...o.current,p];},[]),c=useCallback(p=>{o.current=o.current.filter(n=>n.action!==p);},[]);return useEffect(()=>{function p(n){if(!s.current)return;let m=n.target;if(!((m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let l of o.current)if(jm(n,l)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:l.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[r]),{registerShortcut:d,unregisterShortcut:c,isEnabled:a}}function Ym(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function qm(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Xm(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=qm(e),r=t?Ym(t):"";return a?`${a} + ${r}`:r}function Jm(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function rs({shortcuts:e=ro,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function c(p){p.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t,a]),!o||!t)return null;let d=Jm(e);return jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(d).map(([c,p])=>p.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),c]}),jsx("div",{className:"space-y-3",children:p.map(n=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsx("span",{className:"text-sm text-white/80",children:n.description}),jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:Xm(n)})]},n.action))})]},c))})}),jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var os=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
1
|
+
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useEffect,useCallback,useMemo,useImperativeHandle,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import Pd from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {CheckCircle2,PlayCircle,Circle,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,X,AlertCircle,CircleDot,ChevronDown,Check,Flag,Users,Calendar,ChevronLeft,Clock,Milestone,Rows3,FileImage,FileText,FileSpreadsheet,FileJson,FolderKanban,Download,GripVertical,Tag,List,Search,CalendarDays,User,Sparkles,Maximize2,MoreHorizontal,ListChecks,Upload,MessageSquare}from'lucide-react';import {AnimatePresence,motion}from'framer-motion';import {Command}from'cmdk';import wm from'react-markdown';import Cm from'remark-gfm';import Tm from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart,Bar}from'recharts';var Eo=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Po=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [Po.Translate.toString(e),Po.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function C(...e){return twMerge(clsx(e))}function Mo(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function tp(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function Mn(e,t){return e.length===0?1e3:t===0?Mo(null,e[0].position):t>=e.length?Mo(e[e.length-1].position,null):Mo(e[t-1].position,e[t].position)}function Fi(e,t=100){return e>t}var ap=e=>{if(e.message.includes("network")||e.message.includes("fetch"))return true;if("status"in e){let t=e.status;return t>=500||t===429}return false};function rp(e,t,a,r){let o=t*Math.pow(a,e-1),s=o*.2*Math.random();return Math.min(o+s,r)}async function Ao(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:l=ap,onRetry:p}=t,m,n=0;for(let u=1;u<=a;u++){n=u;try{return {data:await e(),attempts:n,success:!0}}catch(d){if(m=d,u===a||!l(m,u))return {error:m,attempts:n,success:false};let c=rp(u,r,o,s);if(p)try{p(m,u,c);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,c));}}return {error:m||new Error("Unknown error"),attempts:n,success:false}}function op(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(o){if(a=o,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function np(e,t={}){return async(...a)=>Ao(()=>e(...a),t)}var An=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var Bi=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(Bi||{}),dr=class dr{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...l}=t,p=`[${a}] [${r}] [${s}]`,m=Object.keys(l).length>0;switch(r){case "DEBUG":console.debug(p,o,m?l:"");break;case "INFO":console.info(p,o,m?l:"");break;case "WARN":console.warn(p,o,m?l:"");break;case "ERROR":console.error(p,o,m?l:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...dr.globalOptions};}static configure(t){dr.globalOptions={...dr.globalOptions,...t};}child(t){return new dr({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Io((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Io(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Bi[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};dr.globalOptions={};var In=dr,Io=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},Ri=new In;function ip(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function lp(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let l=e.columns.find(p=>p.id===s.columnId);return [s.id,Ln(s.title),Ln(s.description||""),Ln(l?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function dp(e,t,a){let r=t;if(!r){let l=document.querySelector(".asakaa-board");l&&(r=l.parentElement||l);}if(r)try{let l=await Pd(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),p=l.toDataURL("image/png"),m=297,n=210,u=l.width/l.height,d=m-20,i=d/u;i>n-20&&(i=n-20,d=i*u);let c=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});c.setFontSize(16),c.setTextColor(255,255,255),c.setFillColor(10,10,10),c.rect(0,0,m,15,"F"),c.text(e.title||"Kanban Board",10,10);let v=(m-d)/2;return c.addImage(p,"PNG",v,20,d,i),c}catch(l){console.error("Error capturing board:",l);}let o=new jsPDF,s=20;return o.setFontSize(20),o.text(e.title||"Kanban Board",20,s),s+=10,o.setFontSize(10),o.setTextColor(128,128,128),o.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,o.setTextColor(0,0,0),e.columns.forEach(l=>{let p=e.cards.filter(m=>m.columnId===l.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(l.title,20,s),s+=8,p.length===0?(o.setFontSize(10),o.setFont("helvetica","italic"),o.setTextColor(128,128,128),o.text("No cards in this column",20,s),o.setTextColor(0,0,0),s+=10):p.forEach(m=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(m.title,25,s),s+=6,m.description){o.setFontSize(9),o.setFont("helvetica","normal");let u=o.splitTextToSize(m.description,160);o.text(u,25,s),s+=u.length*5;}let n=[];if(m.priority&&n.push(`Priority: ${m.priority}`),m.labels&&m.labels.length>0&&n.push(`Labels: ${m.labels.join(", ")}`),m.assignedUserIds&&m.assignedUserIds.length>0&&n.push(`Assigned: ${m.assignedUserIds.length} user(s)`),m.startDate||m.endDate){let u=[];m.startDate&&u.push(`Start: ${m.startDate}`),m.endDate&&u.push(`End: ${m.endDate}`),n.push(u.join(" \u2192 "));}n.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(n.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function Ln(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function $i(e,t,a,r){switch(t){case "json":return ip(e,r);case "csv":return lp(e);case "pdf":return await dp(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function zi(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,l={json:"application/json",csv:"text/csv",pdf:"application/pdf"},p=new Blob([e],{type:l[t]}),m=URL.createObjectURL(p),n=document.createElement("a");n.href=m,n.download=s,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(m);}function cp(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function pp(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=Ui(t[0]),r=[],o=new Map,s=[];for(let l=1;l<t.length;l++)try{let p=Ui(t[l]||"");if(p.length>a.length){s.push(`Line ${l+1}: Too many columns`);continue}if(a.length-p.length>3){s.push(`Line ${l+1}: Column count mismatch (expected ${a.length}, got ${p.length})`);continue}for(;p.length<a.length;)p.push("");let n={};a.forEach((c,v)=>{n[c]=p[v]||"";});let u=n.Column||"Unnamed";o.has(u)||o.set(u,{id:`col-${o.size+1}`,title:u,position:o.size+1,cardIds:[]});let d=o.get(u),i={id:n["Card ID"]||`card-${l}`,title:n.Title||"Untitled",description:n.Description?n.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:n.Priority||void 0,labels:n.Labels?n.Labels.split(";").filter(Boolean):void 0,assignedUserIds:n["Assigned Users"]?n["Assigned Users"].split(";").filter(Boolean):void 0,startDate:n["Start Date"]?n["Start Date"]:void 0,endDate:n["End Date"]?n["End Date"]:void 0,createdAt:n["Created At"]?n["Created At"]:void 0,updatedAt:n["Updated At"]?n["Updated At"]:void 0};r.push(i),d.cardIds.push(i.id);}catch(p){s.push(`Line ${l+1}: ${p instanceof Error?p.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:o.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function Ui(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],l=e[o+1];s==='"'&&r&&l==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Wi(e,t){switch(t){case "json":return cp(e);case "csv":return pp(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Gi(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=o=>{o.target?.result?t(o.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var Fn=createContext(null);function Hi(){return useContext(Fn)}var _i=createContext(null);function Vi({children:e,themeName:t}){return jsx(_i.Provider,{value:{themeName:t},children:e})}function Pr(){return useContext(_i)}function at({children:e,container:t}){let[a,r]=useState(false),o=Hi(),s=Pr();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let l=t||(typeof document<"u"?document.body:null);if(!l)return null;if(o){let{theme:p,themeName:m}=o,n={"--asakaa-color-background-primary":p.bgPrimary,"--asakaa-color-background-secondary":p.bgSecondary,"--asakaa-color-background-card":p.bgGrid,"--asakaa-color-background-hover":p.hoverBg,"--asakaa-color-text-primary":p.textPrimary,"--asakaa-color-text-secondary":p.textSecondary,"--asakaa-color-text-tertiary":p.textTertiary,"--asakaa-color-text-inverse":p.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":p.border,"--asakaa-color-border-hover":p.borderLight,"--asakaa-color-border-subtle":p.borderLight,"--asakaa-color-interactive-primary":p.accent,"--asakaa-color-interactive-primaryHover":p.accentHover,"--asakaa-color-interactive-primaryBorder":`${p.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${p.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${p.accent}33`,"--asakaa-color-status-success":p.statusCompleted,"--asakaa-color-status-warning":p.milestone,"--asakaa-color-status-error":p.criticalPath,"--asakaa-color-danger":p.criticalPath,"--asakaa-color-danger-border":`${p.criticalPath}4D`,"--asakaa-color-danger-background":`${p.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${p.criticalPath}26`};return createPortal(jsx("div",{"data-theme":m,"data-gantt-portal":"true",style:n,children:e}),l)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),l):createPortal(e,l)}var Xi={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},vp="#BDC3C7",xp=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function cr({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,l]=useState({top:0,left:0}),p=useRef(null),m=useRef(null),n=()=>{if(!m.current)return;let c=m.current.getBoundingClientRect(),v=window.innerHeight,f=window.innerWidth,y=160,x=220,b=4,g=c.right-y;g<10&&(g=c.left),g+y>f-10&&(g=f-y-10);let w=v-c.bottom,T=c.top,k;w>=x+b?k=c.bottom+b:T>=x+b?k=c.top-x-b:k=w>=T?c.bottom+b:Math.max(10,c.top-x-b),l({top:k,left:g}),o(true);};useEffect(()=>{let c=v=>{p.current&&!p.current.contains(v.target)&&!m.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]),useEffect(()=>{let c=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[r]);let u=c=>{t(c),o(false);},d=e?Xi[e]:null,i=d?.color||vp;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:m,onClick:()=>r?o(false):n(),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:e?`${i}10`:"transparent",boxShadow:e?`0 0 0 2px ${i}30 inset`:"none"},title:d?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:i,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:i,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(at,{children:jsxs("div",{ref:p,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(Xi).map(([c,v])=>jsxs("button",{onClick:()=>u(c),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:v.color,background:"transparent"},onMouseEnter:f=>{f.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:f=>{f.currentTarget.style.background="transparent";},children:[jsx(xp,{color:v.color}),jsx("span",{className:"font-semibold text-sm",children:v.label}),e===c&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},c)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:c=>{c.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:c=>{c.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var kp=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function qr({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[l,p]=useState({top:0,left:0}),m=useRef(null),n=useRef(null),i=(Pr()?.themeName||"dark")==="dark",c=()=>{if(!n.current)return;let g=n.current.getBoundingClientRect(),w=window.innerHeight,T=window.innerWidth,k=320,N=380,h=4,M=g.left;M+k>T-10&&(M=T-k-10),M<10&&(M=10);let D=w-g.bottom,$=g.top,W;D>=N+h?W=g.bottom+h:$>=N+h?W=g.top-N-h:W=D>=$?g.bottom+h:Math.max(10,g.top-N-h),p({top:W,left:M}),s(true);};useEffect(()=>{let g=w=>{m.current&&!m.current.contains(w.target)&&!n.current?.contains(w.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),useEffect(()=>{let g=w=>{w.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let v=g=>{let w=new Date,T=M=>{let D=M.getFullYear(),$=String(M.getMonth()+1).padStart(2,"0"),W=String(M.getDate()).padStart(2,"0");return `${D}-${$}-${W}`},k=T(w),N=new Date(w);N.setDate(N.getDate()+g);let h=T(N);a(k,h),s(false);},f=()=>{if(!e||!t)return "Set date";let g=N=>{if(N instanceof Date)return N;if(typeof N!="string"||!N.match(/^\d{4}-\d{2}-\d{2}$/))return null;let h=N.split("-").map(Number);if(h.length!==3||h.some(W=>isNaN(W)))return null;let M=h[0],D=h[1],$=h[2];return M===void 0||D===void 0||$===void 0?null:new Date(M,D-1,$)},w=g(e),T=g(t);if(!w||!T||isNaN(w.getTime())||isNaN(T.getTime()))return "Set date";let k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${k[w.getMonth()]} ${w.getDate()} \u2013 ${k[T.getMonth()]} ${T.getDate()}`},y=e&&t,b=(()=>{if(!t)return false;let g=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),g<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:n,onClick:()=>o?s(false):c(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${b?"asakaa-date-overdue":"asakaa-date"}`,title:y?`${f()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:f()})]}),o&&jsx(at,{children:jsxs("div",{ref:m,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,background:i?"#1A1D25":"#FFFFFF",border:`1px solid ${i?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:i?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:kp.map(g=>jsx("button",{onClick:()=>v(g.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:g.label},g.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:i?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:g=>a(g.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:g=>a(e,g.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:i?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:i?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:i?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:i?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:g=>{g.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function mr({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,l]=useState(false),[p,m]=useState(""),[n,u]=useState({top:0,left:0}),d=useRef(null),i=useRef(null),c=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),g=window.innerHeight,w=window.innerWidth,T=300,k=380,N=4,h=b.right-T;h<10&&(h=b.left),h+T>w-10&&(h=w-T-10);let M=g-b.bottom,D=b.top,$;M>=k+N?$=b.bottom+N:D>=k+N?$=b.top-k-N:$=M>=D?b.bottom+N:Math.max(10,b.top-k-N),u({top:$,left:h}),l(true);};useEffect(()=>{let b=g=>{d.current&&!d.current.contains(g.target)&&!i.current?.contains(g.target)&&(l(false),m(""));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=g=>{g.key==="Escape"&&(l(false),m(""));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s]);let v=b=>{let g=e.some(w=>w.id===b.id);a(g?e.filter(w=>w.id!==b.id):[...e,b]);},f=t.filter(b=>b.name.toLowerCase().includes(p.toLowerCase())),y=e.slice(0,o),x=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:i,onClick:()=>s?l(false):c(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[y.map(b=>jsx("div",{className:"asakaa-avatar",title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"asakaa-avatar-img"}):b.initials},b.id)),x>0&&jsxs("div",{className:"asakaa-avatar",children:["+",x]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(at,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:p,onChange:b=>m(b.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:f.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):f.map(b=>{let g=e.some(w=>w.id===b.id);return jsxs("button",{onClick:()=>v(b),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:b.color,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:b.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:g?"#3b82f6":"transparent"},children:g?"\u2713":""})]},b.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),l(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Lo(e,t,a){let r=new Map;e.forEach(m=>{if(m.dependencies&&Array.isArray(m.dependencies)){let n=m.dependencies.map(u=>{if(typeof u=="string")return u;let d=u;return d.taskId||d.targetId||""}).filter(Boolean);r.set(m.id,n);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,l=new Set,p=m=>{if(!s.has(m)){s.add(m),l.add(m);let n=r.get(m)||[];for(let u of n){if(!s.has(u)&&p(u))return true;if(l.has(u))return true}}return l.delete(m),false};return p(a)}function Jr({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:l}){let[p,m]=useState(false),[n,u]=useState(""),[d,i]=useState(t.length>0),[c,v]=useState({top:0,left:0}),[f,y]=useState(null),x=useRef(null),b=useRef(null),g=()=>{if(!b.current)return;let h=b.current.getBoundingClientRect(),M=window.innerHeight,D=window.innerWidth,$=300,W=d?380:120,F=4,G=h.right-$;G<10&&(G=h.left),G+$>D-10&&(G=D-$-10);let Z=M-h.bottom,ve=h.top,ke;Z>=W+F?ke=h.bottom+F:ve>=W+F?ke=h.top-W-F:ke=Z>=ve?h.bottom+F:Math.max(10,h.top-W-F),v({top:ke,left:G}),m(true);};useEffect(()=>{if(!p||!b.current)return;let h=b.current.getBoundingClientRect(),M=window.innerHeight,D=window.innerWidth,$=300,W=d?380:120,F=4,G=h.right-$;G<10&&(G=h.left),G+$>D-10&&(G=D-$-10);let Z=M-h.bottom,ve=h.top,ke;Z>=W+F?ke=h.bottom+F:ve>=W+F?ke=h.top-W-F:ke=Z>=ve?h.bottom+F:Math.max(10,h.top-W-F),v({top:ke,left:G});},[d,p]),useEffect(()=>{let h=M=>{x.current&&!x.current.contains(M.target)&&!b.current?.contains(M.target)&&(m(false),u(""));};if(p)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[p]),useEffect(()=>{let h=M=>{M.key==="Escape"&&(m(false),u(""));};if(p)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[p]);let w=h=>{let M=t.includes(h),D=a.find($=>$.id===h);if(y(null),M){let $=t.filter(W=>W!==h);r($),$.length===0&&i(false);}else {if(s&&Lo(a,h,e)){let W=`Cannot add "${D?.title||h}" as dependency - would create circular reference`;y(W),l?.(h,D?.title||h),setTimeout(()=>y(null),3e3);return}r([...t,h]),i(true);}},T=()=>{let h=!d;i(h),h||r([]);},k=a.filter(h=>h.id!==e).filter(h=>h.title.toLowerCase().includes(n.toLowerCase())||h.id.toLowerCase().includes(n.toLowerCase())),N=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:b,onClick:()=>p?m(false):g(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:N,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:N},children:t.length})]}),p&&jsx(at,{children:jsxs("div",{ref:x,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${c.top}px`,left:`${c.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, 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)",zIndex:99999},children:[f&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:f})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:T,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:d?"#3b82f6":"transparent",borderColor:d?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:d&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),d&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:n,onChange:h=>u(h.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:k.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):k.map(h=>{let M=t.includes(h.id);return jsxs("button",{onClick:()=>w(h.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:D=>{D.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:D=>{D.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:M?"#3b82f6":"transparent",borderColor:M?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:M&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:h.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:h.id})]})]},h.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),i(false),m(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var za=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:l,availableUsers:p=[],allCards:m=[]})=>{let{attributes:n,listeners:u,setNodeRef:d,transform:i,transition:c,isDragging:v}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),f={transform:Po.Transform.toString(i),transition:c};if(t)return jsx("div",{ref:d,style:f,...n,...u,onClick:()=>a?.(e),children:t(e)});let y=p.filter(g=>e.assignedUserIds?.includes(g.id)),x=e.progress===100,b={...f,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:b,className:C("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...n,...u,onClick:g=>{g.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:g=>{g.currentTarget.style.display="none";}})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:x?"line-through":"none",opacity:x?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:g=>g.stopPropagation(),className:"priority-selector",children:jsx(cr,{priority:e.priority,onChange:g=>l?.(e.id,{priority:g})})}),jsx("div",{onClick:g=>g.stopPropagation(),className:"date-picker",children:jsx(qr,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(g,w)=>l?.(e.id,{startDate:g,endDate:w})})}),p.length>0&&jsx("div",{onClick:g=>g.stopPropagation(),className:"user-selector",children:jsx(mr,{assignedUsers:y,availableUsers:p,onChange:g=>l?.(e.id,{assignedUserIds:g.map(w=>w.id)})})}),jsx("div",{onClick:g=>g.stopPropagation(),className:"dependencies-selector",children:jsx(Jr,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(g=>typeof g=="string"?g:g.taskId):[],availableTasks:m,onChange:g=>l?.(e.id,{dependencies:g})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(g=>jsx("span",{className:"asakaa-label",children:g},g))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#3B82F6"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#3B82F6"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies));za.displayName="Card";var Fo={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"}},sl=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function il({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[l,p]=useState({top:0,left:0}),m=useRef(null),n=useRef(null),u=[...Object.entries(Fo).map(([y,x])=>({id:y,label:x.label,color:x.color,icon:x.icon})),...r.filter(y=>!Object.keys(Fo).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let y=Fo[e];if(y)return {...y,id:e};let x=r.find(b=>b.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Fo.todo,id:"todo"}},i=()=>{if(!n.current)return;let y=n.current.getBoundingClientRect(),x=window.innerHeight,b=window.innerWidth,g=180,w=280,T=4,k=y.right-g;k<10&&(k=y.left),k+g>b-10&&(k=b-g-10);let N=x-y.bottom,h=y.top,M;N>=w+T?M=y.bottom+T:h>=w+T?M=y.top-w-T:M=N>=h?y.bottom+T:Math.max(10,y.top-w-T),p({top:M,left:k}),s(true);};useEffect(()=>{let y=x=>{m.current&&!m.current.contains(x.target)&&!n.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[o]),useEffect(()=>{let y=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[o]);let c=y=>{t(y),s(false);},v=d(),f=v.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:n,onClick:()=>o?s(false):i(),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:`${f}10`,boxShadow:`0 0 0 2px ${f}30 inset`},title:v.label,children:jsx(sl,{icon:v.icon,color:f})}),o&&jsx(at,{children:jsxs("div",{ref:m,className:"status-selector-menu",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",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:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children: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"})}),jsx("div",{className:"py-1",children:u.map(y=>jsxs("button",{onClick:()=>c(y.id),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:y.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(sl,{icon:y.icon,color:y.color}),jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#3B82F6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}function ll({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,l]=useState(false),[p,m]=useState(false),[n,u]=useState(e),[d,i]=useState({top:0,left:0}),c=useRef(null),v=useRef(null),f=useRef(null);useEffect(()=>{if(s&&v.current){let g=v.current.getBoundingClientRect();i({top:g.bottom+window.scrollY+8,left:g.left+window.scrollX});}},[s]),useEffect(()=>{let g=w=>{c.current&&!c.current.contains(w.target)&&!v.current?.contains(w.target)&&(l(false),m(false));};if(s)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),useEffect(()=>{let g=w=>{w.key==="Escape"&&(l(false),m(false),u(e));};if(s)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[s,e]),useEffect(()=>{p&&f.current&&(f.current.focus(),f.current.select());},[p]);let y=()=>{m(true),u(e);},x=()=>{let g=n.trim();g&&g!==e&&t(g),m(false),l(false),u(e);},b=g=>{g.key==="Enter"?x():g.key==="Escape"&&(m(false),u(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>l(!s),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:"Column options","aria-label":"Column menu",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),s&&jsx(at,{children:jsx("div",{ref:c,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${d.top}px`,left:`${d.left}px`,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)",zIndex:99999},children:p?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:"Rename Column"}),jsx("input",{ref:f,type:"text",value:n,onChange:g=>u(g.target.value),onKeyDown:b,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-blue-500/50 transition-all",placeholder:"Column name",maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:"Rename"})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),l(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:"Delete"})]})]})]})})})]})}var Ir=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:l,onCardUpdate:p,availableUsers:m,allCards:n,enableVirtualization:u,cardHeight:d=120,isCollapsed:i,onToggleCollapse:c,onColumnRename:v,onColumnDelete:f,isDeletable:y=false,className:x})=>{let{setNodeRef:b,isOver:g}=useDroppable({id:e.id,data:{type:"column",column:e}}),w=useRef(null),T=u??Fi(t.length),k=useVirtualizer({count:t.length,getScrollElement:()=>w.current,estimateSize:()=>d,enabled:T});if(a)return jsx("div",{ref:b,className:x,children:a(e,t)});let h=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let $=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:$}:$>=80?{state:"warning",percentage:$}:$>=60?{state:"approaching",percentage:$}:{state:"ok",percentage:$}})(),M=h.state==="exceeded",D=()=>"asakaa-column-count";return jsxs("div",{ref:b,className:C("asakaa-column",g&&"ring-2 ring-asakaa-accent-blue",M&&"ring-2 ring-asakaa-accent-red",x),children:[o?o(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:C(D()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&h.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${h.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[h.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),h.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),h.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),h.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(v||f)&&jsx(ll,{columnTitle:e.title,onRename:$=>v?.(e.id,$),onDelete:f?()=>f(e.id):void 0,isDeletable:y}),c&&jsx("button",{onClick:c,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":i?"Expand column":"Collapse column",children:i?"\u25B6":"\u25BC"})]})]}),!i&&jsx("div",{ref:w,className:"asakaa-column-cards",style:{maxHeight:T?"600px":void 0},children:jsx(SortableContext,{items:t.map($=>$.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):T?jsx("div",{style:{height:`${k.getTotalSize()}px`,position:"relative"},children:k.getVirtualItems().map($=>{let W=t[$.index];return W?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${$.start}px)`},children:jsx(za,{card:W,render:r,onClick:l,onUpdate:p,availableUsers:m,allCards:n})},W.id):null})}):t.map($=>jsx(za,{card:$,render:r,onClick:l,onUpdate:p,availableUsers:m,allCards:n},$.id))})})]})});Ir.displayName="Column";function zn({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,l]=useState(e),p=useRef(null);useEffect(()=>{r&&p.current&&(p.current.focus(),p.current.select());},[r]);let m=()=>{let u=s.trim();u&&u!==e?t(u):l(e),o(false);},n=u=>{u.key==="Enter"?m():u.key==="Escape"&&(l(e),o(false));};return r?jsx("input",{ref:p,type:"text",value:s,onChange:u=>l(u.target.value),onBlur:m,onKeyDown:n,className:C("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:C("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Wn(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Za({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:l,style:p,isLoading:m,error:n,children:u}){let[d,i]=Wn(),c=o?.theme||"dark",f=c==="dark"||c==="neutral"?"dark":"",y=useCallback((D,$)=>{t.onCardUpdate?.(D,$);},[t]),x=useCallback((D,$)=>{t.onColumnUpdate?.(D,{title:$});},[t]),b=useCallback(D=>{t.onColumnDelete?.(D);},[t]),g=["todo","in-progress","completed"],w=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),T=useMemo(()=>{let D=new Map;return e.columns.forEach($=>{let W=$.cardIds.map(F=>e.cards.find(G=>G.id===F)).filter(F=>F!==void 0).sort((F,G)=>F.position-G.position);D.set($.id,W);}),D},[e.cards,e.columns]),k=useCallback(D=>{let{active:$}=D,W=e.cards.find(F=>F.id===$.id);W&&i({isDragging:true,draggedCardId:W.id,sourceColumnId:W.columnId,targetColumnId:W.columnId});},[e.cards,i]),N=useCallback(D=>{let{active:$,over:W}=D;if(!W||!e.cards.find(Z=>Z.id===$.id))return;let G=null;W.data.current?.type==="column"?G=W.id:W.data.current?.type==="card"&&(G=e.cards.find(ve=>ve.id===W.id)?.columnId||null),G&&G!==d.targetColumnId&&i({...d,targetColumnId:G});},[e.cards,d,i]),h=useCallback(async D=>{let{active:$,over:W}=D;if(i({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!W)return;let F=e.cards.find(ke=>ke.id===$.id);if(!F)return;let G,Z;if(W.data.current?.type==="column"){G=W.id;let ke=T.get(G)||[];Z=Mn(ke,0);}else {let ke=e.cards.find(B=>B.id===W.id);if(!ke)return;G=ke.columnId;let Me=T.get(G)||[],Oe=Me.findIndex(B=>B.id===W.id);Z=Mn(Me,Oe);}let ve=e.columns.find(ke=>ke.id===G);if(ve&&ve.wipLimit&&ve.wipLimitType==="hard"){let ke=T.get(G)||[];if(F.columnId!==G&&ke.length>=ve.wipLimit){t.onWipLimitExceeded?.(ve,F);return}}(F.columnId!==G||F.position!==Z)&&await t.onCardMove?.(F.id,G,Z);},[e.cards,e.columns,T,t,i]),M=useCallback(D=>{a?.(D);},[a]);return m?jsx("div",{className:C("asakaa-board",f,l),style:p,children:jsx(Vp,{columnCount:3})}):n?jsx("div",{className:C("asakaa-board",f,l),style:p,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof n=="string"?n:n.message})]})})}):jsx(Vi,{themeName:c,children:jsxs(DndContext,{sensors:w,collisionDetection:closestCorners,onDragStart:k,onDragOver:N,onDragEnd:h,children:[jsxs("div",{className:C("asakaa-board",f,l),style:p,"data-theme":c,children:[e.columns.sort((D,$)=>D.position-$.position).map(D=>{let $=T.get(D.id)||[],W=!g.includes(D.id);return jsx(Ir,{column:D,cards:$,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:M,onCardUpdate:y,onColumnRename:x,onColumnDelete:b,isDeletable:W,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},D.id)}),u]}),jsx(DragOverlay,{children:d.draggedCardId?jsx(za,{card:e.cards.find(D=>D.id===d.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]})})}function Vp({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var Xp={bgGrid:"#0F1117",bgSecondary:"#1A1D25",border:"rgba(255, 255, 255, 0.1)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"#E5E7EB",textSecondary:"#9CA3AF",textTertiary:"#6B7280",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.15)",hoverBg:"rgba(255, 255, 255, 0.05)"},Jp={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#3B82F6",accentLight:"rgba(59, 130, 246, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Zp={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},Qp={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function em({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,l]=useState(false),p=useRef(null);useEffect(()=>{let n=u=>{p.current&&!p.current.contains(u.target)&&l(false);};return s&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[s]);let m=n=>{t(n),l(false);};return jsxs("div",{ref:p,className:"relative",children:[jsxs(motion.button,{onClick:()=>l(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:o||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((n,u)=>n.position-u.position).map((n,u)=>jsxs(motion.button,{onClick:()=>m(n.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:n.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:n.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[n.cardIds.length," ",n.cardIds.length===1?"tarea":"tareas"]})]})]},n.id))]})})})]})}function tm({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,l]=useState(false),[p,m]=useState(null),n=useRef(null);if(useEffect(()=>{let c=v=>{n.current&&!n.current.contains(v.target)&&l(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]),!(a||r||o))return null;let d=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:o}].filter(c=>c.handler),i=async(c,v)=>{if(v){m(c);try{await v();}catch(f){console.error(`Export ${c} failed:`,f);}finally{m(null),l(false);}}};return jsxs("div",{ref:n,className:"relative",children:[jsxs(motion.button,{onClick:()=>l(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:d.map((c,v)=>jsxs(motion.button,{onClick:()=>i(c.id,c.handler),disabled:p!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<d.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:p===c.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):c.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:c.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:c.description})]})]},c.id))})})})]})}function am({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Hn({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:l,onExportJSON:p,onExportExcel:m,translations:n}){let u=r==="dark"?Xp:Jp,d={...o==="es"?Zp:Qp,...n},i=l||p||m;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:u.bgGrid,borderColor:u.border},children:jsxs("div",{className:"flex items-center gap-3",children:[i&&jsxs(Fragment,{children:[jsx(tm,{theme:u,t:d,onExportCSV:l,onExportJSON:p,onExportExcel:m}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:u.borderLight}})]}),t&&(s?jsx(em,{columns:e,onSelect:t,theme:u,t:d,createTaskLabel:a}):jsx(am,{onClick:()=>t(),label:a||d.newTask}))]})})}function Vn({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,l]=useState(false),[p,m]=useState(""),n=useCallback(()=>{let i=p.trim();i&&(e(i),m(""),l(false));},[p,e]),u=useCallback(i=>{i.key==="Enter"?(i.preventDefault(),n()):i.key==="Escape"&&(m(""),l(false));},[n]),d=useCallback(()=>{setTimeout(()=>{p.trim()||l(false);},150);},[p]);return s?jsx("div",{className:C("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:p,onChange:i=>m(i.target.value),onKeyDown:u,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:n,disabled:!p.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{m(""),l(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:C("asakaa-add-column",t),children:jsxs("button",{onClick:()=>l(true),disabled:o,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function jn({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:l=false,theme:p="dark",locale:m="es"}){let[n,u]=useState(false),[d,i]=useState(false),[c,v]=useState(""),[f,y]=useState([]),[x,b]=useState(""),[g,w]=useState(""),[T,k]=useState(""),[N,h]=useState(false),[M,D]=useState(false),[$,W]=useState(false),F=useRef(null),G=useRef(null),Z={placeholder:o||(m==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(m==="es"?"Agregar Tarea":"Add Task"),save:m==="es"?"Guardar":"Save",addAssignee:m==="es"?"Agregar asignado":"Add assignee",addDates:m==="es"?"Agregar fechas":"Add dates",addPriority:m==="es"?"Agregar prioridad":"Add priority",startDate:m==="es"?"Inicio":"Start",endDate:m==="es"?"Fin":"End",low:m==="es"?"Baja":"Low",medium:m==="es"?"Media":"Medium",high:m==="es"?"Alta":"High",urgent:m==="es"?"Urgente":"Urgent"},ve=useCallback(()=>{v(""),y([]),b(""),w(""),k(""),h(false),D(false),W(false),u(false);},[]);useEffect(()=>{n&&F.current&&F.current.focus();},[n]),useEffect(()=>{if(!n)return;let S=R=>{G.current&&!G.current.contains(R.target)&&(c.trim()||ve());};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[n,c,ve]);let ke=useCallback(async()=>{let S=c.trim();if(!(!S||d)){i(true);try{await t({name:S,columnId:e,assigneeIds:f.length>0?f:void 0,startDate:x?new Date(x):void 0,endDate:g?new Date(g):void 0,priority:T||void 0}),v(""),y([]),b(""),w(""),k(""),h(!1),D(!1),W(!1),F.current?.focus();}catch(R){console.error("Error creating card:",R);}finally{i(false);}}},[c,e,f,x,g,T,t,d]),Me=useCallback(S=>{S.key==="Enter"&&!S.shiftKey?(S.preventDefault(),ke()):S.key==="Escape"&&ve();},[ke,ve]),Oe=useCallback(S=>{y(R=>R.includes(S)?R.filter(P=>P!==S):[...R,S]);},[]),B=p==="dark";return n?jsxs("div",{ref:G,className:C("rounded-lg overflow-hidden shadow-lg",B?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:F,type:"text",value:c,onChange:S=>v(S.target.value),onKeyDown:Me,placeholder:Z.placeholder,disabled:d,className:C("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",B?"text-gray-100 placeholder-gray-500":"text-gray-800 placeholder-gray-400")}),jsxs("div",{className:"flex items-center gap-1 mt-3",children:[a.length>0&&jsxs("button",{onClick:()=>h(!N),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",N||f.length>0?"bg-emerald-500/20 text-emerald-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Z.addAssignee,children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),f.length>0&&jsx("span",{className:"ml-0.5",children:f.length})]}),jsx("button",{onClick:()=>D(!M),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",M||x||g?"bg-blue-500/20 text-blue-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Z.addDates,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}),jsx("button",{onClick:()=>W(!$),className:C("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",$||T?T==="urgent"?"bg-red-500/20 text-red-400":T==="high"?"bg-orange-500/20 text-orange-400":T==="medium"?"bg-yellow-500/20 text-yellow-400":T==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":B?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:Z.addPriority,children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]})}),jsx("div",{className:"flex-1"}),jsx("button",{onClick:ke,disabled:!c.trim()||d,className:C("px-3 py-1.5 rounded-md text-xs font-medium text-white transition-all","bg-emerald-500 hover:bg-emerald-600","disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-emerald-500"),type:"button",children:d?jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}):Z.save})]})]}),N&&a.length>0&&jsx("div",{className:C("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(S=>jsxs("button",{onClick:()=>Oe(S.id),className:C("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",f.includes(S.id)?"bg-emerald-500 text-white":B?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[S.avatar?jsx("img",{src:S.avatar,alt:S.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:C("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",f.includes(S.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:S.name.charAt(0).toUpperCase()}),jsx("span",{children:S.name.split(" ")[0]})]},S.id))})}),M&&jsx("div",{className:C("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:C("block text-[10px] uppercase tracking-wide mb-1",B?"text-gray-500":"text-gray-400"),children:Z.startDate}),jsx("input",{type:"date",value:x,onChange:S=>b(S.target.value),className:C("w-full px-2 py-1.5 rounded text-xs border",B?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:C("block text-[10px] uppercase tracking-wide mb-1",B?"text-gray-500":"text-gray-400"),children:Z.endDate}),jsx("input",{type:"date",value:g,onChange:S=>w(S.target.value),className:C("w-full px-2 py-1.5 rounded text-xs border",B?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),$&&jsx("div",{className:C("px-3 pb-3 pt-0","border-t",B?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(S=>jsx("button",{onClick:()=>k(T===S?"":S),className:C("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",T===S?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[S]} text-white`:B?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:Z[S]},S))})})]}):jsxs("button",{onClick:()=>u(true),disabled:l,className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",B?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",l&&"opacity-50 cursor-not-allowed",r),type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),jsx("span",{className:"text-sm font-medium",children:Z.buttonLabel})]})}var ao=class extends BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(Za,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let o=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,o?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(o=>`"${o}"`).join(",")).join(`
|
|
5
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((o,s)=>{r.toBlob(l=>{l?o(l):s(new Error("Failed to create PNG blob"));},"image/png");})}};function kl(e={}){return new ao(e)}var Lr=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:o,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),o)try{o(a,r);}catch(l){console.error("Error in error handler:",l);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:l}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:l?`Error in ${l}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):o}};function Kn(e,t){let a=r=>jsx(Lr,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function qn({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:l,onPredictRisks:p,onOpenAIUsage:m,shortcut:n="k",className:u=""}){let[d,i]=useState(false),[c,v]=useState(""),[f,y]=useState("home"),[x,b]=useState(""),[g,w]=useState("");useEffect(()=>{let h=M=>{(M.metaKey||M.ctrlKey)&&M.key===n&&(M.preventDefault(),i(D=>!D)),M.key==="Escape"&&(i(false),y("home"),v(""));};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]),useEffect(()=>{d||(y("home"),v(""),b(""),w(""));},[d]);let T=useCallback(()=>{i(false);},[]),k=useCallback(h=>{let[M,D]=h.split(":");switch(M){case "create-card":y("create-card");break;case "create-card-in":b(D||"");break;case "navigate":D?(a?.(D),T()):y("navigate");break;case "search":r?.(c),T();break;case "priority":y("priority");break;case "set-priority":g&&D&&(o?.(g,D),T());break;case "assign":y("assign");break;case "assign-user":g&&D&&(s?.(g,D),T());break;case "ai":y("ai");break;case "ai-generate-plan":l?.(),T();break;case "ai-predict-risks":p?.(),T();break;case "ai-usage":m?.(),T();break;case "back":y("home");break;}},[c,g,t,a,r,o,s,l,p,m,T]),N=useCallback(()=>{x&&c.trim()&&(t?.(x,c.trim()),T());},[x,c,t,T]);return d?jsx(at,{children:jsx("div",{className:"command-palette-overlay",onClick:T,children:jsx("div",{className:`command-palette ${u}`,onClick:h=>h.stopPropagation(),children:jsxs(Command,{value:c,onValueChange:v,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:f==="create-card"&&x?"Type card title and press Enter...":f==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:h=>{h.key==="Enter"&&f==="create-card"&&x&&N();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),f==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:k,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:k,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:k,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:k,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(h=>jsxs(Command.Item,{value:`navigate:${h.id}`,onSelect:k,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:h.priority==="URGENT"?"#EF4444":h.priority==="HIGH"?"#F59E0B":h.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:h.title}),h.labels&&h.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:h.labels.slice(0,2).map(M=>jsx("span",{className:"command-palette-item-label",children:M},M))})]},h.id))})]}),f==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(h=>jsxs(Command.Item,{value:`create-card-in:${h.id}`,onSelect:k,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:h.title}),jsxs("div",{className:"command-palette-item-count",children:[h.cardIds.length," cards"]})]},h.id))})]}),f==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(h=>{let M=e.columns.find(D=>D.id===h.columnId);return jsxs(Command.Item,{value:`navigate:${h.id}`,onSelect:k,className:"command-palette-item",keywords:[h.title,h.description||"",...h.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:h.priority==="URGENT"?"#EF4444":h.priority==="HIGH"?"#F59E0B":h.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:h.title}),jsx("div",{className:"command-palette-item-meta",children:M?.title})]}),h.labels&&h.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:h.labels.slice(0,2).map(D=>jsx("span",{className:"command-palette-item-label",children:D},D))})]},h.id)})})]}),f==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:k,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:k,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:k,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:k,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function dm(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function cm(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function pm(e){return e.startsWith("image/")}function oo({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[l,p]=useState(false),[m,n]=useState(false),[u,d]=useState(null),i=useRef(null),c=useCallback(k=>{let N=[],h=[];return e.length+k.length>s?(h.push(`Maximum ${s} files allowed`),{valid:N,errors:h}):(k.forEach(M=>{if(M.size/1048576>r){h.push(`${M.name} is too large (max ${r}MB)`);return}if(o&&!o.some($=>M.type.match($))){h.push(`${M.name} has invalid file type`);return}N.push(M);}),{valid:N,errors:h})},[e.length,s,r,o]),v=useCallback(async k=>{let{valid:N,errors:h}=c(k);if(h.length>0){d(h.join(", ")),setTimeout(()=>d(null),5e3);return}if(N.length!==0){n(true),d(null);try{await t?.(N);}catch(M){d(M instanceof Error?M.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{n(false);}}},[c,t]),f=useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(true);},[]),y=useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);},[]),x=useCallback(k=>{k.preventDefault(),k.stopPropagation();},[]),b=useCallback(k=>{k.preventDefault(),k.stopPropagation(),p(false);let N=Array.from(k.dataTransfer.files);v(N);},[v]),g=useCallback(k=>{let N=k.target.files?Array.from(k.target.files):[];v(N),i.current&&(i.current.value="");},[v]),w=useCallback(()=>{i.current?.click();},[]),T=useCallback(k=>{confirm("Are you sure you want to delete this attachment?")&&a?.(k);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${l?"dragging":""} ${m?"uploading":""}`,onDragEnter:f,onDragLeave:y,onDragOver:x,onDrop:b,onClick:w,children:[jsx("input",{ref:i,type:"file",multiple:true,onChange:g,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:m?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:l?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(k=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:pm(k.type)&&k.url?jsx("img",{src:k.thumbnailUrl||k.url,alt:k.name,className:"attachment-thumbnail"}):jsx("div",{className:"attachment-icon",children:cm(k.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:k.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:k.name,children:k.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:dm(k.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(k.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>T(k.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},k.id))})]})}function Jn({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:p=[],aiInsights:m=[],attachments:n=[],onAddComment:u,onDeleteComment:d,onUploadAttachments:i,onDeleteAttachment:c,onSuggestAssignee:v,onGenerateSubtasks:f,onEstimateEffort:y,currentUserId:x="user-1"}){let[b,g]=useState("details"),[w,T]=useState(false),[k,N]=useState({}),[h,M]=useState(""),[D,$]=useState(false),[W,F]=useState({});if(!t||!e)return null;let G=useCallback(()=>{T(false),N({}),g("details"),M(""),F({}),a();},[a]),Z=useCallback(()=>{r&&Object.keys(k).length>0&&(r(e.id,k),N({}),T(false));},[e.id,k,r]),ve=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),G());},[e.id,o,G]),ke=useCallback(()=>{u&&h.trim()&&(u(e.id,h.trim()),M(""));},[e.id,h,u]),Me=useCallback(async()=>{if(v){$(true);try{let P=await v(e);F(K=>({...K,assignees:P}));}catch(P){console.error("Failed to suggest assignee:",P);}finally{$(false);}}},[e,v]),Oe=useCallback(async()=>{if(f){$(true);try{let P=await f(e);F(K=>({...K,subtasks:P}));}catch(P){console.error("Failed to generate subtasks:",P);}finally{$(false);}}},[e,f]),B=useCallback(async()=>{if(y){$(true);try{let P=await y(e);F(K=>({...K,effort:P}));}catch(P){console.error("Failed to estimate effort:",P);}finally{$(false);}}},[e,y]),S={...e,...k},R=s.filter(P=>S.assignedUserIds?.includes(P.id));return jsx(at,{children:jsx("div",{className:"card-detail-overlay",onClick:G,children:jsxs("div",{className:"card-detail-modal",onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"card-detail-header",children:[jsxs("div",{className:"card-detail-header-left",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),w?jsx("input",{type:"text",value:k.title??S.title,onChange:P=>N({...k,title:P.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:S.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:Z,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{T(false),N({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>T(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:ve,className:"card-detail-btn card-detail-btn-danger",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]}),"Delete"]}),jsx("button",{onClick:G,className:"card-detail-btn-close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]}),jsxs("div",{className:"card-detail-tabs",children:[jsxs("button",{onClick:()=>g("details"),className:`card-detail-tab ${b==="details"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Details"]}),jsxs("button",{onClick:()=>g("comments"),className:`card-detail-tab ${b==="comments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),"Comments",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>g("activity"),className:`card-detail-tab ${b==="activity"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),"Activity",p.length>0&&jsx("span",{className:"card-detail-tab-badge",children:p.length})]}),jsxs("button",{onClick:()=>g("attachments"),className:`card-detail-tab ${b==="attachments"?"active":""}`,children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),"Attachments",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>g("ai"),className:`card-detail-tab ${b==="ai"?"active":""}`,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),"AI Insights",jsx("span",{className:"card-detail-tab-badge card-detail-tab-badge-ai",children:"AI"})]})]}),jsxs("div",{className:"card-detail-content",children:[b==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),w?jsx("textarea",{value:k.description??S.description??"",onChange:P=>N({...k,description:P.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:S.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:k.assignedUserIds??S.assignedUserIds??[],onChange:P=>{let K=Array.from(P.target.selectedOptions,te=>te.value);N({...k,assignedUserIds:K});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(P=>jsx("option",{value:P.id,children:P.name},P.id))}):jsx("div",{className:"card-detail-users",children:R.length>0?R.map(P=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:P.color},children:P.initials}),jsx("span",{children:P.name})]},P.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:k.priority??S.priority??"",onChange:P=>N({...k,priority:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},children:[jsx("option",{value:"",children:"None"}),jsx("option",{value:"LOW",children:"LOW"}),jsx("option",{value:"MEDIUM",children:"MEDIUM"}),jsx("option",{value:"HIGH",children:"HIGH"}),jsx("option",{value:"URGENT",children:"URGENT"})]}):jsxs("div",{className:"card-detail-priority",children:[jsx("div",{className:"card-detail-priority-dot",style:{background:S.priority==="URGENT"?"#EF4444":S.priority==="HIGH"?"#F59E0B":S.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:S.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:S.labels&&S.labels.length>0?S.labels.map(P=>jsx("span",{className:"card-detail-label-tag",children:P},P)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),w?jsx("input",{type:"date",value:k.startDate?new Date(k.startDate).toISOString().split("T")[0]:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:"",onChange:P=>N({...k,startDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:S.startDate?new Date(S.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:k.endDate?new Date(k.endDate).toISOString().split("T")[0]:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:"",onChange:P=>N({...k,endDate:P.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:S.endDate?new Date(S.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:k.estimatedTime??S.estimatedTime??"",onChange:P=>N({...k,estimatedTime:P.target.value?parseFloat(P.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:S.estimatedTime||"Not estimated"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Dependencies"}),jsx("div",{className:"card-detail-dependencies",children:S.dependencies&&S.dependencies.length>0?S.dependencies.map(P=>{let K=typeof P=="string"?P:P.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",K.slice(-4)]},K)}):jsx("span",{className:"card-detail-empty",children:"No dependencies"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Created"}),jsx("span",{className:"card-detail-text",children:S.createdAt?new Date(S.createdAt).toLocaleString():"Unknown"})]})]}),b==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:h,onChange:P=>M(P.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ke,disabled:!h.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:l.length>0?l.map(P=>{let K=s.find(te=>te.id===P.authorId);return jsxs("div",{className:"card-detail-comment",children:[jsxs("div",{className:"card-detail-comment-header",children:[jsxs("div",{className:"card-detail-comment-author",children:[K&&jsx("div",{className:"card-detail-user-avatar",style:{background:K.color},children:K.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:K?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(P.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(P.id),className:"card-detail-comment-delete",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]}),jsx("p",{className:"card-detail-comment-content",children:P.content})]},P.id)}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("p",{children:"No comments yet"}),jsx("span",{children:"Be the first to comment"})]})})]}),b==="activity"&&jsx("div",{className:"card-detail-activity",children:p.length>0?jsx("div",{className:"card-detail-activity-list",children:p.map(P=>{let K=s.find(te=>te.id===P.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[P.type.includes("CREATED")&&"\u2795",P.type.includes("UPDATED")&&"\u270F\uFE0F",P.type.includes("MOVED")&&"\u27A1\uFE0F",P.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",P.type.includes("COMMENT")&&"\u{1F4AC}",P.type.includes("ASSIGNED")&&"\u{1F464}",P.type.includes("PRIORITY")&&"\u{1F3AF}",P.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",P.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:K?.name||"Unknown"})," ",P.type.replace(/_/g," ").toLowerCase(),P.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:P.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(P.timestamp).toLocaleString()})]})]},P.id)})}):jsxs("div",{className:"card-detail-empty-state",children:[jsx("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:jsx("polyline",{points:"22 12 18 12 15 21 9 3 6 12 2 12"})}),jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})}),b==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(oo,{cardId:e.id,attachments:n,onUpload:i?P=>i(e.id,P):void 0,onDelete:c,currentUserId:x,maxSizeMB:10,maxFiles:20})}),b==="ai"&&jsxs("div",{className:"card-detail-ai",children:[jsxs("div",{className:"card-detail-ai-actions",children:[jsx("h3",{className:"card-detail-ai-heading",children:"AI-Powered Suggestions"}),jsxs("button",{onClick:Me,disabled:D||!v,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),"Suggest Best Assignee"]}),jsxs("button",{onClick:Oe,disabled:D||!f,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]}),"Generate Subtasks"]}),jsxs("button",{onClick:B,disabled:D||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),W.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),W.assignees.map((P,K)=>{let te=s.find(Y=>Y.id===P.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[te&&jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:te?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:P.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(P.confidence*100).toFixed(0),"%"]})]})]},K)})]}),W.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),W.subtasks.map((P,K)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:P.title}),P.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:P.description}),P.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",P.estimatedTime,"h"]})]},K))]}),W.effort&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Effort Estimate"}),jsxs("div",{className:"card-detail-ai-effort",children:[jsxs("div",{className:"card-detail-ai-effort-hours",children:[W.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(W.effort.confidence*100).toFixed(0),"%"]})]})]}),m.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),m.map(P=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${P.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:P.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:P.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:P.description}),P.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",P.suggestedAction]})]},P.id))]}),!W.assignees&&!W.subtasks&&!W.effort&&m.length===0&&jsxs("div",{className:"card-detail-empty-state",children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("p",{children:"AI Suggestions"}),jsx("span",{children:"Click a button above to get AI-powered insights"})]})]})]})]})})})}function no({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:l=""}){let[p,m]=useState({top:0,left:0}),n=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),i=window.innerHeight,c=window.innerWidth,v=4,f=d.left;f+o>c-10&&(f=c-o-10),f<10&&(f=10);let y=i-d.bottom,x=d.top,b;return y>=s+v?b=d.bottom+v:x>=s+v?b=d.top-s-v:y>=x?b=d.bottom+v:b=Math.max(10,d.top-s-v),{top:b,left:f}},[e,o,s]);return useEffect(()=>{t&&m(u());},[t,u]),useEffect(()=>{if(!t)return;let d=c=>{let v=c.target;n.current&&!n.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},i=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(i),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(at,{children:jsx("div",{ref:n,className:`smart-popover ${l}`,style:{position:"fixed",top:`${p.top}px`,left:`${p.left}px`,width:`${o}px`,maxHeight:"calc(100vh - 40px)",overflowY:"auto",zIndex:99999,padding:"6px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",borderRadius:"8px",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",animation:"popoverSlideIn 100ms ease-out"},children:r})}):null}var Wo=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Br({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:l=true}){let[p,m]=useState(false),[n,u]=useState(""),[d,i]=useState(false),[c,v]=useState(Wo[10]||"#3B82F6"),f=useRef(null),y=useRef(null),x=t.filter(N=>N.name.toLowerCase().includes(n.toLowerCase())),b=t.some(N=>N.name.toLowerCase()===n.toLowerCase());useEffect(()=>{let N=h=>{f.current&&!f.current.contains(h.target)&&(m(false),u(""),i(false));};if(p)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[p]),useEffect(()=>{p&&y.current&&y.current.focus();},[p]);let g=N=>{let h=e.some(M=>M.id===N.id);a(h?e.filter(M=>M.id!==N.id):[...e,N]);},w=async()=>{if(!(!r||!n.trim())){i(true);try{let N=await r(n.trim(),c);N&&(a([...e,N]),u(""),v(Wo[Math.floor(Math.random()*Wo.length)]||"#3B82F6"));}finally{i(false);}}},T=(N,h)=>{h.stopPropagation(),a(e.filter(M=>M.id!==N));},k={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:f,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!s&&m(!p),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:k,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Etiquetas"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),jsx(AnimatePresence,{children:p&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"absolute left-0 top-full mt-1.5 z-50 rounded-lg min-w-[240px]",style:{backgroundColor:o.bgPrimary,border:`1px solid ${o.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:o.border},children:jsx("input",{ref:y,type:"text",value:n,onChange:N=>u(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:o.bgSecondary,color:o.textPrimary,border:`1px solid ${o.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&n.trim()&&!b&&r&&w();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:o.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:o.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:h=>T(N.id,h),children:[N.name,jsx(X,{className:"w-3 h-3"})]},N.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:x.length>0?x.map(N=>{let h=e.some(M=>M.id===N.id);return jsxs("button",{type:"button",onClick:()=>g(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:h?`${N.color}15`:"transparent",color:o.textPrimary},onMouseEnter:M=>{h||(M.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:M=>{h||(M.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsx("span",{className:"flex-1 text-left",children:N.name}),h&&jsx(Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):n.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:o.textTertiary},children:"No hay etiquetas disponibles"})}),n.trim()&&!b&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:o.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:o.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Wo.map(N=>jsx("button",{type:"button",onClick:()=>v(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:c===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:w,disabled:d,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:c,color:"#FFFFFF",opacity:d?.7:1},children:[d?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',n.trim(),'"']})]})]})})]})}function Qn({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function El({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),o=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Qn,{tag:s,size:a},s.id)),o>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",o]})]})}var $e={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var Dm=["LOW","MEDIUM","HIGH","URGENT"],Nm=["todo","in-progress","review","done"];function ts({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:l=[],activities:p=[],onAddComment:m,onDeleteComment:n,currentUser:u,onAIGenerateDescription:d,onAICreateSubtasks:i,onAIFindSimilar:c,availableColumns:v=[],availableLabels:f=[],availableTags:y=[],onCreateTag:x,onUploadCoverImage:b,unsplashAccessKey:g,theme:w,onSubtasksChange:T}){let k=Pr(),N=w||k?.themeName||"dark",[h,M]=useState(e),[D,$]=useState(false),[W,F]=useState(e?.subtasks||[]),[G,Z]=useState(false),[ve,ke]=useState(""),[Me,Oe]=useState(""),[B,S]=useState("all"),[R,P]=useState(false),[K,te]=useState(false),[Y,ce]=useState(false),[pe,je]=useState(false),[me,qe]=useState(false),[L,re]=useState(false),Ne=useRef(null),Le=useRef(null),Be=useRef(null),Je=useRef(null),kt=useRef(null),xe=useRef(null),tt=useRef(null),Ze=useRef(null),st=useRef(null),Nt=useRef(null),be=useRef(null),O=useRef(null);useEffect(()=>{e&&!h?(M({...e}),F(e.subtasks||[])):e&&h&&e.id!==h.id&&(M({...e}),F(e.subtasks||[]));},[e,h]),useEffect(()=>{let A=ie=>{let Se=ie.target;Je.current&&!Je.current.contains(Se)&&P(false),kt.current&&!kt.current.contains(Se)&&te(false),xe.current&&!xe.current.contains(Se)&&ce(false),tt.current&&!tt.current.contains(Se)&&je(false);};if(R||K||Y||pe)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[R,K,Y,pe]),useEffect(()=>{if(!t)return;let A=ie=>{let Se=ie.target,et=Se.tagName==="INPUT"||Se.tagName==="TEXTAREA"||Se.isContentEditable;if(ie.key==="Escape"){ie.preventDefault(),R||K||Y||pe||me||L?(P(false),te(false),ce(false),je(false),qe(false),re(false)):et||a();return}if(et&&ie.key!=="Escape")return;let gt=ie.metaKey||ie.ctrlKey;switch(ie.key.toLowerCase()){case "s":ie.preventDefault(),P(true);break;case "a":ie.preventDefault(),ce(true);break;case "p":ie.preventDefault(),te(true);break;case "l":ie.preventDefault(),je(true);break;case "d":gt||(ie.preventDefault(),qe(true),setTimeout(()=>Ze.current?.focus(),0));break;case "e":gt||(ie.preventDefault(),re(true));break;case "i":ie.preventDefault(),$(true),setTimeout(()=>Le.current?.focus(),0);break;case "t":ie.preventDefault(),Z(true);break;case "c":ie.preventDefault(),Be.current?.focus();break}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,a,R,K,Y,pe,me,L]);let Ce=useCallback(A=>{let ie=A.currentTarget.textContent?.trim()||"";if(h&&ie!==h.title){let Se={...h,title:ie};M(Se),r?.(h.id,{title:ie});}},[h,r]),Ke=useCallback(A=>{A.key==="Enter"&&(A.preventDefault(),A.currentTarget.blur()),A.key==="Escape"&&(A.preventDefault(),A.currentTarget.textContent=h?.title||"",A.currentTarget.blur());},[h]),Ve=useCallback(()=>{h&&e&&h.description!==e.description&&r?.(h.id,{description:h.description}),$(false);},[h,e,r]),St=useCallback(A=>{if(h){let ie={...h,columnId:A};M(ie),r?.(h.id,{columnId:A}),P(false);}},[h,r]),q=useCallback(A=>{if(h){let ie={...h,priority:A};M(ie),r?.(h.id,{priority:A}),te(false);}},[h,r]),J=useCallback(A=>{if(h){let ie=h.assignedUserIds||[],Se=ie.includes(A)?ie.filter(gt=>gt!==A):[...ie,A],et={...h,assignedUserIds:Se};M(et),r?.(h.id,{assignedUserIds:Se});}},[h,r]),we=useCallback(A=>{if(h){let ie=h.labels||[],Se=ie.includes(A)?ie.filter(gt=>gt!==A):[...ie,A],et={...h,labels:Se};M(et),r?.(h.id,{labels:Se});}},[h,r]),he=useCallback(A=>{if(h){let ie={...h,tags:A};M(ie),r?.(h.id,{tags:A});}},[h,r]),Q=useCallback(A=>{if(h){let ie=A.target.value,Se={...h,endDate:ie};M(Se),r?.(h.id,{endDate:ie}),qe(false);}},[h,r]),De=useCallback(A=>{if(h){let ie={...h,estimatedTime:parseFloat(A)||0};M(ie),r?.(h.id,{estimatedTime:parseFloat(A)||0});}},[h,r]),ge=useCallback(()=>{if(ve.trim()&&h){let A={id:`subtask-${Date.now()}`,title:ve.trim(),completed:false,createdAt:new Date},ie=[...W,A];F(ie),ke(""),Z(false),T?.(h.id,ie);}},[ve,W,h,T]),Te=useCallback(A=>{let ie=W.map(Se=>Se.id===A?{...Se,completed:!Se.completed,updatedAt:new Date}:Se);F(ie),h&&T?.(h.id,ie);},[W,h,T]),ue=useCallback(A=>{let ie=W.filter(Se=>Se.id!==A);F(ie),h&&T?.(h.id,ie);},[W,h,T]),Pe=useCallback(()=>{Me.trim()&&h&&m&&(m(h.id,Me.trim()),Oe(""));},[Me,h,m]),Ae=useCallback(A=>{(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),Pe());},[Pe]),Fe=A=>jsx(wm,{remarkPlugins:[Cm],rehypePlugins:[Tm],components:{a:({node:ie,...Se})=>jsx("a",{...Se,target:"_blank",rel:"noopener noreferrer"})},children:A}),U=p.filter(A=>B==="comments"?A.type.includes("COMMENT"):B==="history"?!A.type.includes("COMMENT"):true);if(!t||!e)return null;let H=h||e,ot=s.filter(A=>H.assignedUserIds?.includes(A.id)),Ue=W.filter(A=>A.completed).length;return jsx(at,{children:jsx("div",{className:"modal-v2-backdrop",onClick:a,style:{position:"fixed",inset:"0",zIndex:9999,background:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxs("div",{className:"modal-v2-container",onClick:A=>A.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":N,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:Ne,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ce,onKeyDown:Ke,children:H.title}),jsxs("p",{className:"modal-v2-ai-prompt",children:[jsx("span",{className:"modal-v2-ai-icon",children:"\u2728"}),"Ask AI to write a description, create subtasks, or find similar tasks"]}),jsx("button",{className:"modal-v2-close",onClick:a,"aria-label":"Close",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxs("section",{className:"modal-v2-metadata",children:[jsxs("div",{className:"modal-v2-field-wrapper",ref:Je,children:[jsxs("button",{ref:st,className:"modal-v2-field",onClick:()=>P(!R),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]}),jsx("span",{children:"Status"}),jsx("kbd",{className:"modal-v2-shortcut",children:"S"})]}),jsx("div",{className:"modal-v2-field-value",children:H.columnId||"No status"})]}),jsx(no,{triggerRef:st,isOpen:R,onClose:()=>P(false),width:250,estimatedHeight:200,children:(v.length>0?v:Nm.map(A=>({id:A,title:A}))).map(A=>jsx("button",{className:`modal-v2-popover-item ${H.columnId===A.id?"active":""}`,onClick:()=>St(A.id),children:A.title},A.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:xe,children:[jsxs("button",{ref:Nt,className:"modal-v2-field",onClick:()=>ce(!Y),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 00-4-4H8a4 4 0 00-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsx("span",{children:"Assignees"}),jsx("kbd",{className:"modal-v2-shortcut",children:"A"})]}),jsx("div",{className:"modal-v2-field-value",children:ot.length>0?jsx("div",{className:"modal-v2-avatars",children:ot.map(A=>jsx("div",{className:"modal-v2-avatar",style:{background:A.color},title:A.name,children:A.initials},A.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(no,{triggerRef:Nt,isOpen:Y,onClose:()=>ce(false),width:280,estimatedHeight:300,children:s.map(A=>jsxs("button",{className:`modal-v2-popover-item ${H.assignedUserIds?.includes(A.id)?"active":""}`,onClick:()=>J(A.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:A.color},children:A.initials}),A.name,H.assignedUserIds?.includes(A.id)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},A.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:kt,children:[jsxs("button",{ref:be,className:"modal-v2-field",onClick:()=>te(!K),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Priority"}),jsx("kbd",{className:"modal-v2-shortcut",children:"P"})]}),jsx("div",{className:"modal-v2-field-value",children:H.priority||"None"})]}),jsxs(no,{triggerRef:be,isOpen:K,onClose:()=>te(false),width:180,estimatedHeight:220,children:[Dm.map(A=>jsx("button",{className:`modal-v2-popover-item priority-${A.toLowerCase()} ${H.priority===A?"active":""}`,onClick:()=>q(A),children:A},A)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>q(""),children:"None"})]})]}),y.length>0||x?jsx("div",{className:"modal-v2-field-wrapper",children:jsxs("div",{className:"modal-v2-field",style:{cursor:"default"},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Etiquetas"})]}),jsx("div",{className:"modal-v2-field-value",children:jsx(Br,{selectedTags:H.tags||[],availableTags:y,onChange:he,onCreateTag:x,theme:$e[N]||$e.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:tt,children:[jsxs("button",{ref:O,className:"modal-v2-field",onClick:()=>je(!pe),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20.59 13.41l-7.17 7.17a2 2 0 01-2.83 0L2 12V2h10l8.59 8.59a2 2 0 010 2.82z"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsx("span",{children:"Labels"}),jsx("kbd",{className:"modal-v2-shortcut",children:"L"})]}),jsx("div",{className:"modal-v2-field-value",children:H.labels&&H.labels.length>0?jsx("span",{children:H.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(no,{triggerRef:O,isOpen:pe,onClose:()=>je(false),width:220,estimatedHeight:200,children:(f.length>0?f:["Bug","Feature","Enhancement","Documentation"]).map(A=>jsxs("button",{className:`modal-v2-popover-item ${H.labels?.includes(A)?"active":""}`,onClick:()=>we(A),children:[A,H.labels?.includes(A)&&jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{marginLeft:"auto"},children:jsx("polyline",{points:"20 6 9 17 4 12"})})]},A))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{qe(!me),setTimeout(()=>Ze.current?.showPicker?.(),0);},children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),jsx("span",{children:"Due Date"}),jsx("kbd",{className:"modal-v2-shortcut",children:"D"})]}),jsx("div",{className:"modal-v2-field-value",children:H.endDate?new Date(H.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Ze,type:"date",value:typeof H.endDate=="string"?H.endDate.split("T")[0]:H.endDate?(()=>{let A=new Date(H.endDate),ie=A.getUTCFullYear(),Se=String(A.getUTCMonth()+1).padStart(2,"0"),et=String(A.getUTCDate()).padStart(2,"0");return `${ie}-${Se}-${et}`})():"",onChange:Q,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>re(!L),children:[jsxs("div",{className:"modal-v2-field-label",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsx("span",{children:"Estimated Time"}),jsx("kbd",{className:"modal-v2-shortcut",children:"E"})]}),jsx("div",{className:"modal-v2-field-value",children:H.estimatedTime?`${H.estimatedTime}h`:"Not set"})]}),L&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:H.estimatedTime||"",onChange:A=>De(A.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>re(false)})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),jsx("h2",{children:"Description"})]}),D?jsx("textarea",{className:"modal-v2-textarea",value:H.description||"",onChange:A=>{if(h){let ie={...h,description:A.target.value};M(ie);}},onBlur:Ve,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>$(true),children:H.description?jsx("div",{className:"modal-v2-markdown",children:Fe(H.description)}):jsxs("p",{className:"modal-v2-placeholder",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Add description..."]})})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M9 11l3 3L22 4"}),jsx("path",{d:"M21 12v7a2 2 0 01-2 2H5a2 2 0 01-2-2V5a2 2 0 012-2h11"})]}),jsx("h2",{children:"Subtasks"}),W.length>0&&jsxs("span",{className:"modal-v2-count",children:[Ue,"/",W.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Z(true),children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),"Add"]})]}),jsxs("div",{className:"modal-v2-subtasks",children:[W.map(A=>jsxs("div",{className:`modal-v2-subtask ${A.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Te(A.id),children:A.completed?jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M9 12l2 2 4-4",stroke:"white",strokeWidth:"2",fill:"none"})]}):jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("circle",{cx:"12",cy:"12",r:"10"})})}),jsx("span",{className:"modal-v2-subtask-title",children:A.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>ue(A.id),children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),jsx("path",{d:"M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2"})]})})]},A.id)),G&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:ve,onChange:A=>ke(A.target.value),onKeyDown:A=>{A.key==="Enter"&&ge(),A.key==="Escape"&&(Z(false),ke(""));},onBlur:ge,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),jsxs("section",{className:"modal-v2-section",children:[jsxs("div",{className:"modal-v2-section-header",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15a2 2 0 01-2 2H7l-4 4V5a2 2 0 012-2h14a2 2 0 012 2z"})}),jsx("h2",{children:"Activity"}),jsxs("div",{className:"modal-v2-filters",children:[jsx("button",{className:`modal-v2-filter ${B==="all"?"active":""}`,onClick:()=>S("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${B==="comments"?"active":""}`,onClick:()=>S("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${B==="history"?"active":""}`,onClick:()=>S("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Be,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Me,onChange:A=>Oe(A.target.value),onKeyDown:Ae,rows:1}),jsxs("div",{className:"modal-v2-comment-toolbar",children:[jsxs("div",{className:"modal-v2-toolbar-left",children:[jsx("button",{className:"modal-v2-toolbar-button",title:"Attach file",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Mention user",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"4"}),jsx("path",{d:"M16 8v5a3 3 0 006 0v-1a10 10 0 10-3.92 7.94"})]})}),jsx("button",{className:"modal-v2-toolbar-button",title:"Add emoji",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})]}),jsx("button",{className:"modal-v2-send-button",onClick:Pe,disabled:!Me.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[U.map(A=>{let ie=s.find(et=>et.id===A.userId);if(A.type.includes("COMMENT")){let et=l.find(gt=>gt.id===A.metadata?.commentId);return et?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ie&&jsx("div",{className:"modal-v2-avatar",style:{background:ie.color},children:ie.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:ie?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:et.content})]})]},A.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[A.type.includes("CREATED")&&"\u2795",A.type.includes("UPDATED")&&"\u270F\uFE0F",A.type.includes("MOVED")&&"\u27A1\uFE0F",A.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",A.type.includes("ASSIGNED")&&"\u{1F464}",A.type.includes("PRIORITY")&&"\u{1F3AF}",A.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:ie?.name||"Unknown"})," ",A.type.replace(/_/g," ").toLowerCase(),A.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:A.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(A.timestamp).toLocaleString()})]})]},A.id)}),U.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Bm({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function rs({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(l=>({...l,average:l.average??e.reduce((p,m)=>p+m.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Bm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),o&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#3B82F6",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#3B82F6",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((l,p)=>l+p.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((l,p)=>l+p.completed,0)/e.length).toFixed(1)})]}),o&&e.some(l=>l.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:e.reduce((l,p)=>l+(p.planned||0),0)})]})]})]})}function _m({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function os({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),l=e[e.length-1]?.remaining||0,p=e[e.length-1]?.ideal||0,m=s>0?(s-l)/s*100:0,n=l<=p;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(o?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(_m,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),o?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",fill:n?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:n?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:n?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:m>=50?"#10B981":"#F59E0B"},children:[m.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:n?"#10B981":"#EF4444"},children:l})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:n?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:n?"#10B981":"#EF4444"},children:n?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Qm={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},Bl=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function eu({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let l=r+(o-r)*.5,p=e+l*Math.cos(-a*(Math.PI/180)),m=t+l*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:p,y:m,fill:"white",textAnchor:p>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Rl({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,o=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[o,"%"]})]})]})}function ns({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((m,n)=>m+n.value,0),l=e.map(m=>({...m,totalValue:s,color:m.color||Qm[m.name]||Bl[e.indexOf(m)%Bl.length]})),p=l.map(m=>m.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:l,cx:"50%",cy:"50%",labelLine:false,label:o?eu:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:l.map((m,n)=>jsx(Cell,{fill:p[n]},`cell-${n}`))}),jsx(Tooltip,{content:jsx(Rl,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(m,n)=>{let u=n.payload,d=s>0?(u.value/s*100).toFixed(0):"0";return `${m} (${u.value} - ${d}%)`}})]}):jsxs(BarChart,{data:l,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Rl,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:l.map((m,n)=>jsx(Cell,{fill:p[n]},`cell-${n}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#3B82F6"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((m,n)=>n.value>m.value?n:m).name})]})]})]})}var Ho=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[l,p]=useState(false),[m,n]=useState(false),[u,d]=useState(false),[i,c]=useState(false);if(e.length===0)return null;let v=e.map(w=>w.id),f=w=>{r.onBulkUpdate?.(v,{priority:w}),p(false);},y=w=>{r.onBulkMove?.(v,w),n(false),a();},x=w=>{r.onBulkUpdate?.(v,{assignedUserIds:w}),d(false);},b=w=>{let T=new Set;e.forEach(N=>{N.labels?.forEach(h=>T.add(h));});let k=Array.from(new Set([...T,...w]));r.onBulkUpdate?.(v,{labels:k}),c(false);},g=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(v),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!l),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),l&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>f(w),children:[jsx("span",{className:C("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>n(!m),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),m&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>c(!i),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),i&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:g,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Ho.displayName="BulkOperationsToolbar";function nu(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,l,p,m,n;switch(t){case "assignee":let u=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);u.length>0?u.forEach(c=>{let v=a?.find(f=>f.id===c);l=`assignee-${c}`,p=v?.name||`User ${c}`,m=v?.color,n=v?.avatar,r.has(l)||r.set(l,{id:l,title:p,groupValue:c,cardIds:[],color:m,icon:n}),r.get(l).cardIds.push(o.id);}):(l="assignee-unassigned",p="Unassigned",m="#6b7280",n="\u{1F464}",r.has(l)||r.set(l,{id:l,title:p,groupValue:null,cardIds:[],color:m,icon:n}),r.get(l).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",l=`priority-${s}`;let i={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];p=i.title,m=i.color,r.has(l)||r.set(l,{id:l,title:p,groupValue:s,cardIds:[],color:m}),r.get(l).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(c=>{l=`label-${c}`,p=c,m="#6b7280",r.has(l)||r.set(l,{id:l,title:p,groupValue:c,cardIds:[],color:m}),r.get(l).cardIds.push(o.id);}):(l="label-none",p="No Labels",m="#6b7280",r.has(l)||r.set(l,{id:l,title:p,groupValue:null,cardIds:[],color:m}),r.get(l).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function ss({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,l]=useState(new Set),p=useMemo(()=>nu(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),m=useCallback(n=>{l(u=>{let d=new Set(u);return d.has(n)?d.delete(n):d.add(n),d});},[]);return t.groupBy==="none"||p.length===0?jsx(Za,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:C("asakaa-swimlane-view",o),children:[p.map(n=>{let u=s.has(n.id),d=e.cards.filter(c=>n.cardIds.includes(c.id)),i={...e,cards:d};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&m(n.id),style:{borderLeft:n.color?`4px solid ${n.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&jsx("span",{className:"text-2xl leading-none",children:n.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:n.color},children:n.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",n.cardIds.length," ",n.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Za,{board:i,callbacks:r,availableUsers:a})})]},n.id)}),p.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var is=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function ls({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),l=useRef(null),p=is.find(n=>n.value===e)||is[0];useEffect(()=>{function n(u){s.current&&!s.current.contains(u.target)&&l.current&&!l.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let m=n=>{t(n),o(false);};return jsxs("div",{className:C("relative inline-block",a),children:[jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:p.icon}),jsx("span",{children:p.label}),jsx("svg",{className:C("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:is.map(n=>jsxs("button",{onClick:()=>m(n.value),className:C("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===n.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:n.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:n.label}),e===n.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:n.description})]})]},n.value))})]})]})}var so=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function lu(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(n=>e.key===n||e.code===n))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,l=o.shift?e.shiftKey:!e.shiftKey,p=o.alt?e.altKey:!e.altKey,m=o.meta?e.metaKey:true;return s&&l&&p&&m}function Wl(e={}){let{shortcuts:t=so,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let l=useCallback(m=>{o.current=[...o.current,m];},[]),p=useCallback(m=>{o.current=o.current.filter(n=>n.action!==m);},[]);return useEffect(()=>{function m(n){if(!s.current)return;let u=n.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&n.key!=="Escape"&&!n.ctrlKey&&!n.metaKey)){for(let d of o.current)if(lu(n,d)){r&&n.preventDefault();let i=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(i);break}}}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[r]),{registerShortcut:l,unregisterShortcut:p,isEnabled:a}}function cu(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function pu(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function mu(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=pu(e),r=t?cu(t):"";return a?`${a} + ${r}`:r}function uu(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function ds({shortcuts:e=so,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function p(m){m.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[t,a]),!o||!t)return null;let l=uu(e);return jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(l).map(([p,m])=>m.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold text-white/90 mb-4 flex items-center gap-2",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),p]}),jsx("div",{className:"space-y-3",children:m.map(n=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg bg-white/5 hover:bg-white/10 transition-colors",children:[jsx("span",{className:"text-sm text-white/80",children:n.description}),jsx("kbd",{className:"px-3 py-1.5 bg-gradient-to-br from-gray-700 to-gray-800 border border-white/20 rounded-md text-xs font-mono text-white/90 shadow-lg whitespace-nowrap",children:mu(n)})]},n.action))})]},p))})}),jsx("div",{className:"px-6 py-4 border-t border-white/10 bg-white/5",children:jsxs("p",{className:"text-xs text-white/50 text-center",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 bg-white/10 rounded text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var cs=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
6
6
|
1.
|
|
7
7
|
|
|
8
8
|
**Expected behavior:**
|
|
@@ -42,8 +42,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
42
42
|
1.
|
|
43
43
|
|
|
44
44
|
**Action items:**
|
|
45
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ns({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),d=useRef(null);useEffect(()=>{function n(m){s.current&&!s.current.contains(m.target)&&d.current&&!d.current.contains(m.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=n=>{t(n),o(false);},p=e.reduce((n,m)=>{let l=m.category||"Other";return n[l]||(n[l]=[]),n[l].push(m),n},{});return jsxs("div",{className:w("relative inline-block",a),children:[jsxs("button",{ref:d,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:w("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(p).map(([n,m])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsx("div",{children:m.map(l=>jsxs("button",{onClick:()=>c(l),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:l.name}),l.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:l.description})]})]},l.id))})]},n)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function is({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[d,c]=useState("export"),[p,n]=useState("json"),[m,l]=useState(null),i=useRef(null);if(!t)return null;let u=async()=>{let f=o?.current||void 0,y=await Ii(e,p,f);Li(y,p);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Ri(y),b=y.name.endsWith(".json")?"json":"csv",g=Bi(x,b);l(g),g.success&&r&&r(g,x);}catch(x){l({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>c("export"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>c("import"),className:w("flex-1 px-6 py-4 font-semibold transition-colors",d==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[d==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(f=>jsxs("button",{onClick:()=>n(f),className:w("p-4 rounded-lg border-2 transition-all text-center",p===f?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:u,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),d==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),m&&jsxs("div",{className:w("p-4 rounded-lg",m.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:w("font-semibold mb-2",m.success?"text-green-400":"text-red-400"),children:m.success?"\u2713 Import Successful":"\u2717 Import Failed"}),m.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",m.cardsImported]}),jsxs("div",{children:["Columns imported: ",m.columnsImported]})]}),m.errors&&m.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:m.errors.map((f,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var au=["URGENT","HIGH","MEDIUM","LOW"],ru=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],ou=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ls({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:d,onFilterHighPriority:c,availableUsers:p=[],availableLabels:n=[],availableColumns:m=[],showQuickFilters:l=true,compact:i=false,groupBy:u="none",onGroupByChange:v}){let[f,y]=useState(true),x=useCallback(h=>{a({search:h.target.value});},[a]),b=useCallback(h=>{a({dateFilter:h.target.value});},[a]),g=useCallback(h=>{r({by:h.target.value});},[r]),k=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:h=>{h.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:h=>{h.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&jsxs("div",{className:"filter-bar__content",children:[l&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),d&&jsx("button",{onClick:d,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),c&&jsx("button",{onClick:c,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:h=>{let E=h.target.value;a({priorities:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),au.map(h=>jsx("option",{value:h,children:h},h))]})}),p.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:h=>{let E=h.target.value;a({assignees:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),p.map(h=>jsx("option",{value:h.id,children:h.name},h.id))]})}),n.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:h=>{let E=h.target.value;a({labels:E==="all"?[]:[E]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),n.map(h=>jsx("option",{value:h,children:h},h))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:g,className:"filter-bar__select filter-bar__select--sm",children:ru.map(h=>jsx("option",{value:h.value,children:h.label},h.value))}),t.by!=="none"&&jsx("button",{onClick:k,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:u,onChange:h=>v(h.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:ou.map(h=>jsx("option",{value:h.value,children:h.label},h.value))})}),N&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function ds({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:d,onExportGanttPNG:c,onExportGanttCSV:p}){let[n,m]=useState(false),l=useRef(null);useEffect(()=>{let u=v=>{l.current&&!l.current.contains(v.target)&&m(false);};return n&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u);}},[n]);let i=u=>{u(),m(false);};return jsxs("div",{className:w("relative",r),ref:l,children:[jsxs("button",{onClick:()=>m(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",u.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",u.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),n&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>i(async()=>await d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>i(async()=>await c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>i(()=>p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:u=>{u.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var cs={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ps={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#2563EB",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ms={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},gr={dark:cs,light:ps,neutral:ms},Uo="dark";var Wo=createContext(void 0),gu="asakaa-theme";function Fl({children:e,defaultTheme:t=Uo,storageKey:a=gu}){let[r,o]=useState(()=>{if(typeof window<"u"){let c=localStorage.getItem(a);if(c&&(c==="dark"||c==="light"||c==="neutral"))return c}return t}),s=useCallback(c=>{o(c),typeof window<"u"&&localStorage.setItem(a,c);},[a]);useEffect(()=>{if(typeof window>"u")return;let c=document.documentElement,p=gr[r];Object.entries(p.colors).forEach(([m,l])=>{l&&c.style.setProperty(`--theme-${fu(m)}`,l);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([m,l])=>{let i=p.colors[m];i&&c.style.setProperty(l,i);}),c.setAttribute("data-theme",r),c.classList.remove("theme-dark","theme-light","theme-neutral"),c.classList.add(`theme-${r}`);},[r]);let d={theme:r,setTheme:s,themes:gr};return jsx(Wo.Provider,{value:d,children:e})}function Br(){let e=useContext(Wo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function fu(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function us({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=Br();return e?jsxs("div",{className:w("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(gr).map(([s,d])=>jsxs("button",{onClick:()=>{o(s),t();},className:w("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:d.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:d.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var _e={dark:{bgPrimary:"#1A1D21",bgSecondary:"#22262D",bgGrid:"#1E2126",bgWeekend:"rgba(59, 130, 246, 0.03)",border:"#334155",borderLight:"#2D3139",textPrimary:"#FFFFFF",textSecondary:"#CBD5E1",textTertiary:"#64748B",accent:"#3B82F6",accentHover:"#60A5FA",accentLight:"rgba(59, 130, 246, 0.12)",taskBarPrimary:"#3B82F6",taskBarProgress:"#2563EB",taskBarHandle:"#FFFFFF",dependency:"rgba(180, 185, 197, 0.25)",dependencyHover:"rgba(180, 185, 197, 0.45)",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#06B6D4",todayLight:"rgba(6, 182, 212, 0.12)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.1)",statusTodo:"#64748B",statusInProgress:"#3B82F6",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.06)",focusRing:"#3B82F6"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(37, 99, 235, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#2563EB",accentHover:"#1D4ED8",accentLight:"rgba(37, 99, 235, 0.08)",taskBarPrimary:"#2563EB",taskBarProgress:"#1E40AF",taskBarHandle:"#FFFFFF",dependency:"rgba(75, 85, 99, 0.25)",dependencyHover:"rgba(75, 85, 99, 0.45)",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#0891B2",todayLight:"rgba(8, 145, 178, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#2563EB",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#2563EB"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"rgba(87, 83, 78, 0.25)",dependencyHover:"rgba(87, 83, 78, 0.4)",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};function Bl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return _e[e]||_e.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,d)=>a.getPropertyValue(s).trim()||d;return {bgPrimary:r("--theme-bg-primary",_e[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",_e[e].bgSecondary),bgGrid:r("--theme-bg-card",_e[e].bgGrid),bgWeekend:r("--theme-bg-hover",_e[e].bgWeekend),border:r("--theme-border-primary",_e[e].border),borderLight:r("--theme-border-subtle",_e[e].borderLight),textPrimary:r("--theme-text-primary",_e[e].textPrimary),textSecondary:r("--theme-text-secondary",_e[e].textSecondary),textTertiary:r("--theme-text-tertiary",_e[e].textTertiary),accent:r("--theme-accent-primary",_e[e].accent),accentHover:r("--theme-accent-hover",_e[e].accentHover),accentLight:r("--theme-accent-primary",_e[e].accentLight),taskBarPrimary:r("--theme-accent-primary",_e[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",_e[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",_e[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",_e[e].dependency),dependencyHover:r("--theme-border-secondary",_e[e].dependencyHover),criticalPath:r("--theme-error",_e[e].criticalPath),criticalPathLight:r("--theme-error",_e[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",_e[e].today):e==="neutral"?r("--theme-text-primary",_e[e].today):r("--theme-error",_e[e].today),todayLight:e==="light"?r("--theme-accent-primary",_e[e].todayLight):e==="neutral"?r("--theme-text-primary",_e[e].todayLight):r("--theme-error",_e[e].todayLight),milestone:r("--theme-warning",_e[e].milestone),milestoneLight:r("--theme-warning",_e[e].milestoneLight),statusTodo:r("--theme-text-tertiary",_e[e].statusTodo),statusInProgress:r("--theme-accent-primary",_e[e].statusInProgress),statusCompleted:r("--theme-success",_e[e].statusCompleted),hoverBg:r("--theme-bg-hover",_e[e].hoverBg),focusRing:r("--theme-accent-primary",_e[e].focusRing)}}var Go={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Rl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},gs={en:Go,es:Rl};function Ol(e){return gs[e]||gs.en}function fs(e,t){let a=Ol(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Or=createContext(Go);function oo(){return useContext(Or)}function Iu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:d}){let[c,p]=useState(false),[n,m]=useState(null),l=useRef(null),i=oo();if(useEffect(()=>{let y=x=>{l.current&&!l.current.contains(x.target)&&p(false);};return c&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]),!(t||a||r||o||s||d))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:d}].filter(y=>y.handler),f=async(y,x)=>{if(x){m(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{m(null),p(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>p(!c),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?e.accent:e.bgSecondary,border:`1px solid ${c?e.accent:e.borderLight}`,color:c?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:i.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:c?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:c&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:v.map((y,x)=>jsxs(motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function Lu({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let d=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:d?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500,zIndex:d?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[d&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:d?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Fu({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Bu({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),d=oo();useEffect(()=>{let n=m=>{s.current&&!s.current.contains(m.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let c=[{value:"compact",label:d.toolbar.compact||"Compact"},{value:"comfortable",label:d.toolbar.normal||"Normal"},{value:"spacious",label:d.toolbar.spacious||"Spacious"}],p=c.find(n=>n.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${d.toolbar.density||"Density"}: ${p}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:c.map((n,m)=>{let l=t===n.value;return jsxs(motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:l?e.accentLight:"transparent",borderBottom:m<c.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:l?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-xs",style:{color:l?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500},children:n.label}),l&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Ho({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:d,rowDensity:c,onRowDensityChange:p,showThemeSelector:n=false,showCreateTaskButton:m=false,createTaskLabel:l,onCreateTask:i,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=oo(),k=u||v||f||y||x||b,N=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],h=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Fu,{options:N,value:t,onChange:E=>a(E),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Bu,{theme:e,value:c,onChange:p})]}),jsxs("div",{className:"flex items-center gap-3",children:[m&&i&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:l||g.toolbar.createTask})]}),(k||n)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),k&&jsxs(Fragment,{children:[jsx(Iu,{theme:e,onExportPNG:u,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsx(Lu,{options:h,value:s,onChange:E=>d(E),theme:e})]})]})}function _o({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,d]=useState({x:0,y:0}),c=useRef(null),p=useRef(null);useEffect(()=>{if(!r)return;let m=l=>{c.current&&!c.current.contains(l.target)&&o(false);};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]);let n=e.filter(m=>m.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>{if(!r&&p.current){let m=p.current.getBoundingClientRect();d({x:m.left,y:m.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(Qe,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(m=>jsxs("button",{onClick:()=>{t(m.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:m.label}),m.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},m.id))]})})})})]})}function $r({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let d=useRef(null),[c,p]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let m=200,l=r.length*36+8,i=8,u=window.innerWidth,v=window.innerHeight,f=t,y=a;t+m+i>u&&(f=t-m,f<i&&(f=i)),a+l+i>v&&(y=v-l-i,y<i&&(y=i)),p({x:f,y});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let m=i=>{d.current&&!d.current.contains(i.target)&&o();},l=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",m),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",l);}},[e,o]),!e)return null;let n=m=>m.startsWith("#")&&(m.length===7||m.length===4)?m:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:d,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${c.x}px`,top:`${c.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(m=>jsxs("div",{children:[m.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{m.disabled||(m.onClick(),o());},disabled:m.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:m.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:m.disabled?"not-allowed":"pointer",opacity:m.disabled?.5:1},onMouseEnter:l=>{m.disabled||(l.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="transparent";},children:[m.icon&&jsx("span",{style:{color:s.textSecondary},children:m.icon}),jsx("span",{className:"flex-1",children:m.label}),m.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},m.id))})})})}var gt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Xl({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:d,onTaskIndent:c,onTaskOutdent:p,onTaskRename:n,onTaskToggleExpand:m,onOpenTaskModal:l,enableKeyboard:i=true}){let u=useRef(false),v=useCallback(g=>{u.current=g;},[]),f=useCallback(g=>{let k=[],N=h=>{for(let E of h)k.push(E),E.subtasks&&E.subtasks.length>0&&E.isExpanded&&N(E.subtasks);};return N(g),k},[]),y=useCallback(()=>{let g=f(e);for(let k of g)if(t.has(k.id))return k;return null},[e,t,f]),x=useCallback((g,k)=>{let N=f(e);if(N.length===0)return;let h=y();if(!h){a(N[0].id,false);return}let E=N.findIndex(T=>T.id===h.id);if(E===-1)return;let C=g==="up"?E-1:E+1;if(C<0||C>=N.length)return;let F=N[C];a(F.id,k);},[e,y,f,a]),b=useCallback(g=>{if(!i)return;let k=g.target;if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"||k.isContentEditable||u.current){g.key==="Escape"&&(k.blur(),u.current=false);return}let E=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,C=Array.from(t),F=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(F&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){F.subtasks&&F.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!F.isExpanded||g.key==="ArrowLeft"&&F.isExpanded)&&m(F.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){C.length>0&&(g.preventDefault(),d(C,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){C.length>0&&(g.preventDefault(),c(C));return}if(g.key==="Tab"&&g.shiftKey){C.length>0&&(g.preventDefault(),p(C));return}if(g.key==="Enter"&&!g.shiftKey&&!E){F&&(g.preventDefault(),r(F.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!E){F&&(g.preventDefault(),r(F.id,"above"));return}if(g.key==="Enter"&&E){F&&(g.preventDefault(),l(F.id));return}if(g.key==="F2"){F&&(g.preventDefault(),n(F.id));return}if(g.key==="Delete"||g.key==="Backspace"&&E){C.length>0&&(g.preventDefault(),o(C));return}if(g.key==="d"&&E&&!g.shiftKey){C.length>0&&(g.preventDefault(),s(C));return}},[i,t,y,x,r,o,s,d,c,p,n,m,l]);return useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function Zl(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(l=>{t(new Set([l])),r(l);},[]),s=useCallback(l=>{t(i=>{let u=new Set(i);return u.has(l)?u.delete(l):u.add(l),u}),r(l);},[]),d=useCallback((l,i)=>{if(!a){o(l);return}let u=i.indexOf(a),v=i.indexOf(l);if(u===-1||v===-1){o(l);return}let f=Math.min(u,v),y=Math.max(u,v),x=i.slice(f,y+1);t(new Set(x)),r(l);},[a,o]),c=useCallback((l,i,u,v)=>{v?d(l,i):u?s(l):o(l);},[o,s,d]),p=useCallback((l,i)=>{i?t(u=>{let v=new Set(u);return v.add(l),v}):o(l);},[o]),n=useCallback(()=>{t(new Set),r(null);},[]),m=useCallback(l=>e.has(l),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:d,handleTaskClick:c,handleKeyboardSelection:p,clearSelection:n,isTaskSelected:m}}function zr(e){let t=[],a=(r,o,s=0)=>{for(let d=0;d<r.length;d++){let c={...r[d],parentId:o,level:s,position:d};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Ql(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ql(a.subtasks,t);if(r)return r}}return null}function ys(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=ys(a.subtasks,t);if(r)return r}return null}function vs(e,t){if(t.length===0)return e;let a=zr(e),r=t[0],o=a.findIndex(l=>l.id===r);if(o<=0)return e;let s=a[o-1],d=(l,i)=>{let u=[];return {tasks:l.filter(f=>{if(i.has(f.id))return u.push(f),false;if(f.subtasks){let y=d(f.subtasks,i);f.subtasks=y.tasks,u.push(...y.removed);}return true}),removed:u}},c=(l,i,u)=>l.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...u],isExpanded:true}:v.subtasks?{...v,subtasks:c(v.subtasks,i,u)}:v),p=new Set(t),{tasks:n,removed:m}=d(e,p);return c(n,s.id,m)}function xs(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=ys(a,r);if(!o)continue;let s=ys(a,o.id),d=(n,m,l)=>{for(let i=0;i<n.length;i++){let u=n[i];if(u.id===m&&u.subtasks){let v=u.subtasks.findIndex(f=>f.id===l);if(v!==-1){let[f]=u.subtasks.splice(v,1);return f}}if(u.subtasks){let v=d(u.subtasks,m,l);if(v)return v}}return null},c=(n,m,l)=>{let i=n.findIndex(u=>u.id===m);if(i!==-1)return n.splice(i+1,0,l),n;for(let u of n)u.subtasks&&c(u.subtasks,m,l);return n},p=d(a,o.id,r);p&&(s&&s.subtasks?c(s.subtasks,o.id,p):c(a,o.id,p));}return a}function ks(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(d,c,p)=>{let n=d.findIndex(l=>l.id===c);if(n===-1){for(let l of d)if(l.subtasks&&s(l.subtasks,c,p))return true;return false}let m=p==="up"?n-1:n+1;return m<0||m>=d.length?false:([d[n],d[m]]=[d[m],d[n]],true)};return s(r,o,a),r}function ws(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Cs(e,t){let a=[...e];for(let r of t){let o=d=>{let c=d.findIndex(m=>m.id===r);if(c===-1){for(let m of d)if(m.subtasks&&o(m.subtasks))return true;return false}let p=d[c],n={...p,id:`${p.id}-copy-${Date.now()}`,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks):void 0};return d.splice(c+1,0,n),true},s=d=>d.map(c=>({...c,id:`${c.id}-copy-${Date.now()}`,subtasks:c.subtasks?s(c.subtasks):void 0}));o(a);}return a}function ed(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},c=p=>{let n=p.findIndex(l=>l.id===t);if(n===-1){for(let l of p)if(l.subtasks&&c(l.subtasks))return true;return false}let m=a==="above"?n:n+1;return p.splice(m,0,d),true};return c(r),{tasks:r,newTask:d}}function Ts(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ts(r.subtasks,t,a)}:r)}function Ds(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Ds(a.subtasks,t)}:a)}function Ns(e,t){let a=m=>{for(let l of m){if(l.id===t)return l;if(l.subtasks){let i=a(l.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let d=r?.startDate||o,c=r?.endDate||s,p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(d),endDate:new Date(c),color:r?.color||"#3B82F6"},n=m=>m.map(l=>{if(l.id===t){let i=l.subtasks||[];return {...l,subtasks:[...i,p],isExpanded:true}}return l.subtasks?{...l,subtasks:n(l.subtasks)}:l});return {tasks:n(e),newTask:p}}function td(e,t,a,r){if(t===a)return e;let o=Ql(e,t);if(!o)return e;if(a){let c=(p,n)=>{if(!p.subtasks)return false;for(let m of p.subtasks)if(m.id===n||c(m,n))return true;return false};if(c(o,a))return e}let s=c=>c.filter(p=>p.id!==t).map(p=>p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p),d=s(e);if(a===null){let c=r!==void 0?r:d.length;d.splice(c,0,{...o,parentId:void 0});}else {let c=p=>p.map(n=>{if(n.id===a){let m=n.subtasks||[],l=r!==void 0?r:m.length,i=[...m];return i.splice(l,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:c(n.subtasks)}:n});d=c(d);}return d}function Ko({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:d,onTaskContextMenu:c,onTaskToggle:p,scrollTop:n,columns:m,onToggleColumn:l,onColumnResize:i,onTaskUpdate:u,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:k,onCreateSubtask:N,onOpenTaskModal:h,onDeleteRequest:E,onTaskReparent:C}){let F=useContext(Or),[T,$]=useState(null),[W,L]=useState(false),[G,ee]=useState(null),[he,ye]=useState(""),Me=useRef(null),V=useRef(null),[B,I]=useState(null),[R,M]=useState(0),[Y,K]=useState(0),[q,Ee]=useState({isOpen:false,x:0,y:0,type:"header"}),[we,Ue]=useState(null),[P,te]=useState(null),[fe,Ie]=useState(null),Oe=useRef(0),Ke=5,ot=useRef(false),[Se,St]=useState(null),[Ze,Je]=useState(false),[Ye,it]=useState(null);useEffect(()=>{function U(D){Me.current&&!Me.current.contains(D.target)&&L(false);}if(W)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[W]),useEffect(()=>{G&&V.current&&(V.current.focus(),V.current.select());},[G]),useEffect(()=>{if(!B)return;let U=X=>{let pe=X.clientX-R,Ne=Y+pe;i?.(B,Ne);},D=()=>{I(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",D),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",D),document.body.style.cursor="",document.body.style.userSelect="";}},[B,R,Y,i]);let{selectedTaskIds:$t,handleTaskClick:xe,isTaskSelected:O}=Zl(),{setIsEditing:Ce}=Xl({tasks:e,selectedTaskIds:$t,onTaskSelect:(U,D)=>{let pe=zr(e).map(Ne=>Ne.id);xe(U,pe,D||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:U=>{let D=zr(e).find(X=>X.id===U);D&&Q(D);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:U=>{let D=zr(e).find(X=>X.id===U);D&&h&&h(D);},enableKeyboard:true}),Ve=(U,D=0)=>{let X=[];for(let pe of U)X.push({task:pe,level:D}),pe.subtasks&&pe.subtasks.length>0&&pe.isExpanded&&X.push(...Ve(pe.subtasks,D+1));return X},He=Ve(e),xt=48,J=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,Q=U=>{ee(U.id),ye(U.name),Ce(true);},ke=U=>{he.trim()&&he!==e.find(D=>D.id===U)?.name&&k?.(U,he.trim()),ee(null),ye(""),Ce(false);},ge=()=>{ee(null),ye(""),Ce(false);},ae=(U,D)=>{D.stopPropagation(),N?.(U.id);},De=(U,D)=>{D.preventDefault(),Oe.current=D.clientY,Ue(U),ot.current=false,Je(false),St({x:D.clientX,y:D.clientY});},me=U=>{if(!we||(Math.abs(U.clientY-Oe.current)>Ke&&!ot.current&&(ot.current=true,Je(true)),St({x:U.clientX,y:U.clientY}),!ot.current))return;let X=document.querySelectorAll("[data-task-row]"),pe=null,Ne=null;X.forEach(At=>{let Et=At.getBoundingClientRect(),It=At.getAttribute("data-task-row");if(It&&It!==we&&U.clientY>=Et.top&&U.clientY<=Et.bottom){pe=It;let Jt=U.clientY-Et.top,bt=Et.height;Jt<bt*.25?Ne="above":Jt>bt*.75?Ne="below":Ne="child";}}),te(pe),Ie(Ne);},Te=()=>{if(ot.current&&we&&P&&fe){if(fe==="child")C?.(we,P);else if(fe==="above"||fe==="below"){let U=(pe,Ne,At=null)=>{for(let Et of pe){if(Et.id===Ne)return At;if(Et.subtasks){let It=U(Et.subtasks,Ne,Et.id);if(It!==void 0)return It}}},D=U(e,P,null),X=(pe,Ne)=>{let At=pe.findIndex(Et=>Et.id===Ne);return fe==="below"?At+1:At};if(D===null){let pe=X(e,P);C?.(we,null,pe);}else {let pe=He.find(Ne=>Ne.task.id===D)?.task;if(pe?.subtasks){let Ne=X(pe.subtasks,P);C?.(we,D,Ne);}}}}Ue(null),te(null),Ie(null),St(null),ot.current=false,Je(false);};useEffect(()=>{if(we)return document.addEventListener("mousemove",me),document.addEventListener("mouseup",Te),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",me),document.removeEventListener("mouseup",Te),document.body.style.cursor="",document.body.style.userSelect="";}},[we,P,fe]);let ue=(U,D,X)=>{switch(U.id){case "name":let pe=G===D.id,Ne=T===D.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${X*20}px`},children:[C&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:Ne?1:.3},onMouseDown:ie=>De(D.id,ie),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),D.subtasks&&D.subtasks.length>0?jsx("button",{onClick:ie=>{ie.stopPropagation(),p?.(D.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:D.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),!(D.subtasks&&D.subtasks.length>0)&&jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:D.color||"#3B82F6",opacity:D.parentId?.6:1,borderColor:D.isMilestone?t.accent:"transparent",borderWidth:D.isMilestone?"2px":"0px"},title:D.isMilestone?"Milestone":D.parentId?"Subtask":"Task"}),pe?jsx("input",{ref:V,type:"text",value:he,onChange:ie=>ye(ie.target.value),onKeyDown:ie=>{ie.key==="Enter"?ke(D.id):ie.key==="Escape"&&ge();},onBlur:()=>ke(D.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ie=>ie.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:D.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:D.parentId?"13px":"14px",fontWeight:D.isMilestone?600:D.parentId?400:600,letterSpacing:D.parentId?"0":"-0.01em"},title:D.name,children:D.name}),Ne&&!pe&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ie=>ie.stopPropagation(),children:[jsx("button",{onClick:ie=>ae(D,ie),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:ie=>{ie.stopPropagation(),Q(D);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Et=U.id==="startDate"?"startDate":"endDate",It=D[Et],Jt=Ye?.taskId===D.id&&Ye?.field===Et,bt=ie=>ie?(typeof ie=="string"?new Date(ie):ie).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ie=>ie.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:ie=>{if(Jt)it(null);else {let ht=ie.currentTarget.getBoundingClientRect();it({taskId:D.id,field:Et,month:It?typeof It=="string"?new Date(It):It:new Date,position:{top:ht.bottom+4,left:ht.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:bt(It)})]}),Jt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>it(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Ye?.position.top,left:Ye?.position.left},onClick:ie=>ie.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ie=new Date,ht=new Date(ie);ht.setDate(ie.getDate()+1);let Yt=new Date(ie);Yt.setDate(ie.getDate()+7);let Va=new Date(ie);return Va.setDate(ie.getDate()+14),[{label:"Hoy",date:ie},{label:"Ma\xF1ana",date:ht},{label:"Pr\xF3xima semana",date:Yt},{label:"2 semanas",date:Va}].map((Nr,Ba)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ja=>ja.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ja=>ja.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(D.id,{[Et]:Nr.date}),it(null);},children:Nr.label},Ba))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{u?.(D.id,{[Et]:void 0}),it(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>it(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Ye?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>it(ie=>ie?{...ie,month:new Date(ie.month.getFullYear(),ie.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ie,ht)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ie},ht))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ie=Ye?.month||new Date,ht=ie.getFullYear(),Yt=ie.getMonth(),Va=new Date(ht,Yt,1).getDay(),wo=new Date(ht,Yt+1,0).getDate(),Nr=new Date,Ba=[];for(let kt=Va-1;kt>=0;kt--)Ba.push({day:new Date(ht,Yt,-kt).getDate(),date:new Date(ht,Yt-1,new Date(ht,Yt,-kt).getDate()),isCurrentMonth:false});for(let kt=1;kt<=wo;kt++)Ba.push({day:kt,date:new Date(ht,Yt,kt),isCurrentMonth:true});let ja=42-Ba.length;for(let kt=1;kt<=ja;kt++)Ba.push({day:kt,date:new Date(ht,Yt+1,kt),isCurrentMonth:false});return Ba.map((kt,Co)=>{let To=kt.date.toDateString()===Nr.toDateString(),Vr=(It?typeof It=="string"?new Date(It):It:null)?.toDateString()===kt.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:kt.isCurrentMonth?Vr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Vr?"#3B82F6":"transparent",boxShadow:To&&!Vr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{u?.(D.id,{[Et]:kt.date}),it(null);},children:kt.day},Co)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:J(D)})});case "assignees":let Dr=r.filter(ie=>D.assignees?.some(ht=>ht.name===ie.name||ht.initials===ie.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(cr,{assignedUsers:Dr,availableUsers:r,onChange:ie=>{let ht=ie.map(Yt=>({id:Yt.id,name:Yt.name,initials:Yt.initials,color:Yt.color}));u?.(D.id,{assignees:ht.length>0?ht:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(tl,{status:D.status||"todo",onChange:ie=>{u?.(D.id,{status:ie,progress:ie==="completed"?100:D.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${D.progress}%`,backgroundColor:D.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[D.progress,"%"]})]});case "priority":let or={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},_a={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},nr=or[D.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ie=>ie.stopPropagation(),children:jsx(lr,{priority:nr,onChange:ie=>{ie&&u?.(D.id,{priority:_a[ie]||"medium"});}})});default:return null}},Ae=U=>[{id:"hide",label:"Hide Column",icon:gt.Hide,onClick:()=>l(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:gt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:gt.SortDesc,onClick:()=>{}}],ce=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:gt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:gt.Delete,onClick:()=>{E?E(U.id,U.name):x?.([U.id]);}}]:[{id:"edit",label:F?.contextMenu?.editTask||"Edit Task",icon:gt.Pencil,onClick:()=>{d?.(U);}},{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:gt.Add,onClick:()=>{N?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:F?.contextMenu?.markIncomplete||"Mark Incomplete",icon:gt.MarkIncomplete,onClick:()=>{u?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:F?.contextMenu?.setInProgress||"Set In Progress",icon:gt.SetInProgress,onClick:()=>{u?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:F?.contextMenu?.markComplete||"Mark Complete",icon:gt.MarkComplete,onClick:()=>{u?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:F?.contextMenu?.splitTask||"Split Task",icon:gt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:gt.Delete,onClick:()=>{E?E(U.id,U.name):x?.([U.id]);}}],Le=m.filter(U=>U.visible);return jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${xt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Le.map((U,D)=>{let X=D===Le.length-1,pe=U.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${pe?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(pe?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:X?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:Ne=>{Ne.preventDefault(),Ee({isOpen:true,x:Ne.clientX,y:Ne.clientY,type:"header",columnId:U.id});},onMouseEnter:Ne=>{Ne.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:Ne=>{Ne.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:pe?"70px":"0"},title:U.label,children:U.label}),pe&&jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsx(_o,{columns:m,onToggleColumn:l,theme:t}),jsx("button",{onClick:()=>L(!W),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})})]}),U.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:B===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:Ne=>{Ne.preventDefault(),Ne.stopPropagation(),I(U.id),M(Ne.clientX),K(U.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},U.id)}),W&&jsxs("div",{ref:Me,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:U=>U.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>L(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",children:He.map(({task:U,level:D},X)=>{let pe=O(U.id),Ne=P===U.id,At=Ne&&fe==="above",Et=Ne&&fe==="below",It=Ne&&fe==="child",Jt={};return It&&(Jt.backgroundColor=`${t.accent}15`,Jt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${we===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:pe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:pe?t.accentLight:It?`${t.accent}15`:X%2===0?t.bgPrimary:t.bgGrid,...Jt},onMouseEnter:()=>$(U.id),onMouseLeave:()=>$(null),onClick:bt=>{let or=zr(e).map(ie=>ie.id),nr=navigator.platform.toUpperCase().indexOf("MAC")>=0?bt.metaKey:bt.ctrlKey;xe(U.id,or,nr,bt.shiftKey),s?.(U);},onDoubleClick:bt=>{bt.stopPropagation(),d?.(U);},onContextMenu:bt=>{bt.preventDefault(),Ee({isOpen:true,x:bt.clientX,y:bt.clientY,type:"task",task:U}),c?.(U,bt);},whileHover:{backgroundColor:pe?t.accentLight:t.hoverBg},children:[At&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Et&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Le.map((bt,Dr)=>{let or=Dr===Le.length-1,_a=bt.id==="name";return jsx("div",{className:`px-4 flex items-center ${_a?"justify-start":"justify-center"}`,style:{width:`${bt.width}px`,minWidth:`${bt.minWidth??(_a?200:60)}px`,maxWidth:`${bt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:or?"none":`1px solid ${T===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ue(bt,U,_a?D:0)},`${U.id}-${bt.id}`)})]},U.id)})}),jsx($r,{isOpen:q.isOpen,x:q.x,y:q.y,items:q.type==="header"&&q.columnId?Ae(q.columnId):q.type==="task"&&q.task?ce(q.task):[],onClose:()=>Ee({...q,isOpen:false}),theme:t}),Ze&&Se&&we&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Se.x+12,top:Se.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=He.find(D=>D.task.id===we)?.task;return U?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:U.name})}):null})()}),document.body)]})}function sd(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[d,c]=useState(e),[p,n]=useState(t),[m,l]=useState(null),[i,u]=useState(null),[v,f]=useState(null),[y,x]=useState(null),[b,g]=useState(0),[k,N]=useState(0),[h,E]=useState(null),[C,F]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:d,setGhostX:c,ghostWidth:p,setGhostWidth:n,connectionLine:m,setConnectionLine:l,hoveredTaskId:i,setHoveredTaskId:u,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:k,setSegmentDragOffsetX:N,hoveredSegmentIndex:h,setHoveredSegmentIndex:E,isHovered:C,setIsHovered:F,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(G,ee)=>{r("none"),l(null),u(null),c(G),n(ee),N(0),x(null),g(0);}}}function Yo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:d,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:l,onDependencyCreate:i,allTaskPositions:u=[],onDragMove:v,onHoverChange:f}){let y=sd(t,r),x=useRef(null),{dragMode:b,setDragMode:g,dragOffset:k,setDragOffset:N,ghostX:h,setGhostX:E,ghostWidth:C,setGhostWidth:F,connectionLine:T,setConnectionLine:$,hoveredTaskId:W,setHoveredTaskId:L,activeZone:G,setActiveZone:ee,draggedSegmentIndex:he,setDraggedSegmentIndex:ye,draggedSegmentStartX:Me,setDraggedSegmentStartX:V,segmentDragOffsetX:B,setSegmentDragOffsetX:I,hoveredSegmentIndex:R,setHoveredSegmentIndex:M,isHovered:Y,setIsHovered:K,isDragging:q,isResizing:Ee,isConnecting:we,resetDragState:Ue}=y,P=32,te=8,fe=e.endDate&&e.endDate<new Date&&e.progress<100,Ie=e.isCriticalPath,Oe=o.name==="neutral"||o.today==="#1C1917",Ke=e.status==="completed"||e.progress===100,ot={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},St=e.isCriticalPath||fe?"#DC2626":e.color?e.color:e.priority&&ot[e.priority]?ot[e.priority]:o.taskBarPrimary,Je=(ae=>ae>=80?20:ae>=60?15:ae>=50?12:10)(r),Ye=r<50,it=r<40;useEffect(()=>{if(f)if(Y&&!q&&!e.segments){let ae=a<100;f({task:e,x:t,y:a,width:r,height:P,showBelow:ae});}else f(null);},[Y,q,e,t,a,r,P,f]);let $t=ae=>ae.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),xe=()=>{let ae=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${ae} day${ae!==1?"s":""}`},O=ae=>Math.round(ae/s)*s,Ce=ae=>{let De=Math.round(ae/s),me=new Date(d);return me.setDate(me.getDate()+De),me},Ve=(ae,De)=>{for(let me of u){if(me.id===e.id)continue;let Te=5;if(ae>=me.x-Te&&ae<=me.x+me.width+Te&&De>=me.y-Te&&De<=me.y+me.height+Te)return me.id}return null},He=useCallback((ae,De,me)=>{ae.preventDefault(),ae.stopPropagation();let Te=x.current?.ownerSVGElement;if(!Te)return;let ue=Te.createSVGPoint();ue.x=ae.clientX,ue.y=ae.clientY;let Ae=ue.matrixTransform(Te.getScreenCTM()?.inverse()),ce=me!==void 0?me:t,Le=De;if(!Le){let U=Ae.x-ce;ae.shiftKey?(Le="connect",$({x:t+r,y:a+P/2})):ae.ctrlKey||ae.metaKey?Le="move":ae.altKey?Le=U<r/2?"resize-start":"resize-end":it?U<r/2?Le="move":Le="resize-end":Ye?U<=Je/2?Le="resize-start":U>=r-Je/2?Le="resize-end":Le="move":U<=Je?Le="resize-start":U>=r-Je?Le="resize-end":Le="move";}g(Le),K(false),ee(null),Le==="move"?N(Ae.x-ce):Le==="connect"?$({x:t+r,y:a+P/2}):N(0),E(ce),F(r);},[t,r,a,P]),xt=useCallback(ae=>{if(b==="none")return;let De=x.current?.ownerSVGElement;if(!De)return;let me=De.createSVGPoint();me.x=ae.clientX,me.y=ae.clientY;let Te=me.matrixTransform(De.getScreenCTM()?.inverse());if(b==="connect"){$({x:Te.x,y:Te.y});let ue=Ve(Te.x,Te.y);L(ue);}else if(b==="move"){let ue=Te.x-k,Ae=O(ue);E(Ae),F(r);let ce=Math.round((Ae-t)/s);if(v?.(e.id,ce,true),e.segments&&e.segments.length>0&&he!==null){let Le=Ae-Me;I(Le);}}else if(b==="resize-start"){let ue=Te.x,Ae=O(ue),ce=t+r-Ae;ce>=s&&(E(Ae),F(ce));}else if(b==="resize-end"){let ue=Te.x,ce=O(ue)-t;ce>=s&&F(ce);}},[b,t,r,s,k,e,O,he,Me,Ve,L,$,E,F,I,v]),J=useCallback(()=>{if(b!=="none"){if(b==="connect")W&&i&&i(e,W),$(null),L(null);else {let ae=e.endDate.getTime()-e.startDate.getTime(),De,me,Te=true;if(b==="move"){if(De=Ce(h),me=new Date(De.getTime()+ae),e.segments&&e.segments.length>0&&he!==null){let ue=Math.round(B/s),Ae=e.segments.map((D,X)=>{if(X===he){let pe=new Date(D.startDate),Ne=new Date(D.endDate);return pe.setDate(pe.getDate()+ue),Ne.setDate(Ne.getDate()+ue),{startDate:pe,endDate:Ne}}return D}),ce=Ae.flatMap(D=>[D.startDate,D.endDate]),Le=new Date(Math.min(...ce.map(D=>D.getTime()))),U=new Date(Math.max(...ce.map(D=>D.getTime())));l?.({...e,segments:Ae},Le,U),Ue(t,r);return}}else b==="resize-start"?(De=Ce(h),me=e.endDate,De>=me&&(console.warn("Invalid date range: start date must be before end date"),Te=false)):b==="resize-end"?(De=e.startDate,me=Ce(h+C),me<=De&&(console.warn("Invalid date range: end date must be after start date"),Te=false)):Te=false;Te&&De&&me&&(me.getTime()-De.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):l?.(e,De,me));}v?.(e.id,0,false),Ue(t,r);}},[b,h,C,e,l,W,i,t,r,s,Ce,B,he,Ue,v]);useEffect(()=>{if(b==="none")return;let ae=me=>{xt(me);},De=()=>{J();};return window.addEventListener("mousemove",ae),window.addEventListener("mouseup",De),()=>{window.removeEventListener("mousemove",ae),window.removeEventListener("mouseup",De);}},[b,xt,J]);let Q=q&&!we?h:t,ke=q&&!we?C:r,ge=c.taskClass(e);return jsxs("g",{ref:x,onMouseEnter:()=>!q&&K(true),onMouseLeave:()=>{q||(K(false),ee(null));},onClick:()=>!q&&p?.(e),onDoubleClick:ae=>{q||(ae.stopPropagation(),n?.(e));},onContextMenu:ae=>{ae.preventDefault(),m?.(e,ae);},children:[Y&&!q&&!Ye&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Je,height:P,fill:G==="resize-start"?o.accent:"transparent",opacity:G==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-start"),onMouseDown:ae=>He(ae,"resize-start")}),jsx("rect",{x:t+Je,y:a,width:r-Je*2,height:P,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ee("move"),onMouseDown:ae=>He(ae,"move")}),jsx("rect",{x:t+r-Je,y:a,width:Je,height:P,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-end"),onMouseDown:ae=>He(ae,"resize-end")})]}),Y&&!q&&it&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:P,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ee("move"),onMouseDown:ae=>He(ae,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:P,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ee("resize-end"),onMouseDown:ae=>He(ae,"resize-end")}),Y&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+P-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),q&&!we&&!e.segments&&jsx(motion.rect,{x:h,y:a,width:C,height:P,rx:te,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:Q,y:a,width:ke,height:P,rx:te,fill:St,"data-task-class":ge,initial:{opacity:0,scale:.95},animate:{opacity:q&&!we?.15:e.parentId?.6:Y?.9:.8,scale:Y&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ae=>He(ae),style:{cursor:q?we?"crosshair":Ee?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Q,y:a,width:ke*(e.progress/100),height:P,rx:te,fill:St,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((ae,De)=>{let me=(ae.startDate.getTime()-d.getTime())/864e5*s,ue=(ae.endDate.getTime()-d.getTime())/(1e3*60*60*24)*s-me+s,Ae=q&&b==="move"&&he===De,ce=R===De,Le=Ae?me+B:me;return jsxs("g",{onMouseEnter:()=>!q&&M(De),onMouseLeave:()=>!q&&M(null),children:[jsx(motion.rect,{x:Le,y:a,width:ue,height:P,rx:te,fill:St,initial:{opacity:0,scale:.95},animate:{opacity:Ae||e.parentId?.6:ce?.9:.8,scale:ce&&!q?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:U=>{U.stopPropagation(),ye(De),V(me),He(U,void 0,me);},style:{cursor:q?we?"crosshair":Ee?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Le,y:a,width:ue*(e.progress/100),height:P,rx:te,fill:St,opacity:1,style:{pointerEvents:"none"}})]},`segment-${De}`)}),Oe&&(fe||Ie)&&!e.segments&&jsxs(Fragment,{children:[Ie&&!fe&&jsx("rect",{x:Q,y:a,width:ke,height:P,rx:te,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),fe&&jsx("rect",{x:Q,y:a,width:ke,height:P,rx:te,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),ke>60&&!e.segments&&(()=>{let ae=c.taskLabel(e),De=typeof ae=="string"?ae:e.name,me=De.length>Math.floor(ke/8)?`${De.substring(0,Math.floor(ke/8))}...`:De;return jsx("text",{x:Q+12,y:a+P/2,dominantBaseline:"middle",fill:Ke?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ke?"line-through":"none"},children:me})})(),ke>100&&e.progress>0&&e.progress<100&&!q&&!e.segments&&jsxs("text",{x:Q+ke-12,y:a+P/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}),e.status&&ke>80&&!q&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Q+ke-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Q+ke-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Y||Ee)&&!we&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Ye?Q-15:Q-10,y:a-5,width:Ye?25:20,height:P+10,fill:"transparent",onMouseDown:ae=>He(ae,"resize-start"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ye?Q-8:Q-3,y:a+6,width:Ye?8:6,height:Ye?P-12:P-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Q+ke-10,y:a-5,width:Ye?25:20,height:P+10,fill:"transparent",onMouseDown:ae=>He(ae,"resize-end"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ye?Q+ke:Q+ke-3,y:a+6,width:Ye?8:6,height:Ye?P-12:P-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsx(AnimatePresence,{children:Y&&!q&&!e.segments&&jsxs(motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx(motion.circle,{cx:t+r+8,cy:a+P/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:ae=>{ae.stopPropagation(),He(ae,"connect");},style:{cursor:"crosshair"}}),jsx("text",{x:t+r+20,y:a+P/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),we&&T&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+P/2,x2:T.x,y2:T.y,stroke:W?o.statusCompleted:o.accent,strokeWidth:W?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:W?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:T.x,cy:T.y,r:W?8:6,fill:W?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),W&&jsx(motion.text,{x:T.x+15,y:T.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:T.x+10},animate:{opacity:1,x:T.x+15},transition:{duration:.2},children:"Connect"})]}),(Y||q)&&!we&&!e.segments&&jsx(motion.rect,{x:Q-2,y:a-2,width:ke+4,height:P+4,rx:te+2,fill:"none",stroke:q?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:q?.6:.4,initial:{opacity:0},animate:{opacity:q?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ee&&jsxs(Fragment,{children:[jsx("line",{x1:h,y1:0,x2:h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:h+C,y1:0,x2:h+C,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Y&&!q&&!e.segments&&!f&&(()=>{let me=a<100,Te=me?a+P+13:a-82-13,ue=me?`M ${Q+ke/2-6} ${a+P+3} L ${Q+ke/2} ${a+P+13} L ${Q+ke/2+6} ${a+P+3}`:`M ${Q+ke/2-6} ${a-13} L ${Q+ke/2} ${a-3} L ${Q+ke/2+6} ${a-13}`,Ae=Te+22,ce=Te+40,Le=Te+55,U=Te+70,D=me?Te+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:me?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:me?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ue,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Q+ke/2-120,y:Te,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Q+ke/2,y:Ae,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Q+ke/2-110,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Q+ke/2-70,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.startDate)}),jsx("text",{x:Q+ke/2-110,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Q+ke/2-70,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:$t(e.endDate)}),jsx("text",{x:Q+ke/2+10,y:ce,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Q+ke/2+65,y:ce,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:xe()}),jsx("text",{x:Q+ke/2+10,y:Le,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Q+ke/2+65,y:Le,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Q+ke/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Q+ke/2-50,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(X=>X.name).join(", ").substring(0,30),e.assignees.map(X=>X.name).join(", ").length>30?"...":""]})]}),!me&&jsx("text",{x:Q+ke/2,y:D,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:it?"Left: move \u2022 Right: resize":Ye?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}function dd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:d,showBelow:c}=e,p=82,n=13,m=c?o+d+n:o-p-n,l=c?`M ${r+s/2-6} ${o+d+3} L ${r+s/2} ${o+d+13} L ${r+s/2+6} ${o+d+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=m+22,u=m+40,v=m+55,f=m+70,y=k=>k.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x=()=>{if(!a.startDate||!a.endDate)return "N/A";let k=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${k} day${k!==1?"s":""}`};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:c?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:c?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:l,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:m,width:240,height:p,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsx("text",{x:r+s/2-110,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?y(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?y(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:u,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:u,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:x()}),jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(k=>k.name).join(", ").substring(0,30),a.assignees.map(k=>k.name).join(", ").length>30?"...":""]})]})]})})}function Jo({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:d}){let[c,p]=useState(false),n=a-e,m=r-t,l=e+n/2,i=`M ${e} ${t} C ${l} ${t}, ${l} ${r}, ${a} ${r}`,u=6,v=Math.atan2(m,n),f=a-u*Math.cos(v-Math.PI/6),y=r-u*Math.sin(v-Math.PI/6),x=a-u*Math.cos(v+Math.PI/6),b=r-u*Math.sin(v+Math.PI/6),g=o.dependency;useEffect(()=>{d&&s&&d(c?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[c,e,t,a,r,s,d]);let k=!s&&!d;return jsxs("g",{onMouseEnter:()=>!k&&p(true),onMouseLeave:()=>!k&&p(false),style:{pointerEvents:k?"none":"auto"},children:[!k&&jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx(motion.path,{d:i,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:c&&d?0:c?1:.8,strokeWidth:c?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsx(motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:c&&d?0:c?1:.8,scale:c?1.1:1,strokeWidth:c?2.5:2},transition:{duration:.2}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:c&&d?0:c?1.3:1,opacity:c&&d?0:c?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),c&&s&&!d&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:N=>{N.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:l,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsx("line",{x1:l-4,y1:(t+r)/2-4,x2:l+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsx("line",{x1:l+4,y1:(t+r)/2-4,x2:l-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function Qo({task:e,x:t,y:a,theme:r,onClick:o}){let[s,d]=useState(false),c=16,p=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:p(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var se={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(m=>{m.dependencies&&r.set(m.id,m.dependencies),m.subtasks&&o(m.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let d=new Set,c=new Set,p=n=>{if(!d.has(n)){d.add(n),c.add(n);let m=r.get(n)||[];for(let l of m){if(!d.has(l)&&p(l))return true;if(c.has(l))return true}}return c.delete(n),false};return p(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=se.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=se.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=se.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=se.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
46
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=
|
|
45
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function ps({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),l=useRef(null);useEffect(()=>{function n(u){s.current&&!s.current.contains(u.target)&&l.current&&!l.current.contains(u.target)&&o(false);}if(r)return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=n=>{t(n),o(false);},m=e.reduce((n,u)=>{let d=u.category||"Other";return n[d]||(n[d]=[]),n[d].push(u),n},{});return jsxs("div",{className:C("relative inline-block",a),children:[jsxs("button",{ref:l,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",n.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:n=>{n.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",n.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:C("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(m).map(([n,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:n})}),jsx("div",{children:u.map(d=>jsxs("button",{onClick:()=>p(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:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},n)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function us({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[l,p]=useState("export"),[m,n]=useState("json"),[u,d]=useState(null),i=useRef(null);if(!t)return null;let c=async()=>{let f=o?.current||void 0,y=await $i(e,m,f);zi(y,m);},v=async f=>{let y=f.target.files?.[0];if(y){try{let x=await Gi(y),b=y.name.endsWith(".json")?"json":"csv",g=Wi(x,b);d(g),g.success&&r&&r(g,x);}catch(x){d({success:false,errors:[`Failed to read file: ${x instanceof Error?x.message:"Unknown error"}`]});}i.current&&(i.current.value="");}};return jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>p("export"),className:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>p("import"),className:C("flex-1 px-6 py-4 font-semibold transition-colors",l==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[l==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(f=>jsxs("button",{onClick:()=>n(f),className:C("p-4 rounded-lg border-2 transition-all text-center",m===f?"border-blue-500 bg-blue-500/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[f==="json"&&"\u{1F4C4}",f==="csv"&&"\u{1F4CA}",f==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:f})]},f))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:c,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"})]}),l==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:i,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxs("button",{onClick:()=>i.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxs("div",{className:C("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:C("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((f,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",f]},y))})]})]})]})]})]})}var yu=["URGENT","HIGH","MEDIUM","LOW"],vu=[{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"}],xu=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function gs({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:l,onFilterHighPriority:p,availableUsers:m=[],availableLabels:n=[],availableColumns:u=[],showQuickFilters:d=true,compact:i=false,groupBy:c="none",onGroupByChange:v}){let[f,y]=useState(true),x=useCallback(k=>{a({search:k.target.value});},[a]),b=useCallback(k=>{a({dateFilter:k.target.value});},[a]),g=useCallback(k=>{r({by:k.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),T=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${i?"filter-bar--compact":""} ${f?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!f),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:f?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:k=>{k.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:f?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),T&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!f&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),l&&jsx("button",{onClick:l,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),p&&jsx("button",{onClick:p,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:x,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:b,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:k=>{let N=k.target.value;a({priorities:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),yu.map(k=>jsx("option",{value:k,children:k},k))]})}),m.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:k=>{let N=k.target.value;a({assignees:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),m.map(k=>jsx("option",{value:k.id,children:k.name},k.id))]})}),n.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:k=>{let N=k.target.value;a({labels:N==="all"?[]:[N]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),n.map(k=>jsx("option",{value:k,children:k},k))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:g,className:"filter-bar__select filter-bar__select--sm",children:vu.map(k=>jsx("option",{value:k.value,children:k.label},k.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),v&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:c,onChange:k=>v(k.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:xu.map(k=>jsx("option",{value:k.value,children:k.label},k.value))})}),T&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function fs({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:l,onExportGanttPNG:p,onExportGanttCSV:m}){let[n,u]=useState(false),d=useRef(null);useEffect(()=>{let c=v=>{d.current&&!d.current.contains(v.target)&&u(false);};return n&&document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c);}},[n]);let i=c=>{c(),u(false);};return jsxs("div",{className:C("relative",r),ref:d,children:[jsxs("button",{onClick:()=>u(!n),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",c.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",c.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":n,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),n&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>i(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>i(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>i(async()=>await 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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>i(async()=>await p?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>i(()=>m?.()),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:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>i(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>i(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:c=>{c.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:c=>{c.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var bs={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"}},hs={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"}},ys={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"}},br={dark:bs,light:hs,neutral:ys},Vo="dark";var jo=createContext(void 0),Mu="asakaa-theme";function _l({children:e,defaultTheme:t=Vo,storageKey:a=Mu}){let[r,o]=useState(()=>{if(typeof window<"u"){let p=localStorage.getItem(a);if(p&&(p==="dark"||p==="light"||p==="neutral"))return p}return t}),s=useCallback(p=>{o(p),typeof window<"u"&&localStorage.setItem(a,p);},[a]);useEffect(()=>{if(typeof window>"u")return;let p=document.documentElement,m=br[r];Object.entries(m.colors).forEach(([u,d])=>{d&&p.style.setProperty(`--theme-${Au(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 i=m.colors[u];i&&p.style.setProperty(d,i);}),p.setAttribute("data-theme",r),p.classList.remove("theme-dark","theme-light","theme-neutral"),p.classList.add(`theme-${r}`);},[r]);let l={theme:r,setTheme:s,themes:br};return jsx(jo.Provider,{value:l,children:e})}function $r(){let e=useContext(jo);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Au(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function vs({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=$r();return e?jsxs("div",{className:C("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(br).map(([s,l])=>jsxs("button",{onClick:()=>{o(s),t();},className:C("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:l.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:l.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function Vl(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return $e[e]||$e.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,l)=>a.getPropertyValue(s).trim()||l;return {bgPrimary:r("--theme-bg-primary",$e[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",$e[e].bgSecondary),bgGrid:r("--theme-bg-card",$e[e].bgGrid),bgWeekend:r("--theme-bg-hover",$e[e].bgWeekend),border:r("--theme-border-primary",$e[e].border),borderLight:r("--theme-border-subtle",$e[e].borderLight),textPrimary:r("--theme-text-primary",$e[e].textPrimary),textSecondary:r("--theme-text-secondary",$e[e].textSecondary),textTertiary:r("--theme-text-tertiary",$e[e].textTertiary),accent:r("--theme-accent-primary",$e[e].accent),accentHover:r("--theme-accent-hover",$e[e].accentHover),accentLight:r("--theme-accent-primary",$e[e].accentLight),taskBarPrimary:r("--theme-accent-primary",$e[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",$e[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",$e[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",$e[e].dependency),dependencyHover:r("--theme-border-secondary",$e[e].dependencyHover),criticalPath:r("--theme-error",$e[e].criticalPath),criticalPathLight:r("--theme-error",$e[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",$e[e].today):e==="neutral"?r("--theme-text-primary",$e[e].today):r("--theme-error",$e[e].today),todayLight:e==="light"?r("--theme-accent-primary",$e[e].todayLight):e==="neutral"?r("--theme-text-primary",$e[e].todayLight):r("--theme-error",$e[e].todayLight),milestone:r("--theme-warning",$e[e].milestone),milestoneLight:r("--theme-warning",$e[e].milestoneLight),statusTodo:r("--theme-text-tertiary",$e[e].statusTodo),statusInProgress:r("--theme-accent-primary",$e[e].statusInProgress),statusCompleted:r("--theme-success",$e[e].statusCompleted),hoverBg:r("--theme-bg-hover",$e[e].hoverBg),focusRing:r("--theme-accent-primary",$e[e].focusRing)}}var Ko={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today"},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},jl={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy"},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},xs={en:Ko,es:jl};function Kl(e){return xs[e]||xs.en}function ks(e,t){let a=Kl(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var Ur=createContext(Ko);function io(){return useContext(Ur)}function Yu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:l}){let[p,m]=useState(false),[n,u]=useState(null),d=useRef(null),i=io();if(useEffect(()=>{let y=x=>{d.current&&!d.current.contains(x.target)&&m(false);};return p&&document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]),!(t||a||r||o||s||l))return null;let v=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:o},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:l}].filter(y=>y.handler),f=async(y,x)=>{if(x){u(y);try{await x();}catch(b){console.error(`Export ${y} failed:`,b);}finally{u(null),m(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>m(!p),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:p?e.accent:e.bgSecondary,border:`1px solid ${p?e.accent:e.borderLight}`,color:p?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:i.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:p?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:p&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:v.map((y,x)=>jsxs(motion.button,{onClick:()=>f(y.id,y.handler),disabled:n!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:n===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})})]})}function qu({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let l=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:l?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:l?600:500,zIndex:l?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[l&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:l?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Xu({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(o=>{let s=t===o.value;return jsxs(motion.button,{onClick:()=>a(o.value),className:"relative px-3 py-1.5 text-xs transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:o.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},o.value)})})}function Ju({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),l=io();useEffect(()=>{let n=u=>{s.current&&!s.current.contains(u.target)&&o(false);};return r&&document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r]);let p=[{value:"compact",label:l.toolbar.compact||"Compact"},{value:"comfortable",label:l.toolbar.normal||"Normal"},{value:"spacious",label:l.toolbar.spacious||"Spacious"}],m=p.find(n=>n.value===t)?.label||"Normal";return jsxs("div",{ref:s,className:"relative",children:[jsx(motion.button,{onClick:()=>o(!r),className:"flex items-center justify-center p-2 rounded-lg transition-all",style:{backgroundColor:r?e.accentLight:e.bgSecondary,border:`1px solid ${r?e.accent:e.borderLight}`,color:r?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${l.toolbar.density||"Density"}: ${m}`,children:jsx(Rows3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute left-0 mt-2 w-36 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:p.map((n,u)=>{let d=t===n.value;return jsxs(motion.button,{onClick:()=>{a(n.value),o(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:d?e.accentLight:"transparent",borderBottom:u<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:d?e.accentLight:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:n.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},n.value)})})})})]})}function Yo({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:l,rowDensity:p,onRowDensityChange:m,showThemeSelector:n=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:i,onExportPNG:c,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}){let g=io(),w=c||v||f||y||x||b,T=[{value:"day",label:g.toolbar.day},{value:"week",label:g.toolbar.week},{value:"month",label:g.toolbar.month}],k=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}];return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.bgGrid,borderColor:e.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(Xu,{options:T,value:t,onChange:N=>a(N),theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>o(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-xs tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>o(Math.min(2,r+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Ju,{theme:e,value:p,onChange:m})]}),jsxs("div",{className:"flex items-center gap-3",children:[u&&i&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:i,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(59, 130, 246, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(59, 130, 246, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||g.toolbar.createTask})]}),(w||n)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxs(Fragment,{children:[jsx(Yu,{theme:e,onExportPNG:c,onExportPDF:v,onExportExcel:f,onExportCSV:y,onExportJSON:x,onExportMSProject:b}),n&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),n&&jsx(qu,{options:k,value:s,onChange:N=>l(N),theme:e})]})]})}function qo({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,l]=useState({x:0,y:0}),p=useRef(null),m=useRef(null);useEffect(()=>{if(!r)return;let u=d=>{p.current&&!p.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let n=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:m,onClick:()=>{if(!r&&m.current){let u=m.current.getBoundingClientRect();l({x:u.left,y:u.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(at,{children:jsx(motion.div,{ref:p,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),n.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function Wr({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let l=useRef(null),[p,m]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,d=r.length*36+8,i=8,c=window.innerWidth,v=window.innerHeight,f=t,y=a;t+u+i>c&&(f=t-u,f<i&&(f=i)),a+d+i>v&&(y=v-d-i,y<i&&(y=i)),m({x:f,y});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=i=>{l.current&&!l.current.contains(i.target)&&o();},d=i=>{i.key==="Escape"&&o();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let n=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref: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,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${p.x}px`,top:`${p.y}px`,backgroundColor:n(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),o());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:d=>{u.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var vt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function sd({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:l,onTaskIndent:p,onTaskOutdent:m,onTaskRename:n,onTaskToggleExpand:u,onOpenTaskModal:d,enableKeyboard:i=true}){let c=useRef(false),v=useCallback(g=>{c.current=g;},[]),f=useCallback(g=>{let w=[],T=k=>{for(let N of k)w.push(N),N.subtasks&&N.subtasks.length>0&&N.isExpanded&&T(N.subtasks);};return T(g),w},[]),y=useCallback(()=>{let g=f(e);for(let w of g)if(t.has(w.id))return w;return null},[e,t,f]),x=useCallback((g,w)=>{let T=f(e);if(T.length===0)return;let k=y();if(!k){a(T[0].id,false);return}let N=T.findIndex(D=>D.id===k.id);if(N===-1)return;let h=g==="up"?N-1:N+1;if(h<0||h>=T.length)return;let M=T[h];a(M.id,w);},[e,y,f,a]),b=useCallback(g=>{if(!i)return;let w=g.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||c.current){g.key==="Escape"&&(w.blur(),c.current=false);return}let N=navigator.platform.toUpperCase().indexOf("MAC")>=0?g.metaKey:g.ctrlKey,h=Array.from(t),M=y();if(g.key==="ArrowUp"){g.preventDefault(),x("up",g.shiftKey);return}if(g.key==="ArrowDown"){g.preventDefault(),x("down",g.shiftKey);return}if(M&&(g.key==="ArrowRight"||g.key==="ArrowLeft")){M.subtasks&&M.subtasks.length>0&&(g.preventDefault(),(g.key==="ArrowRight"&&!M.isExpanded||g.key==="ArrowLeft"&&M.isExpanded)&&u(M.id));return}if(g.altKey&&(g.key==="ArrowUp"||g.key==="ArrowDown")){h.length>0&&(g.preventDefault(),l(h,g.key==="ArrowUp"?"up":"down"));return}if(g.key==="Tab"&&!g.shiftKey){h.length>0&&(g.preventDefault(),p(h));return}if(g.key==="Tab"&&g.shiftKey){h.length>0&&(g.preventDefault(),m(h));return}if(g.key==="Enter"&&!g.shiftKey&&!N){M&&(g.preventDefault(),r(M.id,"below"));return}if(g.key==="Enter"&&g.shiftKey&&!N){M&&(g.preventDefault(),r(M.id,"above"));return}if(g.key==="Enter"&&N){M&&(g.preventDefault(),d(M.id));return}if(g.key==="F2"){M&&(g.preventDefault(),n(M.id));return}if(g.key==="Delete"||g.key==="Backspace"&&N){h.length>0&&(g.preventDefault(),o(h));return}if(g.key==="d"&&N&&!g.shiftKey){h.length>0&&(g.preventDefault(),s(h));return}},[i,t,y,x,r,o,s,l,p,m,n,u,d]);return useEffect(()=>{if(i)return window.addEventListener("keydown",b),()=>{window.removeEventListener("keydown",b);}},[i,b]),{setIsEditing:v}}function ld(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(i=>{let c=new Set(i);return c.has(d)?c.delete(d):c.add(d),c}),r(d);},[]),l=useCallback((d,i)=>{if(!a){o(d);return}let c=i.indexOf(a),v=i.indexOf(d);if(c===-1||v===-1){o(d);return}let f=Math.min(c,v),y=Math.max(c,v),x=i.slice(f,y+1);t(new Set(x)),r(d);},[a,o]),p=useCallback((d,i,c,v)=>{v?l(d,i):c?s(d):o(d);},[o,s,l]),m=useCallback((d,i)=>{i?t(c=>{let v=new Set(c);return v.add(d),v}):o(d);},[o]),n=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:l,handleTaskClick:p,handleKeyboardSelection:m,clearSelection:n,isTaskSelected:u}}function Gr(e){let t=[],a=(r,o,s=0)=>{for(let l=0;l<r.length;l++){let p={...r[l],parentId:o,level:s,position:l};t.push(p),p.subtasks&&p.subtasks.length>0&&p.isExpanded&&a(p.subtasks,p.id,s+1);}};return a(e),t}function dd(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=dd(a.subtasks,t);if(r)return r}}return null}function Ts(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=Ts(a.subtasks,t);if(r)return r}return null}function Ds(e,t){if(t.length===0)return e;let a=Gr(e),r=t[0],o=a.findIndex(d=>d.id===r);if(o<=0)return e;let s=a[o-1],l=(d,i)=>{let c=[];return {tasks:d.filter(f=>{if(i.has(f.id))return c.push(f),false;if(f.subtasks){let y=l(f.subtasks,i);f.subtasks=y.tasks,c.push(...y.removed);}return true}),removed:c}},p=(d,i,c)=>d.map(v=>v.id===i?{...v,subtasks:[...v.subtasks||[],...c],isExpanded:true}:v.subtasks?{...v,subtasks:p(v.subtasks,i,c)}:v),m=new Set(t),{tasks:n,removed:u}=l(e,m);return p(n,s.id,u)}function Ns(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=Ts(a,r);if(!o)continue;let s=Ts(a,o.id),l=(n,u,d)=>{for(let i=0;i<n.length;i++){let c=n[i];if(c.id===u&&c.subtasks){let v=c.subtasks.findIndex(f=>f.id===d);if(v!==-1){let[f]=c.subtasks.splice(v,1);return f}}if(c.subtasks){let v=l(c.subtasks,u,d);if(v)return v}}return null},p=(n,u,d)=>{let i=n.findIndex(c=>c.id===u);if(i!==-1)return n.splice(i+1,0,d),n;for(let c of n)c.subtasks&&p(c.subtasks,u,d);return n},m=l(a,o.id,r);m&&(s&&s.subtasks?p(s.subtasks,o.id,m):p(a,o.id,m));}return a}function Ss(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(l,p,m)=>{let n=l.findIndex(d=>d.id===p);if(n===-1){for(let d of l)if(d.subtasks&&s(d.subtasks,p,m))return true;return false}let u=m==="up"?n-1:n+1;return u<0||u>=l.length?false:([l[n],l[u]]=[l[u],l[n]],true)};return s(r,o,a),r}function Es(e,t){let a=new Set(t),r=o=>o.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Ps(e,t){let a=[...e];for(let r of t){let o=l=>{let p=l.findIndex(u=>u.id===r);if(p===-1){for(let u of l)if(u.subtasks&&o(u.subtasks))return true;return false}let m=l[p],n={...m,id:`${m.id}-copy-${Date.now()}`,name:`${m.name} (Copy)`,subtasks:m.subtasks?s(m.subtasks):void 0};return l.splice(p+1,0,n),true},s=l=>l.map(p=>({...p,id:`${p.id}-copy-${Date.now()}`,subtasks:p.subtasks?s(p.subtasks):void 0}));o(a);}return a}function cd(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},p=m=>{let n=m.findIndex(d=>d.id===t);if(n===-1){for(let d of m)if(d.subtasks&&p(d.subtasks))return true;return false}let u=a==="above"?n:n+1;return m.splice(u,0,l),true};return p(r),{tasks:r,newTask:l}}function Ms(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Ms(r.subtasks,t,a)}:r)}function As(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:As(a.subtasks,t)}:a)}function Is(e,t){let a=u=>{for(let d of u){if(d.id===t)return d;if(d.subtasks){let i=a(d.subtasks);if(i)return i}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let l=r?.startDate||o,p=r?.endDate||s,m={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(l),endDate:new Date(p),color:r?.color||"#3B82F6"},n=u=>u.map(d=>{if(d.id===t){let i=d.subtasks||[];return {...d,subtasks:[...i,m],isExpanded:true}}return d.subtasks?{...d,subtasks:n(d.subtasks)}:d});return {tasks:n(e),newTask:m}}function pd(e,t,a,r){if(t===a)return e;let o=dd(e,t);if(!o)return e;if(a){let p=(m,n)=>{if(!m.subtasks)return false;for(let u of m.subtasks)if(u.id===n||p(u,n))return true;return false};if(p(o,a))return e}let s=p=>p.filter(m=>m.id!==t).map(m=>m.subtasks&&m.subtasks.length>0?{...m,subtasks:s(m.subtasks)}:m),l=s(e);if(a===null){let p=r!==void 0?r:l.length;l.splice(p,0,{...o,parentId:void 0});}else {let p=m=>m.map(n=>{if(n.id===a){let u=n.subtasks||[],d=r!==void 0?r:u.length,i=[...u];return i.splice(d,0,{...o,parentId:a}),{...n,subtasks:i,isExpanded:true}}return n.subtasks&&n.subtasks.length>0?{...n,subtasks:p(n.subtasks)}:n});l=p(l);}return l}function Zo({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:l,onTaskContextMenu:p,onTaskToggle:m,scrollTop:n,columns:u,onToggleColumn:d,onColumnResize:i,onTaskUpdate:c,onTaskIndent:v,onTaskOutdent:f,onTaskMove:y,onMultiTaskDelete:x,onTaskDuplicate:b,onTaskCreate:g,onTaskRename:w,onCreateSubtask:T,onOpenTaskModal:k,onDeleteRequest:N,onTaskReparent:h}){let M=useContext(Ur),[D,$]=useState(null),[W,F]=useState(false),[G,Z]=useState(null),[ve,ke]=useState(""),Me=useRef(null),Oe=useRef(null),[B,S]=useState(null),[R,P]=useState(0),[K,te]=useState(0),[Y,ce]=useState({isOpen:false,x:0,y:0,type:"header"}),[pe,je]=useState(null),[me,qe]=useState(null),[L,re]=useState(null),Ne=useRef(0),Le=5,Be=useRef(false),[Je,kt]=useState(null),[xe,tt]=useState(false),[Ze,st]=useState(null);useEffect(()=>{function U(H){Me.current&&!Me.current.contains(H.target)&&F(false);}if(W)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[W]),useEffect(()=>{G&&Oe.current&&(Oe.current.focus(),Oe.current.select());},[G]),useEffect(()=>{if(!B)return;let U=ot=>{let Ue=ot.clientX-R,A=K+Ue;i?.(B,A);},H=()=>{S(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",H),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",H),document.body.style.cursor="",document.body.style.userSelect="";}},[B,R,K,i]);let{selectedTaskIds:Nt,handleTaskClick:be,isTaskSelected:O}=ld(),{setIsEditing:Ce}=sd({tasks:e,selectedTaskIds:Nt,onTaskSelect:(U,H)=>{let Ue=Gr(e).map(A=>A.id);be(U,Ue,H||false,false);},onTaskCreate:g||(()=>{}),onTaskDelete:x||(()=>{}),onTaskDuplicate:b||(()=>{}),onTaskMove:y||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:f||(()=>{}),onTaskRename:U=>{let H=Gr(e).find(ot=>ot.id===U);H&&J(H);},onTaskToggleExpand:m||(()=>{}),onOpenTaskModal:U=>{let H=Gr(e).find(ot=>ot.id===U);H&&k&&k(H);},enableKeyboard:true}),Ke=(U,H=0)=>{let ot=[];for(let Ue of U)ot.push({task:Ue,level:H}),Ue.subtasks&&Ue.subtasks.length>0&&Ue.isExpanded&&ot.push(...Ke(Ue.subtasks,H+1));return ot},Ve=Ke(e),St=48,q=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,J=U=>{Z(U.id),ke(U.name),Ce(true);},we=U=>{ve.trim()&&ve!==e.find(H=>H.id===U)?.name&&w?.(U,ve.trim()),Z(null),ke(""),Ce(false);},he=()=>{Z(null),ke(""),Ce(false);},Q=(U,H)=>{H.stopPropagation(),T?.(U.id);},De=(U,H)=>{H.preventDefault(),Ne.current=H.clientY,je(U),Be.current=false,tt(false),kt({x:H.clientX,y:H.clientY});},ge=U=>{if(!pe||(Math.abs(U.clientY-Ne.current)>Le&&!Be.current&&(Be.current=true,tt(true)),kt({x:U.clientX,y:U.clientY}),!Be.current))return;let ot=document.querySelectorAll("[data-task-row]"),Ue=null,A=null;ot.forEach(ie=>{let Se=ie.getBoundingClientRect(),et=ie.getAttribute("data-task-row");if(et&&et!==pe&&U.clientY>=Se.top&&U.clientY<=Se.bottom){Ue=et;let gt=U.clientY-Se.top,wt=Se.height;gt<wt*.25?A="above":gt>wt*.75?A="below":A="child";}}),qe(Ue),re(A);},Te=()=>{if(Be.current&&pe&&me&&L){if(L==="child")h?.(pe,me);else if(L==="above"||L==="below"){let U=(Ue,A,ie=null)=>{for(let Se of Ue){if(Se.id===A)return ie;if(Se.subtasks){let et=U(Se.subtasks,A,Se.id);if(et!==void 0)return et}}},H=U(e,me,null),ot=(Ue,A)=>{let ie=Ue.findIndex(Se=>Se.id===A);return L==="below"?ie+1:ie};if(H===null){let Ue=ot(e,me);h?.(pe,null,Ue);}else {let Ue=Ve.find(A=>A.task.id===H)?.task;if(Ue?.subtasks){let A=ot(Ue.subtasks,me);h?.(pe,H,A);}}}}je(null),qe(null),re(null),kt(null),Be.current=false,tt(false);};useEffect(()=>{if(pe)return document.addEventListener("mousemove",ge),document.addEventListener("mouseup",Te),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ge),document.removeEventListener("mouseup",Te),document.body.style.cursor="",document.body.style.userSelect="";}},[pe,me,L]);let ue=(U,H,ot)=>{switch(U.id){case "name":let Ue=G===H.id,A=D===H.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${ot*20}px`},children:[h&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:A?1:.3},onMouseDown:se=>De(H.id,se),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),H.subtasks&&H.subtasks.length>0?jsx("button",{onClick:se=>{se.stopPropagation(),m?.(H.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:H.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),!(H.subtasks&&H.subtasks.length>0)&&jsx("div",{className:"w-3 h-3 rounded-full flex-shrink-0 border",style:{backgroundColor:H.color||"#3B82F6",opacity:H.parentId?.6:1,borderColor:H.isMilestone?t.accent:"transparent",borderWidth:H.isMilestone?"2px":"0px"},title:H.isMilestone?"Milestone":H.parentId?"Subtask":"Task"}),Ue?jsx("input",{ref:Oe,type:"text",value:ve,onChange:se=>ke(se.target.value),onKeyDown:se=>{se.key==="Enter"?we(H.id):se.key==="Escape"&&he();},onBlur:()=>we(H.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:se=>se.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:H.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:H.parentId?"13px":"14px",fontWeight:H.isMilestone?600:H.parentId?400:600,letterSpacing:H.parentId?"0":"-0.01em"},title:H.name,children:H.name}),A&&!Ue&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:se=>se.stopPropagation(),children:[jsx("button",{onClick:se=>Q(H,se),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:se=>{se.stopPropagation(),J(H);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let Se=U.id==="startDate"?"startDate":"endDate",et=H[Se],gt=Ze?.taskId===H.id&&Ze?.field===Se,wt=se=>se?(typeof se=="string"?new Date(se):se).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:se=>se.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary},onClick:se=>{if(gt)st(null);else {let Ct=se.currentTarget.getBoundingClientRect();st({taskId:H.id,field:Se,month:et?typeof et=="string"?new Date(et):et:new Date,position:{top:Ct.bottom+4,left:Ct.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:wt(et)})]}),gt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>st(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:Ze?.position.top,left:Ze?.position.left},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let se=new Date,Ct=new Date(se);Ct.setDate(se.getDate()+1);let Xt=new Date(se);Xt.setDate(se.getDate()+7);let Ka=new Date(se);return Ka.setDate(se.getDate()+14),[{label:"Hoy",date:se},{label:"Ma\xF1ana",date:Ct},{label:"Pr\xF3xima semana",date:Xt},{label:"2 semanas",date:Ka}].map((Er,Oa)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Ya=>Ya.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ya=>Ya.currentTarget.style.backgroundColor="transparent",onClick:()=>{c?.(H.id,{[Se]:Er.date}),st(null);},children:Er.label},Oa))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:se=>se.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{c?.(H.id,{[Se]:void 0}),st(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>st(se=>se?{...se,month:new Date(se.month.getFullYear(),se.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:Ze?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>st(se=>se?{...se,month:new Date(se.month.getFullYear(),se.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((se,Ct)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:se},Ct))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let se=Ze?.month||new Date,Ct=se.getFullYear(),Xt=se.getMonth(),Ka=new Date(Ct,Xt,1).getDay(),Do=new Date(Ct,Xt+1,0).getDate(),Er=new Date,Oa=[];for(let Et=Ka-1;Et>=0;Et--)Oa.push({day:new Date(Ct,Xt,-Et).getDate(),date:new Date(Ct,Xt-1,new Date(Ct,Xt,-Et).getDate()),isCurrentMonth:false});for(let Et=1;Et<=Do;Et++)Oa.push({day:Et,date:new Date(Ct,Xt,Et),isCurrentMonth:true});let Ya=42-Oa.length;for(let Et=1;Et<=Ya;Et++)Oa.push({day:Et,date:new Date(Ct,Xt+1,Et),isCurrentMonth:false});return Oa.map((Et,No)=>{let So=Et.date.toDateString()===Er.toDateString(),Yr=(et?typeof et=="string"?new Date(et):et:null)?.toDateString()===Et.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:Et.isCurrentMonth?Yr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Yr?"#3B82F6":"transparent",boxShadow:So&&!Yr?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{c?.(H.id,{[Se]:Et.date}),st(null);},children:Et.day},No)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:q(H)})});case "assignees":let Sr=r.filter(se=>H.assignees?.some(Ct=>Ct.name===se.name||Ct.initials===se.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(mr,{assignedUsers:Sr,availableUsers:r,onChange:se=>{let Ct=se.map(Xt=>({id:Xt.id,name:Xt.name,initials:Xt.initials,color:Xt.color}));c?.(H.id,{assignees:Ct.length>0?Ct:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(il,{status:H.status||"todo",onChange:se=>{c?.(H.id,{status:se,progress:se==="completed"?100:H.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${H.progress}%`,backgroundColor:H.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[H.progress,"%"]})]});case "priority":let sr={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},ja={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ir=sr[H.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:se=>se.stopPropagation(),children:jsx(cr,{priority:ir,onChange:se=>{se&&c?.(H.id,{priority:ja[se]||"medium"});}})});default:return null}},Pe=U=>[{id:"hide",label:"Hide Column",icon:vt.Hide,onClick:()=>d(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:vt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:vt.SortDesc,onClick:()=>{}}],Ae=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:vt.Add,onClick:()=>{T?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:vt.Delete,onClick:()=>{N?N(U.id,U.name):x?.([U.id]);}}]:[{id:"edit",label:M?.contextMenu?.editTask||"Edit Task",icon:vt.Pencil,onClick:()=>{l?.(U);}},{id:"addSubtask",label:M?.contextMenu?.addSubtask||"Add Subtask",icon:vt.Add,onClick:()=>{T?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:M?.contextMenu?.markIncomplete||"Mark Incomplete",icon:vt.MarkIncomplete,onClick:()=>{c?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:M?.contextMenu?.setInProgress||"Set In Progress",icon:vt.SetInProgress,onClick:()=>{c?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:M?.contextMenu?.markComplete||"Mark Complete",icon:vt.MarkComplete,onClick:()=>{c?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"split",label:M?.contextMenu?.splitTask||"Split Task",icon:vt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:M?.contextMenu?.deleteTask||"Delete Task",icon:vt.Delete,onClick:()=>{N?N(U.id,U.name):x?.([U.id]);}}],Fe=u.filter(U=>U.visible);return jsxs("div",{className:"h-full overflow-hidden",style:{backgroundColor:t.bgPrimary},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${St}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[Fe.map((U,H)=>{let ot=H===Fe.length-1,Ue=U.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${Ue?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(Ue?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:ot?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:A=>{A.preventDefault(),ce({isOpen:true,x:A.clientX,y:A.clientY,type:"header",columnId:U.id});},onMouseEnter:A=>{A.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:A=>{A.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:Ue?"70px":"0"},title:U.label,children:U.label}),Ue&&jsxs("div",{className:"absolute flex items-center gap-1",style:{right:"4px",top:"50%",transform:"translateY(-50%)",zIndex:4},children:[jsx(qo,{columns:u,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>F(!W),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors relative group",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})})]}),U.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:B===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:A=>{A.preventDefault(),A.stopPropagation(),S(U.id),P(A.clientX),te(U.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-2 bottom-2 opacity-0 group-hover:opacity-100 transition-opacity",style:{left:"3px",width:"2px",backgroundColor:t.accent,borderRadius:"1px"}})})]},U.id)}),W&&jsxs("div",{ref:Me,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:U=>U.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>F(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",children:Ve.map(({task:U,level:H},ot)=>{let Ue=O(U.id),A=me===U.id,ie=A&&L==="above",Se=A&&L==="below",et=A&&L==="child",gt={};return et&&(gt.backgroundColor=`${t.accent}15`,gt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${pe===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:Ue?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:Ue?t.accentLight:et?`${t.accent}15`:ot%2===0?t.bgPrimary:t.bgGrid,...gt},onMouseEnter:()=>$(U.id),onMouseLeave:()=>$(null),onClick:wt=>{let sr=Gr(e).map(se=>se.id),ir=navigator.platform.toUpperCase().indexOf("MAC")>=0?wt.metaKey:wt.ctrlKey;be(U.id,sr,ir,wt.shiftKey),s?.(U);},onDoubleClick:wt=>{wt.stopPropagation(),l?.(U);},onContextMenu:wt=>{wt.preventDefault(),ce({isOpen:true,x:wt.clientX,y:wt.clientY,type:"task",task:U}),p?.(U,wt);},whileHover:{backgroundColor:Ue?t.accentLight:t.hoverBg},children:[ie&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Se&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Fe.map((wt,Sr)=>{let sr=Sr===Fe.length-1,ja=wt.id==="name";return jsx("div",{className:`px-4 flex items-center ${ja?"justify-start":"justify-center"}`,style:{width:`${wt.width}px`,minWidth:`${wt.minWidth??(ja?200:60)}px`,maxWidth:`${wt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:sr?"none":`1px solid ${D===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:ue(wt,U,ja?H:0)},`${U.id}-${wt.id}`)})]},U.id)})}),jsx(Wr,{isOpen:Y.isOpen,x:Y.x,y:Y.y,items:Y.type==="header"&&Y.columnId?Pe(Y.columnId):Y.type==="task"&&Y.task?Ae(Y.task):[],onClose:()=>ce({...Y,isOpen:false}),theme:t}),xe&&Je&&pe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Je.x+12,top:Je.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=Ve.find(H=>H.task.id===pe)?.task;return U?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:U.name})}):null})()}),document.body)]})}function bd(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[l,p]=useState(e),[m,n]=useState(t),[u,d]=useState(null),[i,c]=useState(null),[v,f]=useState(null),[y,x]=useState(null),[b,g]=useState(0),[w,T]=useState(0),[k,N]=useState(null),[h,M]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:l,setGhostX:p,ghostWidth:m,setGhostWidth:n,connectionLine:u,setConnectionLine:d,hoveredTaskId:i,setHoveredTaskId:c,activeZone:v,setActiveZone:f,draggedSegmentIndex:y,setDraggedSegmentIndex:x,draggedSegmentStartX:b,setDraggedSegmentStartX:g,segmentDragOffsetX:w,setSegmentDragOffsetX:T,hoveredSegmentIndex:k,setHoveredSegmentIndex:N,isHovered:h,setIsHovered:M,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(G,Z)=>{r("none"),d(null),c(null),p(G),n(Z),T(0),x(null),g(0);}}}function Qo({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:l,templates:p,onClick:m,onDoubleClick:n,onContextMenu:u,onDateChange:d,onDependencyCreate:i,allTaskPositions:c=[],onDragMove:v,onHoverChange:f}){let y=bd(t,r),x=useRef(null),{dragMode:b,setDragMode:g,dragOffset:w,setDragOffset:T,ghostX:k,setGhostX:N,ghostWidth:h,setGhostWidth:M,connectionLine:D,setConnectionLine:$,hoveredTaskId:W,setHoveredTaskId:F,activeZone:G,setActiveZone:Z,draggedSegmentIndex:ve,setDraggedSegmentIndex:ke,draggedSegmentStartX:Me,setDraggedSegmentStartX:Oe,segmentDragOffsetX:B,setSegmentDragOffsetX:S,hoveredSegmentIndex:R,setHoveredSegmentIndex:P,isHovered:K,setIsHovered:te,isDragging:Y,isResizing:ce,isConnecting:pe,resetDragState:je}=y,me=32,qe=8,L=e.endDate&&e.endDate<new Date&&e.progress<100,re=e.isCriticalPath,Ne=o.name==="neutral"||o.today==="#1C1917",Le=e.status==="completed"||e.progress===100,Be={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},kt=e.isCriticalPath||L?"#DC2626":e.color?e.color:e.priority&&Be[e.priority]?Be[e.priority]:o.taskBarPrimary,tt=(Q=>Q>=80?20:Q>=60?15:Q>=50?12:10)(r),Ze=r<50,st=r<40;useEffect(()=>{if(f)if(K&&!Y&&!e.segments){let Q=a<100;f({task:e,x:t,y:a,width:r,height:me,showBelow:Q});}else f(null);},[K,Y,e,t,a,r,me,f]);let Nt=Q=>Q.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),be=()=>{let Q=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${Q} day${Q!==1?"s":""}`},O=Q=>Math.round(Q/s)*s,Ce=Q=>{let De=Math.round(Q/s),ge=new Date(l);return ge.setDate(ge.getDate()+De),ge},Ke=(Q,De)=>{for(let ge of c){if(ge.id===e.id)continue;let Te=5;if(Q>=ge.x-Te&&Q<=ge.x+ge.width+Te&&De>=ge.y-Te&&De<=ge.y+ge.height+Te)return ge.id}return null},Ve=useCallback((Q,De,ge)=>{Q.preventDefault(),Q.stopPropagation();let Te=x.current?.ownerSVGElement;if(!Te)return;let ue=Te.createSVGPoint();ue.x=Q.clientX,ue.y=Q.clientY;let Pe=ue.matrixTransform(Te.getScreenCTM()?.inverse()),Ae=ge!==void 0?ge:t,Fe=De;if(!Fe){let U=Pe.x-Ae;Q.shiftKey?(Fe="connect",$({x:t+r,y:a+me/2})):Q.ctrlKey||Q.metaKey?Fe="move":Q.altKey?Fe=U<r/2?"resize-start":"resize-end":st?U<r/2?Fe="move":Fe="resize-end":Ze?U<=tt/2?Fe="resize-start":U>=r-tt/2?Fe="resize-end":Fe="move":U<=tt?Fe="resize-start":U>=r-tt?Fe="resize-end":Fe="move";}g(Fe),te(false),Z(null),Fe==="move"?T(Pe.x-Ae):Fe==="connect"?$({x:t+r,y:a+me/2}):T(0),N(Ae),M(r);},[t,r,a,me]),St=useCallback(Q=>{if(b==="none")return;let De=x.current?.ownerSVGElement;if(!De)return;let ge=De.createSVGPoint();ge.x=Q.clientX,ge.y=Q.clientY;let Te=ge.matrixTransform(De.getScreenCTM()?.inverse());if(b==="connect"){$({x:Te.x,y:Te.y});let ue=Ke(Te.x,Te.y);F(ue);}else if(b==="move"){let ue=Te.x-w,Pe=O(ue);N(Pe),M(r);let Ae=Math.round((Pe-t)/s);if(v?.(e.id,Ae,true),e.segments&&e.segments.length>0&&ve!==null){let Fe=Pe-Me;S(Fe);}}else if(b==="resize-start"){let ue=Te.x,Pe=O(ue),Ae=t+r-Pe;Ae>=s&&(N(Pe),M(Ae));}else if(b==="resize-end"){let ue=Te.x,Ae=O(ue)-t;Ae>=s&&M(Ae);}},[b,t,r,s,w,e,O,ve,Me,Ke,F,$,N,M,S,v]),q=useCallback(()=>{if(b!=="none"){if(b==="connect")W&&i&&i(e,W),$(null),F(null);else {let Q=e.endDate.getTime()-e.startDate.getTime(),De,ge,Te=true;if(b==="move"){if(De=Ce(k),ge=new Date(De.getTime()+Q),e.segments&&e.segments.length>0&&ve!==null){let ue=Math.round(B/s),Pe=e.segments.map((H,ot)=>{if(ot===ve){let Ue=new Date(H.startDate),A=new Date(H.endDate);return Ue.setDate(Ue.getDate()+ue),A.setDate(A.getDate()+ue),{startDate:Ue,endDate:A}}return H}),Ae=Pe.flatMap(H=>[H.startDate,H.endDate]),Fe=new Date(Math.min(...Ae.map(H=>H.getTime()))),U=new Date(Math.max(...Ae.map(H=>H.getTime())));d?.({...e,segments:Pe},Fe,U),je(t,r);return}}else b==="resize-start"?(De=Ce(k),ge=e.endDate,De>=ge&&(console.warn("Invalid date range: start date must be before end date"),Te=false)):b==="resize-end"?(De=e.startDate,ge=Ce(k+h),ge<=De&&(console.warn("Invalid date range: end date must be after start date"),Te=false)):Te=false;Te&&De&&ge&&(ge.getTime()-De.getTime()<864e5?console.warn("Invalid date range: task must be at least 1 day long"):d?.(e,De,ge));}v?.(e.id,0,false),je(t,r);}},[b,k,h,e,d,W,i,t,r,s,Ce,B,ve,je,v]);useEffect(()=>{if(b==="none")return;let Q=ge=>{St(ge);},De=()=>{q();};return window.addEventListener("mousemove",Q),window.addEventListener("mouseup",De),()=>{window.removeEventListener("mousemove",Q),window.removeEventListener("mouseup",De);}},[b,St,q]);let J=Y&&!pe?k:t,we=Y&&!pe?h:r,he=p.taskClass(e);return jsxs("g",{ref:x,onMouseEnter:()=>!Y&&te(true),onMouseLeave:()=>{Y||(te(false),Z(null));},onClick:()=>!Y&&m?.(e),onDoubleClick:Q=>{Y||(Q.stopPropagation(),n?.(e));},onContextMenu:Q=>{Q.preventDefault(),u?.(e,Q);},children:[K&&!Y&&!Ze&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:tt,height:me,fill:G==="resize-start"?o.accent:"transparent",opacity:G==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Z("resize-start"),onMouseDown:Q=>Ve(Q,"resize-start")}),jsx("rect",{x:t+tt,y:a,width:r-tt*2,height:me,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Z("move"),onMouseDown:Q=>Ve(Q,"move")}),jsx("rect",{x:t+r-tt,y:a,width:tt,height:me,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Z("resize-end"),onMouseDown:Q=>Ve(Q,"resize-end")})]}),K&&!Y&&st&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:me,fill:G==="move"?o.accent:"transparent",opacity:G==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>Z("move"),onMouseDown:Q=>Ve(Q,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:me,fill:G==="resize-end"?o.accent:"transparent",opacity:G==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>Z("resize-end"),onMouseDown:Q=>Ve(Q,"resize-end")}),K&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+me-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Y&&!pe&&!e.segments&&jsx(motion.rect,{x:k,y:a,width:h,height:me,rx:qe,fill:o.accent,opacity:.5,stroke:o.accent,strokeWidth:2,strokeDasharray:"4 4",initial:{opacity:0},animate:{opacity:.6},transition:{duration:.15},style:{pointerEvents:"none"}}),!e.segments&&jsx(motion.rect,{x:J,y:a,width:we,height:me,rx:qe,fill:kt,"data-task-class":he,initial:{opacity:0,scale:.95},animate:{opacity:Y&&!pe?.15:e.parentId?.6:K?.9:.8,scale:K&&!Y?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Q=>Ve(Q),style:{cursor:Y?pe?"crosshair":ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:J,y:a,width:we*(e.progress/100),height:me,rx:qe,fill:kt,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map((Q,De)=>{let ge=(Q.startDate.getTime()-l.getTime())/864e5*s,ue=(Q.endDate.getTime()-l.getTime())/(1e3*60*60*24)*s-ge+s,Pe=Y&&b==="move"&&ve===De,Ae=R===De,Fe=Pe?ge+B:ge;return jsxs("g",{onMouseEnter:()=>!Y&&P(De),onMouseLeave:()=>!Y&&P(null),children:[jsx(motion.rect,{x:Fe,y:a,width:ue,height:me,rx:qe,fill:kt,initial:{opacity:0,scale:.95},animate:{opacity:Pe||e.parentId?.6:Ae?.9:.8,scale:Ae&&!Y?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:U=>{U.stopPropagation(),ke(De),Oe(ge),Ve(U,void 0,ge);},style:{cursor:Y?pe?"crosshair":ce?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Fe,y:a,width:ue*(e.progress/100),height:me,rx:qe,fill:kt,opacity:1,style:{pointerEvents:"none"}})]},`segment-${De}`)}),Ne&&(L||re)&&!e.segments&&jsxs(Fragment,{children:[re&&!L&&jsx("rect",{x:J,y:a,width:we,height:me,rx:qe,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),L&&jsx("rect",{x:J,y:a,width:we,height:me,rx:qe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),we>60&&!e.segments&&(()=>{let Q=p.taskLabel(e),De=typeof Q=="string"?Q:e.name,ge=De.length>Math.floor(we/8)?`${De.substring(0,Math.floor(we/8))}...`:De;return jsx("text",{x:J+12,y:a+me/2,dominantBaseline:"middle",fill:Le?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Le?"line-through":"none"},children:ge})})(),we>100&&e.progress>0&&e.progress<100&&!Y&&!e.segments&&jsxs("text",{x:J+we-12,y:a+me/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&&we>80&&!Y&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:J+we-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:J+we-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(K||ce)&&!pe&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:Ze?J-15:J-10,y:a-5,width:Ze?25:20,height:me+10,fill:"transparent",onMouseDown:Q=>Ve(Q,"resize-start"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ze?J-8:J-3,y:a+6,width:Ze?8:6,height:Ze?me-12:me-16,rx:3,fill:b==="resize-start"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-start"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]}),jsxs("g",{style:{pointerEvents:"all"},children:[jsx("rect",{x:J+we-10,y:a-5,width:Ze?25:20,height:me+10,fill:"transparent",onMouseDown:Q=>Ve(Q,"resize-end"),style:{cursor:"ew-resize"}}),jsx(motion.rect,{x:Ze?J+we:J+we-3,y:a+6,width:Ze?8:6,height:Ze?me-12:me-16,rx:3,fill:b==="resize-end"?o.accent:o.taskBarHandle,stroke:o.taskBarPrimary,strokeWidth:1.5,initial:{opacity:0,scale:0},animate:{opacity:1,scale:b==="resize-end"?1.2:1},transition:{duration:.2,type:"spring",stiffness:400,damping:25},style:{pointerEvents:"none"}})]})]}),jsx(AnimatePresence,{children:K&&!Y&&!e.segments&&jsxs(motion.g,{style:{pointerEvents:"all"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx(motion.circle,{cx:t+r+8,cy:a+me/2,r:6,fill:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},exit:{scale:0},transition:{duration:.2,type:"spring",stiffness:400,damping:25},onMouseDown:Q=>{Q.stopPropagation(),Ve(Q,"connect");},style:{cursor:"crosshair"}}),jsx("text",{x:t+r+20,y:a+me/2,dominantBaseline:"middle",fill:o.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:"Link"})]})}),pe&&D&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+me/2,x2:D.x,y2:D.y,stroke:W?o.statusCompleted:o.accent,strokeWidth:W?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:W?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:D.x,cy:D.y,r:W?8:6,fill:W?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),W&&jsx(motion.text,{x:D.x+15,y:D.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:D.x+10},animate:{opacity:1,x:D.x+15},transition:{duration:.2},children:"Connect"})]}),(K||Y)&&!pe&&!e.segments&&jsx(motion.rect,{x:J-2,y:a-2,width:we+4,height:me+4,rx:qe+2,fill:"none",stroke:Y?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:Y?.6:.4,initial:{opacity:0},animate:{opacity:Y?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),ce&&jsxs(Fragment,{children:[jsx("line",{x1:k,y1:0,x2:k,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:k+h,y1:0,x2:k+h,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:K&&!Y&&!e.segments&&!f&&(()=>{let ge=a<100,Te=ge?a+me+13:a-82-13,ue=ge?`M ${J+we/2-6} ${a+me+3} L ${J+we/2} ${a+me+13} L ${J+we/2+6} ${a+me+3}`:`M ${J+we/2-6} ${a-13} L ${J+we/2} ${a-3} L ${J+we/2+6} ${a-13}`,Pe=Te+22,Ae=Te+40,Fe=Te+55,U=Te+70,H=ge?Te+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:ge?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ge?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ue,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:J+we/2-120,y:Te,width:240,height:82,rx:8,fill:o.bgSecondary,stroke:o.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:J+we/2,y:Pe,textAnchor:"middle",fill:o.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:J+we/2-110,y:Ae,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:J+we/2-70,y:Ae,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Nt(e.startDate)}),jsx("text",{x:J+we/2-110,y:Fe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:J+we/2-70,y:Fe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Nt(e.endDate)}),jsx("text",{x:J+we/2+10,y:Ae,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:J+we/2+65,y:Ae,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:be()}),jsx("text",{x:J+we/2+10,y:Fe,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:J+we/2+65,y:Fe,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:J+we/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:J+we/2-50,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(ot=>ot.name).join(", ").substring(0,30),e.assignees.map(ot=>ot.name).join(", ").length>30?"...":""]})]}),!ge&&jsx("text",{x:J+we/2,y:H,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:st?"Left: move \u2022 Right: resize":Ze?"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 vd({tooltipData:e,theme:t}){if(!e)return null;let {task:a,x:r,y:o,width:s,height:l,showBelow:p}=e,m=82,n=13,u=p?o+l+n:o-m-n,d=p?`M ${r+s/2-6} ${o+l+3} L ${r+s/2} ${o+l+13} L ${r+s/2+6} ${o+l+3}`:`M ${r+s/2-6} ${o-13} L ${r+s/2} ${o-3} L ${r+s/2+6} ${o-13}`,i=u+22,c=u+40,v=u+55,f=u+70,y=w=>w.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),x=()=>{if(!a.startDate||!a.endDate)return "N/A";let w=Math.ceil((a.endDate.getTime()-a.startDate.getTime())/(1e3*60*60*24));return `${w} day${w!==1?"s":""}`};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:p?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:p?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:r+s/2-120,y:u,width:240,height:m,rx:8,fill:t.bgSecondary,stroke:t.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:r+s/2,y:i,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:a.name.length>28?`${a.name.substring(0,28)}...`:a.name}),jsx("text",{x:r+s/2-110,y:c,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:r+s/2-70,y:c,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.startDate?y(a.startDate):"N/A"}),jsx("text",{x:r+s/2-110,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:r+s/2-70,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:a.endDate?y(a.endDate):"N/A"}),jsx("text",{x:r+s/2+10,y:c,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:r+s/2+65,y:c,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:x()}),jsx("text",{x:r+s/2+10,y:v,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:r+s/2+65,y:v,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.progress,"%"]}),a.assignees&&a.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:r+s/2-110,y:f,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:r+s/2-50,y:f,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[a.assignees.map(w=>w.name).join(", ").substring(0,30),a.assignees.map(w=>w.name).join(", ").length>30?"...":""]})]})]})})}function an({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,onHoverChange:l}){let[p,m]=useState(false),n=a-e,u=r-t,d=e+n/2,i=`M ${e} ${t} C ${d} ${t}, ${d} ${r}, ${a} ${r}`,c=6,v=Math.atan2(u,n),f=a-c*Math.cos(v-Math.PI/6),y=r-c*Math.sin(v-Math.PI/6),x=a-c*Math.cos(v+Math.PI/6),b=r-c*Math.sin(v+Math.PI/6),g=o.dependency;useEffect(()=>{l&&s&&l(p?{x1:e,y1:t,x2:a,y2:r,onDelete:s}:null);},[p,e,t,a,r,s,l]);let w=!s&&!l;return jsxs("g",{onMouseEnter:()=>!w&&m(true),onMouseLeave:()=>!w&&m(false),style:{pointerEvents:w?"none":"auto"},children:[!w&&jsx("path",{d:i,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx(motion.path,{d:i,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:p&&l?0:p?1:.8,strokeWidth:p?2.5:2},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2},strokeWidth:{duration:.2}}}),jsx(motion.path,{d:`M ${a} ${r} L ${f} ${y} M ${a} ${r} L ${x} ${b}`,fill:"none",stroke:g,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0,scale:.8},animate:{opacity:p&&l?0:p?1:.8,scale:p?1.1:1,strokeWidth:p?2.5:2},transition:{duration:.2}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:g,initial:{scale:0},animate:{scale:p&&l?0:p?1.3:1,opacity:p&&l?0:p?1:.8},transition:{scale:{delay:.3,duration:.15},opacity:{duration:.2}}}),p&&s&&!l&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.2},onClick:T=>{T.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:d,cy:(t+r)/2,r:10,fill:o.bgSecondary,stroke:o.error||"#ef4444",strokeWidth:2}),jsx("line",{x1:d-4,y1:(t+r)/2-4,x2:d+4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"}),jsx("line",{x1:d+4,y1:(t+r)/2-4,x2:d-4,y2:(t+r)/2+4,stroke:o.error||"#ef4444",strokeWidth:2,strokeLinecap:"round"})]})]})}function on({task:e,x:t,y:a,theme:r,onClick:o}){let[s,l]=useState(false),p=16,m=n=>n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:p+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-p/2,y:a+16-p/2,width:p,height:p,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(p+4)/2,y:a+16-(p+4)/2,width:p+4,height:p+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:m(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var ne={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let o=r.getDay();o!==0&&o!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let o=a.getDay();o!==0&&o!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,o=n=>{n.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&o(u.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let l=new Set,p=new Set,m=n=>{if(!l.has(n)){l.add(n),p.add(n);let u=r.get(n)||[];for(let d of u){if(!l.has(d)&&m(d))return true;if(p.has(d))return true}}return p.delete(n),false};return m(a)},flattenTasks:e=>{let t=[],a=r=>{r.forEach(o=>{t.push(o),o.subtasks&&o.subtasks.length>0&&a(o.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ne.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=ne.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=ne.findTaskById(e,o);if(s)a.unshift(s),o=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=ne.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(o=>{let s=[o.id,`"${o.name.replace(/"/g,'""')}"`,o.startDate?o.startDate.toISOString().split("T")[0]:"",o.endDate?o.endDate.toISOString().split("T")[0]:"",o.progress.toString(),o.status||"",o.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
46
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=ne.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=ne.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>ne.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=ne.findTaskById(e,t);return !a||!a.dependencies?[]:ne.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>ne.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>ne.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let o=a.startDate.getTime()-r.startDate.getTime();return t?o:-o}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let o=a.endDate.getTime()-r.endDate.getTime();return t?o:-o}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let o=a.progress-r.progress;return t?o:-o}),calculateTotalProgress:e=>{let t=ne.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,o)=>r+o.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let o=0;o<t.length;o++){let s=t[o];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;o<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>ne.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),o=new a,s=ne.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}o.setFontSize(16),o.text("Gantt Chart - Task List",14,20);let l=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],p=s.map(m=>{let n=m.startDate&&m.endDate?ne.calculateDuration(m.startDate,m.endDate):0;return [m.name,m.startDate?ne.formatDate(m.startDate):"N/A",m.endDate?ne.formatDate(m.endDate):"N/A",n>0?`${n} days`:"N/A",`${m.progress}%`,m.status||"N/A"]});r(o,{head:l,body:p,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=ne.flattenTasks(e).map(m=>{let n=m.startDate&&m.endDate?ne.calculateDuration(m.startDate,m.endDate):0;return {"Task ID":m.id,"Task Name":m.name,"Start Date":m.startDate?ne.formatDate(m.startDate):"","End Date":m.endDate?ne.formatDate(m.endDate):"","Duration (days)":n>0?n:"","Progress (%)":m.progress,Status:m.status||"",Assignees:m.assignees?.map(u=>u.name).join(", ")||"",Dependencies:m.dependencies?.join(", ")||"","Is Milestone":m.isMilestone?"Yes":"No","Parent ID":m.parentId||"",Level:m.level||0}}),s=a.utils.json_to_sheet(o),l=[{wch:15},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:20},{wch:12},{wch:15},{wch:8}];s["!cols"]=l;let p=a.utils.book_new();a.utils.book_append_sheet(p,s,"Gantt Tasks"),a.writeFile(p,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=ne.flattenTasks(e),o=new Map;r.forEach((i,c)=>{o.set(i.id,c+1);});let s=i=>i.toISOString().replace("Z",""),l=ne.getEarliestStartDate(e)||new Date,p=ne.getLatestEndDate(e)||new Date,m=r.map((i,c)=>{let v=o.get(i.id),f=i.startDate&&i.endDate?ne.calculateDuration(i.startDate,i.endDate):0,y=(i.dependencies||[]).filter(x=>o.has(x)).map(x=>`
|
|
47
47
|
<PredecessorLink>
|
|
48
48
|
<PredecessorUID>${o.get(x)}</PredecessorUID>
|
|
49
49
|
<Type>1</Type>
|
|
@@ -53,13 +53,13 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
53
53
|
</PredecessorLink>`).join("");return `
|
|
54
54
|
<Task>
|
|
55
55
|
<UID>${v}</UID>
|
|
56
|
-
<ID>${
|
|
56
|
+
<ID>${c+1}</ID>
|
|
57
57
|
<Name>${i.name.replace(/[<>&'"]/g,x=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[x]||x)}</Name>
|
|
58
58
|
<Type>0</Type>
|
|
59
59
|
<IsNull>0</IsNull>
|
|
60
60
|
<CreateDate>${s(new Date)}</CreateDate>
|
|
61
|
-
<WBS>${
|
|
62
|
-
<OutlineNumber>${
|
|
61
|
+
<WBS>${c+1}</WBS>
|
|
62
|
+
<OutlineNumber>${c+1}</OutlineNumber>
|
|
63
63
|
<OutlineLevel>${i.level||0}</OutlineLevel>
|
|
64
64
|
<Priority>500</Priority>
|
|
65
65
|
<Start>${i.startDate?s(i.startDate):""}</Start>
|
|
@@ -134,8 +134,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
134
134
|
<CreationDate>${s(new Date)}</CreationDate>
|
|
135
135
|
<LastSaved>${s(new Date)}</LastSaved>
|
|
136
136
|
<ScheduleFromStart>1</ScheduleFromStart>
|
|
137
|
-
<StartDate>${s(
|
|
138
|
-
<FinishDate>${s(
|
|
137
|
+
<StartDate>${s(l)}</StartDate>
|
|
138
|
+
<FinishDate>${s(p)}</FinishDate>
|
|
139
139
|
<FYStartDate>1</FYStartDate>
|
|
140
140
|
<CriticalSlackLimit>0</CriticalSlackLimit>
|
|
141
141
|
<CurrencyDigits>2</CurrencyDigits>
|
|
@@ -271,11 +271,11 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
271
271
|
</WeekDays>
|
|
272
272
|
</Calendar>
|
|
273
273
|
</Calendars>
|
|
274
|
-
<Tasks>${
|
|
274
|
+
<Tasks>${m}
|
|
275
275
|
</Tasks>
|
|
276
|
-
</Project>`,m=new Blob([n],{type:"application/xml;charset=utf-8;"}),l=document.createElement("a");l.href=URL.createObjectURL(m),l.download=a,l.click(),URL.revokeObjectURL(l.href);},calculateCriticalPath:e=>{let t=se.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let m=n.startDate&&n.endDate?se.calculateDuration(n.startDate,n.endDate):0,l=0;if(n.dependencies&&n.dependencies.length>0)for(let u of n.dependencies){let v=t.find(f=>f.id===u);if(v){o(v);let f=r.get(u)?.ef||0;l=Math.max(l,f);}}let i=l+m;r.set(n.id,{es:l,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),d=new Map,c=n=>{if(d.has(n.id))return;let m=n.startDate&&n.endDate?se.calculateDuration(n.startDate,n.endDate):0,l=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(l.length>0)for(let v of l){c(v);let f=d.get(v.id)?.ls||0;i=Math.min(i,f);}let u=i-m;d.set(n.id,{ls:u,lf:i});};a.forEach(c);let p=[];for(let n of a){let m=r.get(n.id),l=d.get(n.id);if(m&&l){let i=l.ls-m.es;Math.abs(i)<.01&&p.push(n.id);}}return p},calculateSlack:(e,t)=>{let a=se.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(se.calculateCriticalPath(e).includes(t))return 0;let o=se.getDependentTasks(e,t);if(o.length===0){let c=se.getLatestEndDate(e);if(!c)return null;let p=se.calculateDuration(a.endDate,c);return Math.max(0,p)}let s=o.filter(c=>c.startDate).map(c=>c.startDate.getTime()).sort((c,p)=>c-p)[0];if(!s)return null;let d=se.calculateDuration(a.endDate,new Date(s));return Math.max(0,d)},isOnCriticalPath:(e,t)=>se.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=se.findTaskById(e,t);if(!r||!r.endDate)return e;let o=se.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let d of o){if(!d.startDate||!d.endDate)continue;let c=se.calculateDuration(d.startDate,d.endDate),p;a!==void 0?(p=new Date(d.startDate),p.setDate(p.getDate()+a)):(p=new Date(r.endDate),p.setDate(p.getDate()+1));let n=se.calculateEndDate(p,c),m=l=>l.map(i=>i.id===d.id?{...i,startDate:p,endDate:n}:i.subtasks?{...i,subtasks:m(i.subtasks)}:i);s=m(s),s=se.autoScheduleDependents(s,d.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,d,c)=>{if(a===0)return [];let p=[],n=o.getTime(),m=1e3*60*60*24,l=se.findTaskById(e,t);if(!l||!l.endDate)return [];let i=(u,v,f=new Set)=>{if(f.has(u))return;f.add(u);let y=se.getDependentTasks(e,u);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex($=>$.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),N=(x.endDate.getTime()-g)/m,E=(g-n)/m*s,C=E+v*s,F=Math.max(N*s,s),T=c+b*d+12;p.push({taskId:x.id,taskName:x.name,originalX:E,previewX:C,width:F,y:T,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),p},splitTask:(e,t,a,r=3)=>{let o=se.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let d=new Date(a);d.setDate(d.getDate()+r);let c=new Date(o.endDate);c.setDate(c.getDate()+r);let p=[{startDate:new Date(o.startDate),endDate:s},{startDate:d,endDate:c}],n=m=>m.map(l=>l.id===o.id?{...l,endDate:c,segments:p}:l.subtasks?{...l,subtasks:n(l.subtasks)}:l);return n(e)}};function tn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:d,templates:c,onTaskClick:p,onTaskDblClick:n,onTaskContextMenu:m,onTaskDateChange:l,onDependencyCreate:i,onDependencyDelete:u}){let[f,y]=useState([]),[x,b]=useState(null),[g,k]=useState(null),N=useCallback(B=>{b(B);},[]),h=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),E=r==="day"?60:r==="week"?20:8,C=h*E*d,F=B=>{let I=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),R=I.getUTCDay()||7;I.setUTCDate(I.getUTCDate()+4-R);let M=new Date(Date.UTC(I.getUTCFullYear(),0,1));return Math.ceil(((I.getTime()-M.getTime())/864e5+1)/7)},T=B=>{let I=B.getDay();return I===0||I===6},$=useCallback(B=>{let I=Math.round(B/(E*d)),R=new Date(o);return R.setDate(R.getDate()+I),R},[o,E,d]),W=useCallback((B,I)=>{if(I.startDate&&I.endDate)return;let R=B.currentTarget.ownerSVGElement;if(!R)return;let M=R.createSVGPoint();M.x=B.clientX,M.y=B.clientY;let Y=M.matrixTransform(R.getScreenCTM()?.inverse()),K=$(Y.x),q=new Date(K);q.setDate(q.getDate()+1),l?.(I,K,q);},[$,l]),L=useMemo(()=>{let B=Y=>Y.map(K=>{if(K.subtasks&&K.subtasks.length>0){let q=B(K.subtasks),Ee=q.filter(we=>we.startDate&&we.endDate);if(Ee.length>0){let we=Ee.map(fe=>fe.startDate.getTime()),Ue=Ee.map(fe=>fe.endDate.getTime()),P=new Date(Math.min(...we)),te=new Date(Math.max(...Ue));return {...K,subtasks:q,startDate:P,endDate:te}}return {...K,subtasks:q}}return K}),I=(Y,K=[])=>{for(let q of Y)K.push(q),q.subtasks&&q.subtasks.length>0&&(q.isExpanded===void 0||q.isExpanded)&&I(q.subtasks,K);return K},R=B(e);return I(R)},[e]),G=useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let I=B.startDate.getTime(),R=B.endDate.getTime(),M=o.getTime(),Y=(I-M)/(1e3*60*60*24),K=(R-I)/(1e3*60*60*24),q=Y*E*d,Ee=Math.max(E*d,40),we=Math.max(K*E*d,Ee);return {x:q,width:we}},[o,E,d]),ee=useMemo(()=>L.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:I,width:R}=G(B),Y=L.findIndex(K=>K.id===B.id)*a+12;return {id:B.id,x:I,y:Y,width:R,height:32}}),[L,G]),he=useCallback((B,I,R)=>{if(!R||I===0){y([]);return}let M=se.calculateCascadePreview(e,B,I,L,o,E*d,a,48);y(M);},[e,L,o,E,d,a,48]),ye=useMemo(()=>{let B=[],I=new Date(o);for(;I<=s;){let Y=(I.getTime()-o.getTime())/864e5*E*d;if(r==="day")B.push({date:new Date(I),label:I.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:Y}),I.setDate(I.getDate()+1);else if(r==="week"){let K=F(I);B.push({date:new Date(I),label:`Week ${K}`,x:Y}),I.setDate(I.getDate()+7);}else B.push({date:new Date(I),label:I.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:Y}),I.setMonth(I.getMonth()+1);}return B},[o,s,r,E,d]),Me=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*E*d,[o,E,d]),V=Math.max(L.length*a,552);return jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(C,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(C,1e3),height:48,fill:t.bgGrid}),ye.map((B,I)=>jsxs("g",{children:[I>0&&jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:B.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${I}`)),Me>=0&&Me<=C&&jsx("circle",{cx:Me,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(C,1e3),height:V,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsx("rect",{x:0,y:0,width:Math.max(C,1e3),height:V,fill:t.bgPrimary}),ye.map((B,I)=>{let R=ye[I+1]?.x||C,M=T(B.date);return jsxs("g",{children:[M&&jsx("rect",{x:B.x,y:0,width:R-B.x,height:L.length*a,fill:t.bgWeekend,opacity:1}),I>0&&jsx("line",{x1:B.x,y1:0,x2:B.x,y2:L.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},I)}),Me>=0&&Me<=C&&jsx("line",{x1:Me,y1:0,x2:Me,y2:L.length*a,stroke:t.today,strokeWidth:2,opacity:1}),L.map((B,I)=>{let R=B.startDate&&B.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:I*a,width:C,height:a,fill:I%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${B.id}`),!R&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:I*a,width:C,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:M=>W(M,B),onMouseEnter:M=>{M.currentTarget.setAttribute("fill",t.accentLight),M.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:M=>{M.currentTarget.setAttribute("fill","transparent"),M.currentTarget.setAttribute("opacity","1");}},`clickable-${B.id}`),jsx("text",{x:Me>0?Me:100,y:I*a+a/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-${B.id}`)]})]},`row-group-${B.id}`)}),L.map((B,I)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(R=>{let M=L.find(Ee=>Ee.id===R);if(!M||!M.startDate||!M.endDate)return null;let Y=L.findIndex(Ee=>Ee.id===R),K=G(M),q=G(B);return jsx(Jo,{x1:K.x+K.width,y1:Y*a+a/2,x2:q.x,y2:I*a+a/2,theme:t},`dep-${R}-${B.id}`)})),L.map((B,I)=>{if(!B.startDate||!B.endDate)return null;let{x:R,width:M}=G(B),Y=I*a+12,K=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;return B.isMilestone?jsx(Qo,{task:B,x:R+M/2,y:Y+16,theme:t,onClick:p},B.id):K?jsxs("g",{onClick:()=>p?.(B),onContextMenu:q=>{q.preventDefault(),q.stopPropagation(),m?.(B,q);},style:{cursor:"default"},children:[jsx("rect",{x:R,y:Y,width:M,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:R,y1:Y,x2:R+M,y2:Y,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:R,y1:Y,x2:R,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:R+M,y1:Y,x2:R+M,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:R,y1:Y+32,x2:R+M,y2:Y+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),M>60&&jsx("text",{x:R+12,y:Y+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:B.name})]},B.id):jsx(Yo,{task:B,x:R,y:Y,width:M,theme:t,dayWidth:E*d,startDate:o,templates:c,onClick:p,onDoubleClick:n,onContextMenu:m,onDateChange:l,onDependencyCreate:i,allTaskPositions:ee,onDragMove:he,onHoverChange:N},B.id)}),L.map((B,I)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(R=>{let M=L.find(Ze=>Ze.id===R);if(!M||!M.startDate||!M.endDate)return null;let Y=L.findIndex(Ze=>Ze.id===R),K=G(M),q=G(B),Ee=K.x+K.width,we=Y*a+a/2,Ue=q.x,P=I*a+a/2,te=Ue-Ee,fe=Ee+te/2,Ie=Ze=>{let Je=1-Ze,Ye=Je*Je,it=Ye*Je,$t=Ze*Ze,xe=$t*Ze,O=it*Ee+3*Ye*Ze*fe+3*Je*$t*fe+xe*Ue,Ce=it*we+3*Ye*Ze*we+3*Je*$t*P+xe*P;return {x:O,y:Ce}},Oe=20,Ke=[];for(let Ze=0;Ze<=Oe;Ze++){let Je=.1+Ze/Oe*.8;Ke.push(Ie(Je));}let ot=Ke[0],Se=`M ${ot.x} ${ot.y} `+Ke.slice(1).map(Ze=>`L ${Ze.x} ${Ze.y}`).join(" ");return g&&g.x1===Ee&&g.y1===we&&g.x2===Ue&&g.y2===P?null:jsx("path",{d:Se,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{k({x1:Ee,y1:we,x2:Ue,y2:P,onDelete:()=>u?.(B.id,R)});}},`dep-hover-${R}-${B.id}`)})),f.map(B=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:32,rx:8,fill:B.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(B.daysDelta)>0&&jsx("text",{x:B.previewX+B.width/2,y:B.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),g&&(()=>{let{x1:B,y1:I,x2:R,y2:M,onDelete:Y}=g,K=R-B,q=M-I,Ee=B+K/2,we=(I+M)/2,Ue=`M ${B} ${I} C ${Ee} ${I}, ${Ee} ${M}, ${R} ${M}`,P=6,te=Math.atan2(q,K),fe=R-P*Math.cos(te-Math.PI/6),Ie=M-P*Math.sin(te-Math.PI/6),Oe=R-P*Math.cos(te+Math.PI/6),Ke=M-P*Math.sin(te+Math.PI/6),ot=t.dependency,Se="#f87171";return jsxs("g",{onMouseLeave:()=>k(null),children:[jsx("path",{d:Ue,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("circle",{cx:Ee,cy:we,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsx("path",{d:Ue,fill:"none",stroke:ot,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:Ue,fill:"none",stroke:ot,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:`M ${R} ${M} L ${fe} ${Ie} M ${R} ${M} L ${Oe} ${Ke}`,fill:"none",stroke:ot,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:R,cy:M,r:4,fill:ot,opacity:.9,style:{pointerEvents:"none"}}),jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Ze=>{Ze.stopPropagation(),k(null),Y();},style:{cursor:"pointer"},children:[jsx("circle",{cx:Ee,cy:we,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:Se,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsx("line",{x1:Ee-3,y1:we-3,x2:Ee+3,y2:we+3,stroke:Se,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:Ee+3,y1:we-3,x2:Ee-3,y2:we+3,stroke:Se,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),x&&jsx(dd,{tooltipData:x,theme:t})]})]})}var an=[{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:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var As=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Is=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function rn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:d=false,mode:c=a?"edit":"create",theme:p="dark",customStatuses:n=[]}){let m=[...As,...n.filter(P=>!As.some(te=>te.id===P.id))],l=_e[p]||_e.dark,[i,u]=useState(false),[v,f]=useState(false),[y,x]=useState(false),[b,g]=useState(false),[k,N]=useState({top:0,left:0}),[h,E]=useState(null),[C,F]=useState(new Date),[T,$]=useState({top:0,left:0}),[W,L]=useState(false),G=useRef(null),ee=useRef(null),he=useRef(null),ye=useRef(null),Me=useRef(null),[V,B]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),[I,R]=useState({});useEffect(()=>{a?(B({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&L(true)):(B({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[]}),L(false));},[a,e]),useEffect(()=>{let P=te=>{G.current&&!G.current.contains(te.target)&&u(false),ee.current&&!ee.current.contains(te.target)&&f(false),he.current&&!he.current.contains(te.target)&&x(false),ye.current&&!ye.current.contains(te.target)&&g(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[]);let M=()=>{let P={};return V.name.trim()||(P.name="El nombre es requerido"),V.startDate&&V.endDate&&V.startDate>V.endDate&&(P.endDate="La fecha de fin debe ser posterior a la de inicio"),R(P),Object.keys(P).length===0},Y=async P=>{if(P.preventDefault(),!!M())try{await s(V),t();}catch(te){console.error("Error submitting task:",te);}},K=(P,te)=>{B(fe=>{let Ie={...fe,[P]:te};if(P==="status"){let Oe=te;Oe==="todo"?Ie.progress=0:Oe==="in-progress"?(fe.progress===0||fe.progress===100)&&(Ie.progress=50):Oe==="completed"||Oe==="closed"?Ie.progress=100:(Oe==="in-review"||Oe==="review")&&(Ie.progress=75);}if(P==="progress"){let Oe=typeof te=="number"?te:parseInt(te,10);Oe===100&&fe.status!=="completed"?Ie.status="completed":Oe>0&&Oe<100&&fe.status==="todo"?Ie.status="in-progress":Oe===0&&fe.status!=="todo"&&(Ie.status="todo");}return Ie}),I[P]&&R(fe=>{let Ie={...fe};return delete Ie[P],Ie});},q=m.find(P=>P.id===V.status)??As[0],Ee=Is.find(P=>P.id===V.priority)??Is[1],we=an.find(P=>P.value===V.color)??an[0],Ue={backgroundColor:l.bgSecondary,border:`1px solid ${l.borderLight}`,color:l.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsx(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:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${l.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:q.color||l.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:l.textSecondary},children:c==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:l.textTertiary},onMouseEnter:P=>{P.currentTarget.style.backgroundColor=l.hoverBg,P.currentTarget.style.color=l.textPrimary;},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent",P.currentTarget.style.color=l.textTertiary;},disabled:d,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Y,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:V.name,onChange:P=>K("name",P.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:l.textPrimary},placeholder:"Nombre de la tarea",disabled:d,autoFocus:true}),I.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),I.name]})]}),jsx("div",{children:jsx("textarea",{value:V.description||"",onChange:P=>K("description",P.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:l.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:d})}),jsx("div",{style:{borderTop:`1px solid ${l.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:G,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!d&&u(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...Ue,borderColor:q.color,backgroundColor:`${q.color}15`},disabled:d,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:q.color}}),jsx("span",{style:{color:q.color},children:q.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:q.color}})]}),jsx(AnimatePresence,{children:i&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:m.map(P=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{K("status",P.id),u(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:P.color}}),P.title,V.status===P.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),jsxs("div",{ref:ee,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!d&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ue,disabled:d,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:Ee.color}}),jsx("span",{children:Ee.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:Is.map(P=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:te=>te.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:te=>te.currentTarget.style.backgroundColor="transparent",onClick:()=>{K("priority",P.id),f(false);},children:[jsx("span",{children:P.icon}),P.label,V.priority===P.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:l.accent}})]},P.id))})})]}),o.length>0&&jsxs("div",{ref:he,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!d&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ue,disabled:d,children:[V.assignees&&V.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:V.assignees.slice(0,3).map((P,te)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:P.color||l.accent,borderColor:l.bgSecondary},children:P.initials},te))}),V.assignees.length>3&&jsxs("span",{style:{color:l.textTertiary},children:["+",V.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:l.textTertiary}}),jsx("span",{style:{color:l.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},children:o.map(P=>{let te=V.assignees?.some(fe=>fe.name===P.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:l.textPrimary},onMouseEnter:fe=>fe.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:fe=>fe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let fe=te?(V.assignees||[]).filter(Ie=>Ie.name!==P.name):[...V.assignees||[],{name:P.name,avatar:P.avatar,initials:P.name.split(" ").map(Ie=>Ie[0]).join("").toUpperCase().slice(0,2),color:l.accent}];K("assignees",fe);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:l.accent},children:P.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:P.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:te&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:l.accent}})})]},P.id)})})})]}),jsxs("div",{ref:ye,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!d)if(b)g(false);else {if(ye.current){let P=ye.current.getBoundingClientRect(),te=window.innerHeight,fe=120,Oe=te-P.bottom<fe?P.top-fe-8:P.bottom+8;N({top:Oe,left:P.left});}g(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:Ue,disabled:d,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:V.color}}),jsx("span",{children:we.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:l.textTertiary}})]}),jsx(AnimatePresence,{children:b&&jsxs(Qe,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>g(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${k.top}px`,left:`${k.left}px`,zIndex:99999,backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:P=>P.stopPropagation(),children:jsx("div",{style:{padding:"14px 18px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:an.slice(0,18).map(P=>{let te=V.color===P.value;return jsx(motion.button,{type:"button",onClick:()=>{K("color",P.value),g(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:P.value,outline:te?`2px solid ${P.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:P.name},P.value)})})})})]})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxs("div",{ref:Me,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!d&&!V.isMilestone)if(h==="start")E(null);else {if(Me.current){let P=Me.current.getBoundingClientRect(),te=window.innerHeight,fe=320,Oe=te-P.bottom<fe?P.top-fe-8:P.bottom+8;$({top:Oe,left:P.left});}E("start"),F(V.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ue,opacity:V.isMilestone?.5:1,cursor:V.isMilestone?"not-allowed":"pointer"},disabled:d||V.isMilestone,children:V.startDate?V.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:l.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!d&&!V.isMilestone)if(h==="end")E(null);else {if(Me.current){let P=Me.current.getBoundingClientRect(),te=window.innerHeight,fe=320,Oe=te-P.bottom<fe?P.top-fe-8:P.bottom+8;$({top:Oe,left:P.left});}E("end"),F(V.endDate||V.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...Ue,opacity:V.isMilestone?.5:1,cursor:V.isMilestone?"not-allowed":"pointer"},disabled:d||V.isMilestone,children:V.endDate?V.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:h&&jsxs(Qe,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${T.top}px`,left:`${T.left}px`,zIndex:99999,backgroundColor:l.bgPrimary,border:`1px solid ${l.border}`},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${l.border}`},children:[(()=>{let P=new Date,te=new Date(P);te.setDate(P.getDate()+1);let fe=new Date(P);fe.setDate(P.getDate()+7);let Ie=new Date(P);return Ie.setDate(P.getDate()+14),[{label:"Hoy",date:P},{label:"Ma\xF1ana",date:te},{label:"Pr\xF3xima semana",date:fe},{label:"2 semanas",date:Ie}].map((Ke,ot)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:l.textPrimary},onMouseEnter:Se=>Se.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:Se=>Se.currentTarget.style.backgroundColor="transparent",onClick:()=>{h==="start"?(K("startDate",Ke.date),(!V.endDate||Ke.date>V.endDate)&&K("endDate",Ke.date),E("end")):(K("endDate",Ke.date),(!V.startDate||Ke.date<V.startDate)&&K("startDate",Ke.date),E(null));},children:Ke.label},ot))})(),jsx("div",{style:{borderTop:`1px solid ${l.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",onClick:()=>{K("startDate",void 0),K("endDate",void 0),E(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>F(new Date(C.getFullYear(),C.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:l.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:l.textPrimary},children:C.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>F(new Date(C.getFullYear(),C.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:l.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((P,te)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:l.textTertiary},children:P},te))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let P=C.getFullYear(),te=C.getMonth(),fe=new Date(P,te,1).getDay(),Ie=new Date(P,te+1,0).getDate(),Oe=new Date,Ke=[];for(let Se=fe-1;Se>=0;Se--)Ke.push({day:new Date(P,te,-Se).getDate(),date:new Date(P,te-1,new Date(P,te,-Se).getDate()),isCurrentMonth:false});for(let Se=1;Se<=Ie;Se++)Ke.push({day:Se,date:new Date(P,te,Se),isCurrentMonth:true});let ot=42-Ke.length;for(let Se=1;Se<=ot;Se++)Ke.push({day:Se,date:new Date(P,te+1,Se),isCurrentMonth:false});return Ke.map((Se,St)=>{let Ze=Se.date.toDateString()===Oe.toDateString(),Je=V.startDate?.toDateString()===Se.date.toDateString(),Ye=V.endDate?.toDateString()===Se.date.toDateString(),it=V.startDate&&V.endDate&&Se.date>=V.startDate&&Se.date<=V.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Se.isCurrentMonth?Je||Ye?"#FFF":l.textPrimary:l.textTertiary,backgroundColor:Je?"#3B82F6":Ye?"#7C3AED":it?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ze&&!Je&&!Ye?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h==="start"?(K("startDate",Se.date),V.endDate&&Se.date>V.endDate&&K("endDate",Se.date),E("end")):(K("endDate",Se.date),V.startDate&&Se.date<V.startDate&&K("startDate",Se.date),E(null));},children:Se.day},St)})})()})]})]})]})})]}),I.endDate&&jsx("span",{className:"text-xs text-red-400",children:I.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:l.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:V.progress,onChange:P=>K("progress",parseInt(P.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:l.bgSecondary,accentColor:V.progress<30?"#EF4444":V.progress<70?"#F59E0B":"#10B981"},disabled:d}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${V.progress<30?"#EF4444":V.progress<70?"#F59E0B":"#10B981"}20`,color:V.progress<30?"#EF4444":V.progress<70?"#F59E0B":"#10B981"},children:[V.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>L(!W),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:l.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${W?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:W&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:V.isMilestone,onChange:P=>K("isMilestone",P.target.checked),className:"w-4 h-4 rounded",style:{accentColor:l.accent},disabled:d}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:l.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:l.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:l.bgSecondary},children:r.filter(P=>P.id!==a?.id).map(P=>{let te=V.dependencies?.includes(P.id);return jsx("button",{type:"button",onClick:()=>{let fe=te?(V.dependencies||[]).filter(Ie=>Ie!==P.id):[...V.dependencies||[],P.id];K("dependencies",fe);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:te?`${l.accent}30`:l.bgPrimary,color:te?l.accent:l.textSecondary,border:`1px solid ${te?l.accent:l.borderLight}`},disabled:d,children:P.name},P.id)})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${l.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:l.textSecondary},onMouseEnter:P=>P.currentTarget.style.backgroundColor=l.hoverBg,onMouseLeave:P=>P.currentTarget.style.backgroundColor="transparent",disabled:d,children:"Cancelar"}),jsx("button",{type:"submit",disabled:d,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:l.accent,color:"#FFF"},onMouseEnter:P=>!d&&(P.currentTarget.style.opacity="0.9"),onMouseLeave:P=>!d&&(P.currentTarget.style.opacity="1"),children:d?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:c==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var $g=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],gd=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),zg=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Ug=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Wg=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Gg=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function on({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:d,onDependencyCreate:c,onDependencyDelete:p}){let[n,m]=useState(false),[l,i]=useState(false),[u,v]=useState([]),[f,y]=useState(""),[x,b]=useState(false),[g,k]=useState(true),N=useRef(null),h=useRef(null),E=useRef(null),{enabled:C=true,placeholder:F='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:T="bottom-right",onCommand:$,suggestions:W=$g,maxHistory:L=50,persistHistory:G}=a,ee=G?.storageKey||"gantt-ai-history",he=G?.maxMessages??5;useEffect(()=>{if(G?.enabled)try{let R=localStorage.getItem(ee);if(R){let Y=JSON.parse(R).map(K=>({...K,timestamp:new Date(K.timestamp)}));v(Y.slice(-he));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[G?.enabled,ee,he]),useEffect(()=>{if(G?.enabled&&u.length>0)try{let R=u.filter(M=>!M.isLoading).slice(-he);localStorage.setItem(ee,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[u,G?.enabled,ee,he]),useEffect(()=>{h.current&&h.current.scrollIntoView({behavior:"smooth"});},[u]),useEffect(()=>{n&&!l&&N.current&&setTimeout(()=>N.current?.focus(),100);},[n,l]);let ye=useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&d?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&c?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&p?.(R.taskId,R.dependencyFrom);break}},[o,s,d,c,p]),Me=useCallback(async R=>{if(!R.trim()||x)return;let M={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};v(K=>[...K.slice(-(L-1)),M]),y(""),k(false),b(true);let Y={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(K=>[...K,Y]);try{if($){let K=await $(R,e);v(q=>{let Ee=q.filter(Ue=>!Ue.isLoading),we={id:`assistant-${Date.now()}`,role:"assistant",content:K.message,timestamp:new Date,command:K};return [...Ee,we]}),ye(K);}else v(K=>[...K.filter(Ee=>!Ee.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(K){v(q=>[...q.filter(we=>!we.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${K instanceof Error?K.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,L,$,e,ye]),V=R=>{R.preventDefault(),Me(f);},B=R=>{y(R),N.current?.focus();};if(useEffect(()=>{let R=M=>{(M.metaKey||M.ctrlKey)&&M.key==="k"&&(M.preventDefault(),m(Y=>!Y),n||i(false)),M.key==="Escape"&&n&&m(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[n]),useEffect(()=>{if(!n)return;let R=Y=>{let K=Y.target;E.current&&!E.current.contains(K)&&m(false);},M=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(M),document.removeEventListener("mousedown",R);}},[n]),!C)return null;let I={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(Qe,{children:[jsx(AnimatePresence,{children:!n&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${I[T]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>m(true),children:[jsx(gd,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:E,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:l?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${I[T]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(gd,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>i(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Wg,{})}),jsx("button",{onClick:()=>m(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Ug,{})})]})]}),jsx(AnimatePresence,{children:!l&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[u.length===0&&g&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((R,M)=>jsx("button",{onClick:()=>B(R),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:R.length>30?R.slice(0,30)+"...":R},M))})]}),u.map(R=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsx(Gg,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsx("div",{ref:h})]}),jsxs("form",{onSubmit:V,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:N,type:"text",value:f,onChange:R=>y(R.target.value),placeholder:F,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsx(zg,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function fd(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((n,m=true)=>{r(l=>{let i=typeof n=="function"?n(l.present):n;if(o.current)return {...l,present:i};if(!m)return {...l,present:i};let u=[...l.past,l.present];return u.length>t&&u.shift(),{past:u,present:i,future:[]}});},[t]),d=useCallback(()=>{r(n=>{if(n.past.length===0)return n;let m=n.past[n.past.length-1],l=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:l,present:m,future:[n.present,...n.future]}});},[]),c=useCallback(()=>{r(n=>{if(n.future.length===0)return n;let m=n.future[0],l=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:m,future:l}});},[]),p=useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:d,redo:c,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:p}}function bd({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=d=>{let c=navigator.platform.toUpperCase().indexOf("MAC")>=0,p=c?d.metaKey:d.ctrlKey;if(p&&d.key==="z"&&!d.shiftKey&&a){d.preventDefault(),e();return}if(r){if(!c&&p&&d.key==="y"){d.preventDefault(),t();return}if(c&&p&&d.shiftKey&&d.key==="z"){d.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var jg={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${se.formatDate(e.startDate)} - ${se.formatDate(e.endDate)}`);let a=se.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} 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 a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,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=>se.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function hd(e){return {...jg,...e}}var Qg=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},xd=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:d="week",rowDensity:c="comfortable",showThemeSelector:p=true,showExportButton:n=true,availableUsers:m=[],templates:l,enableAutoCriticalPath:i=true,aiAssistant:u,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:k,onTaskDblClick:N,onTaskContextMenu:h,onTaskUpdate:E,onProgressChange:C,onTaskEdit:F,onTaskAddSubtask:T,onTaskMarkIncomplete:$,onTaskSetInProgress:W,onDependencyCreate:L,onDependencyDelete:G,onBeforeTaskAdd:ee,onAfterTaskAdd:he,onBeforeTaskUpdate:ye,onAfterTaskUpdate:Me,onBeforeTaskDelete:V,onAfterTaskDelete:B}=a,R=useContext(Wo)?.theme,[M,Y]=useState(R||s||"dark"),[K,q]=useState(d),[Ee,we]=useState(c),[Ue,P]=useState(1),[te,fe]=useState(0),[Ie,Oe]=useState(false),[Ke,ot]=useState(null),[Se,St]=useState({isOpen:false,x:0,y:0,task:null}),[Ze,Je]=useState(null),[Ye,it]=useState(null);useEffect(()=>{R&&R!==M&&Y(R);},[R]),useEffect(()=>{s&&s!==M&&Y(s);},[s]);let $t=useCallback(S=>{Y(S),g?.(S);},[g]),{state:xe,setState:O,undo:Ce,redo:Ve,canUndo:He,canRedo:xt,clearHistory:J}=fd(t,50);useEffect(()=>{O(t);},[t,O]);let Q=useRef(t),ke=useRef(true);useEffect(()=>{if(ke.current){ke.current=false,Q.current=xe;return}if(!r)return;let S=JSON.stringify(Q.current),z=JSON.stringify(xe);S!==z&&(Q.current=xe,r(xe));},[xe,r]);let ge=useMemo(()=>fs(v,f),[v,f]),ae=useCallback(S=>[{id:"name",label:S.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:S.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:S.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:S.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:S.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:S.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:S.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:S.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[De,me]=useState(()=>ae(ge));useEffect(()=>{me(S=>S.map(z=>({...z,label:ge.columns[z.id==="name"?"taskName":z.id]||z.label})));},[ge]);let Te=useMemo(()=>{let S=De.filter(ne=>ne.visible),z=S.some(ne=>ne.id!=="name");return S.reduce((ne,be)=>ne+be.width,0)+(z?20:0)},[De]);useEffect(()=>{Ke!==null&&Ke>Te&&(De.filter(j=>j.visible).some(j=>j.id!=="name")||ot(null));},[De,Te,Ke]);let ue=useMemo(()=>Ke!==null?Math.max(280,Ke,Te):Math.max(280,Te),[Ke,Te]),Ae=useRef(null),ce=useRef(null),Le=useRef(null),U=useMemo(()=>Bl(M),[M]),D=useMemo(()=>({theme:U,themeName:M}),[U,M]),X=useMemo(()=>hd(l),[l]),pe=useMemo(()=>{if(!i)return xe;let S=se.calculateCriticalPath(xe),z=j=>j.map(ne=>({...ne,isCriticalPath:S.includes(ne.id),subtasks:ne.subtasks?z(ne.subtasks):void 0}));return z(xe)},[xe,i]),Ne=Qg(Ee);bd({undo:Ce,redo:Ve,canUndo:He,canRedo:xt,enabled:true}),useImperativeHandle(o,()=>({getTask:S=>se.findTaskById(xe,S),addTask:(S,z)=>{O(j=>{if(!z)return [...j,{...S,level:0}];let ne=be=>be.map(Pe=>Pe.id===z?{...Pe,subtasks:[...Pe.subtasks||[],{...S,parentId:z,level:(Pe.level||0)+1}],isExpanded:true}:Pe.subtasks?{...Pe,subtasks:ne(Pe.subtasks)}:Pe);return ne(j)});},updateTask:(S,z)=>{O(j=>{let ne=be=>be.map(Pe=>Pe.id===S?{...Pe,...z}:Pe.subtasks?{...Pe,subtasks:ne(Pe.subtasks)}:Pe);return ne(j)});},deleteTask:S=>{O(z=>{let j=ne=>ne.filter(be=>be.id===S?false:(be.subtasks&&(be.subtasks=j(be.subtasks)),true));return j(z)});},deleteTasks:S=>{O(z=>ws(z,S));},duplicateTask:S=>{O(z=>Cs(z,[S]));},splitTask:(S,z,j=3)=>{O(ne=>se.splitTask(ne,S,z,j));},calculateEndDate:se.calculateEndDate,calculateDuration:se.calculateDuration,validateDependency:(S,z)=>!se.validateDependencies(xe,S,z),getAllTasks:()=>se.flattenTasks(xe),getTasksByStatus:S=>se.flattenTasks(xe).filter(z=>z.status===S),getTasksByParent:S=>S?se.findTaskById(xe,S)?.subtasks||[]:xe.filter(j=>!j.parentId),getCriticalPath:()=>se.flattenTasks(xe).filter(S=>S.isCriticalPath),indentTask:S=>{O(z=>vs(z,[S]));},outdentTask:S=>{O(z=>xs(z,[S]));},moveTask:(S,z)=>{O(j=>ks(j,[S],z));},createSubtask:async S=>{let{tasks:z,newTask:j}=Ns(xe,S);if(ee){let ne=ee({...j,parentId:S});if((ne instanceof Promise?await ne:ne)===false)return}O(z),he&&he({...j,parentId:S});},scrollToTask:S=>{let j=se.flattenTasks(xe).findIndex(ne=>ne.id===S);if(j!==-1&&Ae.current){let ne=j*Ne;Ae.current.scrollTo({top:ne,behavior:"smooth"}),ce.current&&ce.current.scrollTo({top:ne,behavior:"smooth"});}},highlightTask:(S,z=2e3)=>{},expandTask:S=>{O(z=>{let j=ne=>ne.map(be=>be.id===S?{...be,isExpanded:true}:be.subtasks?{...be,subtasks:j(be.subtasks)}:be);return j(z)});},collapseTask:S=>{O(z=>{let j=ne=>ne.map(be=>be.id===S?{...be,isExpanded:false}:be.subtasks?{...be,subtasks:j(be.subtasks)}:be);return j(z)});},expandAll:()=>{O(S=>{let z=j=>j.map(ne=>({...ne,isExpanded:true,subtasks:ne.subtasks?z(ne.subtasks):void 0}));return z(S)});},collapseAll:()=>{O(S=>{let z=j=>j.map(ne=>({...ne,isExpanded:false,subtasks:ne.subtasks?z(ne.subtasks):void 0}));return z(S)});},undo:Ce,redo:Ve,canUndo:()=>He,canRedo:()=>xt,clearHistory:J,exportToPNG:async()=>{if(!Le.current)throw new Error("Gantt container not found");let S=await vd(Le.current,{backgroundColor:U.bgPrimary,scale:2});return new Promise((z,j)=>{S.toBlob(ne=>{ne?z(ne):j(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async S=>{await se.exportToPDF(xe,S);},exportToExcel:async S=>{await se.exportToExcel(xe,S);},exportToJSON:()=>se.exportToJSON(xe),exportToCSV:()=>se.exportToCSV(xe),importFromJSON:S=>{let z=se.importFromJSON(S);O(z);},getTasks:()=>xe,refresh:()=>{O(S=>[...S]);},clearAll:()=>{O([]);}}),[xe,Ce,Ve,He,xt,J,U,Ne]);let At=useCallback(S=>{me(z=>z.map(j=>j.id===S?{...j,visible:!j.visible}:j));},[]),Et=useCallback((S,z)=>{me(j=>j.map(ne=>{if(ne.id!==S)return ne;let be=ne.minWidth??100,Pe=ne.maxWidth??800,zt=Math.max(be,Math.min(Pe,z));return {...ne,width:zt}}));},[]),It=useCallback(S=>{O(z=>Ds(z,S)),a.onTaskToggleExpand?.(S);},[a]),Jt=useCallback((S,z)=>{if(ye&&ye(S,z)===false)return;let ne=se.findTaskById(xe,S)?.progress,be=zt=>zt.map(Ut=>Ut.id===S?{...Ut,...z}:Ut.subtasks?{...Ut,subtasks:be(Ut.subtasks)}:Ut);O(be(xe));let Pe=se.findTaskById(be(xe),S);Pe&&(E?.(Pe),Me?.(Pe),z.progress!==void 0&&ne!==void 0&&z.progress!==ne&&C?.(S,ne,z.progress));},[xe,E,ye,Me,C]),bt=useCallback(S=>{S.length!==0&&(O(z=>vs(z,S)),a.onTaskIndent?.(S[0]));},[a]),Dr=useCallback(S=>{S.length!==0&&(O(z=>xs(z,S)),a.onTaskOutdent?.(S[0]));},[a]),or=useCallback((S,z,j)=>{O(ne=>td(ne,S,z,j)),a.onTaskReparent?.(S,z,j);},[a]),_a=useCallback((S,z)=>{S.length!==0&&(O(j=>ks(j,S,z)),a.onTaskMove?.(S[0],z));},[a]),nr=useCallback(async S=>{let z=[];for(let j of S)V&&await Promise.resolve(V(j))===false||z.push(j);z.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(z):(O(j=>ws(j,z)),z.forEach(j=>a.onTaskDelete?.(j))),B&&z.forEach(j=>B(j)));},[a,V,B]),ie=useCallback(S=>{O(z=>Cs(z,S)),S.forEach(z=>a.onTaskDuplicate?.(z));},[a]),ht=useCallback((S,z)=>{O(j=>{let{tasks:ne,newTask:be}=ed(j,S,z);return ee&&ee(be)===false?j:(a.onTaskCreate?.(be.parentId,be.position||0),he?.(be),ne)});},[a,ee,he]),Yt=useCallback((S,z)=>{O(j=>Ts(j,S,z)),a.onTaskRename?.(S,z);},[a]),Va=useCallback(S=>{O(z=>{let{tasks:j}=Ns(z,S);return a.onTaskCreate?.(S,0),j});},[a]),wo=useCallback((S,z,j)=>{let ne=S.startDate?Math.round((z.getTime()-S.startDate.getTime())/864e5):0,be=Ut=>Ut.map(qt=>qt.id===S.id?{...qt,startDate:z,endDate:j,...S.segments&&{segments:S.segments}}:qt.subtasks?{...qt,subtasks:be(qt.subtasks)}:qt),Pe=be(xe);Pe=se.autoScheduleDependents(Pe,S.id,ne),O(Pe);let zt={...S,startDate:z,endDate:j};E?.(zt);},[xe,E]),Nr=useCallback((S,z)=>{h?.(S,z),St({isOpen:true,x:z.clientX,y:z.clientY,task:S});},[h]),Ba=useCallback((S,z)=>{let j=se.splitTask(xe,S.id,z);O(j),St({isOpen:false,x:0,y:0,task:null});},[xe]),ja=useCallback(S=>{N?.(S),F||Je(S);},[N,F]),kt=useCallback((S,z,j)=>{let ne=new Map,be=va=>{va.forEach(Ra=>{Ra.dependencies&&ne.set(Ra.id,Ra.dependencies),Ra.subtasks&&be(Ra.subtasks);});};be(j);let Pe=ne.get(z)||[];ne.set(z,[...Pe,S]);let zt=new Set,Ut=new Set,qt=va=>{if(!zt.has(va)){zt.add(va),Ut.add(va);let Ra=ne.get(va)||[];for(let sr of Ra){if(!zt.has(sr)&&qt(sr))return true;if(Ut.has(sr))return true}}return Ut.delete(va),false};return qt(z)},[]),Co=useCallback((S,z)=>{if(kt(S.id,z,xe)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
276
|
+
</Project>`,u=new Blob([n],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(u),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=ne.flattenTasks(e),a=t.filter(n=>n.startDate&&n.endDate);if(a.length===0)return [];let r=new Map,o=n=>{if(r.has(n.id))return;let u=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=0;if(n.dependencies&&n.dependencies.length>0)for(let c of n.dependencies){let v=t.find(f=>f.id===c);if(v){o(v);let f=r.get(c)?.ef||0;d=Math.max(d,f);}}let i=d+u;r.set(n.id,{es:d,ef:i});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(n=>n.ef)),l=new Map,p=n=>{if(l.has(n.id))return;let u=n.startDate&&n.endDate?ne.calculateDuration(n.startDate,n.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(n.id)),i=s;if(d.length>0)for(let v of d){p(v);let f=l.get(v.id)?.ls||0;i=Math.min(i,f);}let c=i-u;l.set(n.id,{ls:c,lf:i});};a.forEach(p);let m=[];for(let n of a){let u=r.get(n.id),d=l.get(n.id);if(u&&d){let i=d.ls-u.es;Math.abs(i)<.01&&m.push(n.id);}}return m},calculateSlack:(e,t)=>{let a=ne.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(ne.calculateCriticalPath(e).includes(t))return 0;let o=ne.getDependentTasks(e,t);if(o.length===0){let p=ne.getLatestEndDate(e);if(!p)return null;let m=ne.calculateDuration(a.endDate,p);return Math.max(0,m)}let s=o.filter(p=>p.startDate).map(p=>p.startDate.getTime()).sort((p,m)=>p-m)[0];if(!s)return null;let l=ne.calculateDuration(a.endDate,new Date(s));return Math.max(0,l)},isOnCriticalPath:(e,t)=>ne.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=ne.findTaskById(e,t);if(!r||!r.endDate)return e;let o=ne.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let l of o){if(!l.startDate||!l.endDate)continue;let p=ne.calculateDuration(l.startDate,l.endDate),m;a!==void 0?(m=new Date(l.startDate),m.setDate(m.getDate()+a)):(m=new Date(r.endDate),m.setDate(m.getDate()+1));let n=ne.calculateEndDate(m,p),u=d=>d.map(i=>i.id===l.id?{...i,startDate:m,endDate:n}:i.subtasks?{...i,subtasks:u(i.subtasks)}:i);s=u(s),s=ne.autoScheduleDependents(s,l.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,l,p)=>{if(a===0)return [];let m=[],n=o.getTime(),u=1e3*60*60*24,d=ne.findTaskById(e,t);if(!d||!d.endDate)return [];let i=(c,v,f=new Set)=>{if(f.has(c))return;f.add(c);let y=ne.getDependentTasks(e,c);for(let x of y){if(!x.startDate||!x.endDate)continue;let b=r.findIndex($=>$.id===x.id);if(b===-1)continue;let g=x.startDate.getTime(),T=(x.endDate.getTime()-g)/u,N=(g-n)/u*s,h=N+v*s,M=Math.max(T*s,s),D=p+b*l+12;m.push({taskId:x.id,taskName:x.name,originalX:N,previewX:h,width:M,y:D,rowIndex:b,daysDelta:v,color:x.color}),i(x.id,v,f);}};return i(t,a),m},splitTask:(e,t,a,r=3)=>{let o=ne.findTaskById(e,t);if(!o||!o.startDate||!o.endDate)return e;if(a<=o.startDate||a>=o.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let l=new Date(a);l.setDate(l.getDate()+r);let p=new Date(o.endDate);p.setDate(p.getDate()+r);let m=[{startDate:new Date(o.startDate),endDate:s},{startDate:l,endDate:p}],n=u=>u.map(d=>d.id===o.id?{...d,endDate:p,segments:m}:d.subtasks?{...d,subtasks:n(d.subtasks)}:d);return n(e)}};function sn({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:l,templates:p,onTaskClick:m,onTaskDblClick:n,onTaskContextMenu:u,onTaskDateChange:d,onDependencyCreate:i,onDependencyDelete:c}){let[f,y]=useState([]),[x,b]=useState(null),[g,w]=useState(null),T=useCallback(B=>{b(B);},[]),k=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),N=r==="day"?60:r==="week"?20:8,h=k*N*l,M=B=>{let S=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),R=S.getUTCDay()||7;S.setUTCDate(S.getUTCDate()+4-R);let P=new Date(Date.UTC(S.getUTCFullYear(),0,1));return Math.ceil(((S.getTime()-P.getTime())/864e5+1)/7)},D=B=>{let S=B.getDay();return S===0||S===6},$=useCallback(B=>{let S=Math.round(B/(N*l)),R=new Date(o);return R.setDate(R.getDate()+S),R},[o,N,l]),W=useCallback((B,S)=>{if(S.startDate&&S.endDate)return;let R=B.currentTarget.ownerSVGElement;if(!R)return;let P=R.createSVGPoint();P.x=B.clientX,P.y=B.clientY;let K=P.matrixTransform(R.getScreenCTM()?.inverse()),te=$(K.x),Y=new Date(te);Y.setDate(Y.getDate()+1),d?.(S,te,Y);},[$,d]),F=useMemo(()=>{let B=K=>K.map(te=>{if(te.subtasks&&te.subtasks.length>0){let Y=B(te.subtasks),ce=Y.filter(pe=>pe.startDate&&pe.endDate);if(ce.length>0){let pe=ce.map(L=>L.startDate.getTime()),je=ce.map(L=>L.endDate.getTime()),me=new Date(Math.min(...pe)),qe=new Date(Math.max(...je));return {...te,subtasks:Y,startDate:me,endDate:qe}}return {...te,subtasks:Y}}return te}),S=(K,te=[])=>{for(let Y of K)te.push(Y),Y.subtasks&&Y.subtasks.length>0&&(Y.isExpanded===void 0||Y.isExpanded)&&S(Y.subtasks,te);return te},R=B(e);return S(R)},[e]),G=useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let S=B.startDate.getTime(),R=B.endDate.getTime(),P=o.getTime(),K=(S-P)/(1e3*60*60*24),te=(R-S)/(1e3*60*60*24),Y=K*N*l,ce=Math.max(N*l,40),pe=Math.max(te*N*l,ce);return {x:Y,width:pe}},[o,N,l]),Z=useMemo(()=>F.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:S,width:R}=G(B),K=F.findIndex(te=>te.id===B.id)*a+12;return {id:B.id,x:S,y:K,width:R,height:32}}),[F,G]),ve=useCallback((B,S,R)=>{if(!R||S===0){y([]);return}let P=ne.calculateCascadePreview(e,B,S,F,o,N*l,a,48);y(P);},[e,F,o,N,l,a,48]),ke=useMemo(()=>{let B=[],S=new Date(o);for(;S<=s;){let K=(S.getTime()-o.getTime())/864e5*N*l;if(r==="day")B.push({date:new Date(S),label:S.toLocaleDateString("en-US",{day:"numeric",month:"short"}),x:K}),S.setDate(S.getDate()+1);else if(r==="week"){let te=M(S);B.push({date:new Date(S),label:`Week ${te}`,x:K}),S.setDate(S.getDate()+7);}else B.push({date:new Date(S),label:S.toLocaleDateString("en-US",{month:"short",year:"numeric"}),x:K}),S.setMonth(S.getMonth()+1);}return B},[o,s,r,N,l]),Me=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*N*l,[o,N,l]),Oe=Math.max(F.length*a,552);return jsxs("div",{className:"w-full h-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary,overflow:"visible"},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.bgGrid,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(h,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(h,1e3),height:48,fill:t.bgGrid}),ke.map((B,S)=>jsxs("g",{children:[S>0&&jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:B.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${S}`)),Me>=0&&Me<=h&&jsx("circle",{cx:Me,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(h,1e3),height:Oe,style:{display:"block",flexShrink:0,overflow:"visible"},children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})})]}),jsx("rect",{x:0,y:0,width:Math.max(h,1e3),height:Oe,fill:t.bgPrimary}),ke.map((B,S)=>{let R=ke[S+1]?.x||h,P=D(B.date);return jsxs("g",{children:[P&&jsx("rect",{x:B.x,y:0,width:R-B.x,height:F.length*a,fill:t.bgWeekend,opacity:1}),S>0&&jsx("line",{x1:B.x,y1:0,x2:B.x,y2:F.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},S)}),Me>=0&&Me<=h&&jsx("line",{x1:Me,y1:0,x2:Me,y2:F.length*a,stroke:t.today,strokeWidth:2,opacity:1}),F.map((B,S)=>{let R=B.startDate&&B.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:S*a,width:h,height:a,fill:S%2===0?"transparent":t.bgSecondary,opacity:1,style:{pointerEvents:"none"}},`row-${B.id}`),!R&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:S*a,width:h,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:P=>W(P,B),onMouseEnter:P=>{P.currentTarget.setAttribute("fill",t.accentLight),P.currentTarget.setAttribute("opacity","0.5");},onMouseLeave:P=>{P.currentTarget.setAttribute("fill","transparent"),P.currentTarget.setAttribute("opacity","1");}},`clickable-${B.id}`),jsx("text",{x:Me>0?Me:100,y:S*a+a/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-${B.id}`)]})]},`row-group-${B.id}`)}),F.map((B,S)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(R=>{let P=F.find(ce=>ce.id===R);if(!P||!P.startDate||!P.endDate)return null;let K=F.findIndex(ce=>ce.id===R),te=G(P),Y=G(B);return jsx(an,{x1:te.x+te.width,y1:K*a+a/2,x2:Y.x,y2:S*a+a/2,theme:t},`dep-${R}-${B.id}`)})),F.map((B,S)=>{if(!B.startDate||!B.endDate)return null;let{x:R,width:P}=G(B),K=S*a+12,te=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;return B.isMilestone?jsx(on,{task:B,x:R+P/2,y:K+16,theme:t,onClick:m},B.id):te?jsxs("g",{onClick:()=>m?.(B),onContextMenu:Y=>{Y.preventDefault(),Y.stopPropagation(),u?.(B,Y);},style:{cursor:"default"},children:[jsx("rect",{x:R,y:K,width:P,height:32,fill:t.primary,opacity:.25,rx:6}),jsx("line",{x1:R,y1:K,x2:R+P,y2:K,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:R,y1:K,x2:R,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:R+P,y1:K,x2:R+P,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),jsx("line",{x1:R,y1:K+32,x2:R+P,y2:K+32,stroke:t.primary,strokeWidth:3,opacity:.9,strokeLinecap:"round"}),P>60&&jsx("text",{x:R+12,y:K+16,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:B.name})]},B.id):jsx(Qo,{task:B,x:R,y:K,width:P,theme:t,dayWidth:N*l,startDate:o,templates:p,onClick:m,onDoubleClick:n,onContextMenu:u,onDateChange:d,onDependencyCreate:i,allTaskPositions:Z,onDragMove:ve,onHoverChange:T},B.id)}),F.map((B,S)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(R=>{let P=F.find(xe=>xe.id===R);if(!P||!P.startDate||!P.endDate)return null;let K=F.findIndex(xe=>xe.id===R),te=G(P),Y=G(B),ce=te.x+te.width,pe=K*a+a/2,je=Y.x,me=S*a+a/2,qe=je-ce,L=ce+qe/2,re=xe=>{let tt=1-xe,Ze=tt*tt,st=Ze*tt,Nt=xe*xe,be=Nt*xe,O=st*ce+3*Ze*xe*L+3*tt*Nt*L+be*je,Ce=st*pe+3*Ze*xe*pe+3*tt*Nt*me+be*me;return {x:O,y:Ce}},Ne=20,Le=[];for(let xe=0;xe<=Ne;xe++){let tt=.1+xe/Ne*.8;Le.push(re(tt));}let Be=Le[0],Je=`M ${Be.x} ${Be.y} `+Le.slice(1).map(xe=>`L ${xe.x} ${xe.y}`).join(" ");return g&&g.x1===ce&&g.y1===pe&&g.x2===je&&g.y2===me?null:jsx("path",{d:Je,fill:"none",stroke:"transparent",strokeWidth:12,strokeLinecap:"round",style:{cursor:"pointer"},onMouseEnter:()=>{w({x1:ce,y1:pe,x2:je,y2:me,onDelete:()=>c?.(B.id,R)});}},`dep-hover-${R}-${B.id}`)})),f.map(B=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:32,rx:8,fill:B.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(B.daysDelta)>0&&jsx("text",{x:B.previewX+B.width/2,y:B.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),g&&(()=>{let{x1:B,y1:S,x2:R,y2:P,onDelete:K}=g,te=R-B,Y=P-S,ce=B+te/2,pe=(S+P)/2,je=`M ${B} ${S} C ${ce} ${S}, ${ce} ${P}, ${R} ${P}`,me=6,qe=Math.atan2(Y,te),L=R-me*Math.cos(qe-Math.PI/6),re=P-me*Math.sin(qe-Math.PI/6),Ne=R-me*Math.cos(qe+Math.PI/6),Le=P-me*Math.sin(qe+Math.PI/6),Be=t.dependency,Je="#f87171";return jsxs("g",{onMouseLeave:()=>w(null),children:[jsx("path",{d:je,fill:"none",stroke:"transparent",strokeWidth:50,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("circle",{cx:ce,cy:pe,r:25,fill:"transparent",style:{cursor:"pointer"}}),jsx("path",{d:je,fill:"none",stroke:Be,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:je,fill:"none",stroke:Be,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:`M ${R} ${P} L ${L} ${re} M ${R} ${P} L ${Ne} ${Le}`,fill:"none",stroke:Be,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:R,cy:P,r:4,fill:Be,opacity:.9,style:{pointerEvents:"none"}}),jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:xe=>{xe.stopPropagation(),w(null),K();},style:{cursor:"pointer"},children:[jsx("circle",{cx:ce,cy:pe,r:9,fill:"rgba(248, 113, 113, 0.15)",stroke:Je,strokeWidth:1.5,style:{transition:"all 0.15s ease"}}),jsx("line",{x1:ce-3,y1:pe-3,x2:ce+3,y2:pe+3,stroke:Je,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:ce+3,y1:pe-3,x2:ce-3,y2:pe+3,stroke:Je,strokeWidth:1.5,strokeLinecap:"round"})]})]})})(),x&&jsx(vd,{tooltipData:x,theme:t})]})]})}var ln=[{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:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];var Os=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],$s=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function dn({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:l=false,mode:p=a?"edit":"create",theme:m="dark",customStatuses:n=[],availableTags:u=[],onCreateTag:d}){let i=[...Os,...n.filter(L=>!Os.some(re=>re.id===L.id))],c=$e[m]||$e.dark,[v,f]=useState(false),[y,x]=useState(false),[b,g]=useState(false),[w,T]=useState(false),[k,N]=useState({top:0,left:0}),[h,M]=useState(null),[D,$]=useState(new Date),[W,F]=useState({top:0,left:0}),[G,Z]=useState(false),ve=useRef(null),ke=useRef(null),Me=useRef(null),Oe=useRef(null),B=useRef(null),[S,R]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[P,K]=useState({});useEffect(()=>{a?(R({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#6366F1",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[]}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Z(true)):(R({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),Z(false));},[a,e]),useEffect(()=>{let L=re=>{ve.current&&!ve.current.contains(re.target)&&f(false),ke.current&&!ke.current.contains(re.target)&&x(false),Me.current&&!Me.current.contains(re.target)&&g(false),Oe.current&&!Oe.current.contains(re.target)&&T(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let te=()=>{let L={};return S.name.trim()||(L.name="El nombre es requerido"),S.startDate&&S.endDate&&S.startDate>S.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),K(L),Object.keys(L).length===0},Y=async L=>{if(L.preventDefault(),!!te())try{await s(S),t();}catch(re){console.error("Error submitting task:",re);}},ce=(L,re)=>{R(Ne=>{let Le={...Ne,[L]:re};if(L==="status"){let Be=re;Be==="todo"?Le.progress=0:Be==="in-progress"?(Ne.progress===0||Ne.progress===100)&&(Le.progress=50):Be==="completed"||Be==="closed"?Le.progress=100:(Be==="in-review"||Be==="review")&&(Le.progress=75);}if(L==="progress"){let Be=typeof re=="number"?re:parseInt(re,10);Be===100&&Ne.status!=="completed"?Le.status="completed":Be>0&&Be<100&&Ne.status==="todo"?Le.status="in-progress":Be===0&&Ne.status!=="todo"&&(Le.status="todo");}return Le}),P[L]&&K(Ne=>{let Le={...Ne};return delete Le[L],Le});},pe=i.find(L=>L.id===S.status)??Os[0],je=$s.find(L=>L.id===S.priority)??$s[1],me=ln.find(L=>L.value===S.color)??ln[0],qe={backgroundColor:c.bgSecondary,border:`1px solid ${c.borderLight}`,color:c.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 bg-black/60 z-50",onClick:t}),jsx(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:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:jsxs("div",{className:"w-full max-w-xl rounded-xl shadow-2xl pointer-events-auto overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${c.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:pe.color||c.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:c.textSecondary},children:p==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:c.textTertiary},onMouseEnter:L=>{L.currentTarget.style.backgroundColor=c.hoverBg,L.currentTarget.style.color=c.textPrimary;},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent",L.currentTarget.style.color=c.textTertiary;},disabled:l,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Y,className:"max-h-[calc(100vh-200px)] overflow-y-auto",children:[jsxs("div",{className:"p-5 space-y-4",children:[jsxs("div",{children:[jsx("input",{type:"text",value:S.name,onChange:L=>ce("name",L.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:c.textPrimary},placeholder:"Nombre de la tarea",disabled:l,autoFocus:true}),P.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),P.name]})]}),jsx("div",{children:jsx("textarea",{value:S.description||"",onChange:L=>ce("description",L.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:c.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:l})}),jsx("div",{style:{borderTop:`1px solid ${c.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:ve,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!l&&f(!v),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...qe,borderColor:pe.color,backgroundColor:`${pe.color}15`},disabled:l,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:pe.color}}),jsx("span",{style:{color:pe.color},children:pe.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:pe.color}})]}),jsx(AnimatePresence,{children:v&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:i.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("status",L.id),f(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,S.status===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},L.id))})})]}),jsxs("div",{ref:ke,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!l&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:qe,disabled:l,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:je.color}}),jsx("span",{children:je.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:$s.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("priority",L.id),x(false);},children:[jsx("span",{children:L.icon}),L.label,S.priority===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:c.accent}})]},L.id))})})]}),o.length>0&&jsxs("div",{ref:Me,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!l&&g(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:qe,disabled:l,children:[S.assignees&&S.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:S.assignees.slice(0,3).map((L,re)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:L.color||c.accent,borderColor:c.bgSecondary},children:L.initials},re))}),S.assignees.length>3&&jsxs("span",{style:{color:c.textTertiary},children:["+",S.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:c.textTertiary}}),jsx("span",{style:{color:c.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg shadow-xl",style:{backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},children:o.map(L=>{let re=S.assignees?.some(Ne=>Ne.name===L.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:c.textPrimary},onMouseEnter:Ne=>Ne.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:Ne=>Ne.currentTarget.style.backgroundColor="transparent",onClick:()=>{let Ne=re?(S.assignees||[]).filter(Le=>Le.name!==L.name):[...S.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(Le=>Le[0]).join("").toUpperCase().slice(0,2),color:c.accent}];ce("assignees",Ne);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:c.accent},children:L.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:re&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:c.accent}})})]},L.id)})})})]}),jsxs("div",{ref:Oe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!l)if(w)T(false);else {if(Oe.current){let L=Oe.current.getBoundingClientRect(),re=window.innerHeight,Ne=120,Be=re-L.bottom<Ne?L.top-Ne-8:L.bottom+8;N({top:Be,left:L.left});}T(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:qe,disabled:l,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:S.color}}),jsx("span",{children:me.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:c.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsxs(at,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>T(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${k.top}px`,left:`${k.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsx("div",{style:{padding:"14px 18px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 16px)",gap:"14px"},children:ln.slice(0,18).map(L=>{let re=S.color===L.value;return jsx(motion.button,{type:"button",onClick:()=>{ce("color",L.value),T(false);},style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:re?`2px solid ${L.value}`:"none",outlineOffset:"3px",cursor:"pointer",border:"none"},whileHover:{scale:1.2},whileTap:{scale:.95},title:L.name},L.value)})})})})]})})]}),u.length>0||d?jsx(Br,{selectedTags:S.tags||[],availableTags:u,onChange:L=>ce("tags",L),onCreateTag:d,theme:c,disabled:l}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxs("div",{ref:B,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!l&&!S.isMilestone)if(h==="start")M(null);else {if(B.current){let L=B.current.getBoundingClientRect(),re=window.innerHeight,Ne=320,Be=re-L.bottom<Ne?L.top-Ne-8:L.bottom+8;F({top:Be,left:L.left});}M("start"),$(S.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...qe,opacity:S.isMilestone?.5:1,cursor:S.isMilestone?"not-allowed":"pointer"},disabled:l||S.isMilestone,children:S.startDate?S.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:c.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!l&&!S.isMilestone)if(h==="end")M(null);else {if(B.current){let L=B.current.getBoundingClientRect(),re=window.innerHeight,Ne=320,Be=re-L.bottom<Ne?L.top-Ne-8:L.bottom+8;F({top:Be,left:L.left});}M("end"),$(S.endDate||S.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...qe,opacity:S.isMilestone?.5:1,cursor:S.isMilestone?"not-allowed":"pointer"},disabled:l||S.isMilestone,children:S.endDate?S.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:h&&jsxs(at,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>M(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${W.top}px`,left:`${W.left}px`,zIndex:99999,backgroundColor:c.bgPrimary,border:`1px solid ${c.border}`},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${c.border}`},children:[(()=>{let L=new Date,re=new Date(L);re.setDate(L.getDate()+1);let Ne=new Date(L);Ne.setDate(L.getDate()+7);let Le=new Date(L);return Le.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:Ne},{label:"2 semanas",date:Le}].map((Je,kt)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:c.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{h==="start"?(ce("startDate",Je.date),(!S.endDate||Je.date>S.endDate)&&ce("endDate",Je.date),M("end")):(ce("endDate",Je.date),(!S.startDate||Je.date<S.startDate)&&ce("startDate",Je.date),M(null));},children:Je.label},kt))})(),jsx("div",{style:{borderTop:`1px solid ${c.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:L=>L.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{ce("startDate",void 0),ce("endDate",void 0),M(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>$(new Date(D.getFullYear(),D.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:c.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:c.textPrimary},children:D.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>$(new Date(D.getFullYear(),D.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:c.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,re)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:c.textTertiary},children:L},re))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=D.getFullYear(),re=D.getMonth(),Ne=new Date(L,re,1).getDay(),Le=new Date(L,re+1,0).getDate(),Be=new Date,Je=[];for(let xe=Ne-1;xe>=0;xe--)Je.push({day:new Date(L,re,-xe).getDate(),date:new Date(L,re-1,new Date(L,re,-xe).getDate()),isCurrentMonth:false});for(let xe=1;xe<=Le;xe++)Je.push({day:xe,date:new Date(L,re,xe),isCurrentMonth:true});let kt=42-Je.length;for(let xe=1;xe<=kt;xe++)Je.push({day:xe,date:new Date(L,re+1,xe),isCurrentMonth:false});return Je.map((xe,tt)=>{let Ze=xe.date.toDateString()===Be.toDateString(),st=S.startDate?.toDateString()===xe.date.toDateString(),Nt=S.endDate?.toDateString()===xe.date.toDateString(),be=S.startDate&&S.endDate&&xe.date>=S.startDate&&xe.date<=S.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:xe.isCurrentMonth?st||Nt?"#FFF":c.textPrimary:c.textTertiary,backgroundColor:st?"#3B82F6":Nt?"#7C3AED":be?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Ze&&!st&&!Nt?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{h==="start"?(ce("startDate",xe.date),S.endDate&&xe.date>S.endDate&&ce("endDate",xe.date),M("end")):(ce("endDate",xe.date),S.startDate&&xe.date<S.startDate&&ce("startDate",xe.date),M(null));},children:xe.day},tt)})})()})]})]})]})})]}),P.endDate&&jsx("span",{className:"text-xs text-red-400",children:P.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:c.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:S.progress,onChange:L=>ce("progress",parseInt(L.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:c.bgSecondary,accentColor:S.progress<30?"#EF4444":S.progress<70?"#F59E0B":"#10B981"},disabled:l}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${S.progress<30?"#EF4444":S.progress<70?"#F59E0B":"#10B981"}20`,color:S.progress<30?"#EF4444":S.progress<70?"#F59E0B":"#10B981"},children:[S.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>Z(!G),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:c.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${G?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:G&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors hover:bg-white/5",children:[jsx("input",{type:"checkbox",checked:S.isMilestone,onChange:L=>ce("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:c.accent},disabled:l}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:c.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:c.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),jsx("div",{className:"flex flex-wrap gap-1.5 max-h-24 overflow-y-auto p-2 rounded-lg",style:{backgroundColor:c.bgSecondary},children:r.filter(L=>L.id!==a?.id).map(L=>{let re=S.dependencies?.includes(L.id);return jsx("button",{type:"button",onClick:()=>{let Ne=re?(S.dependencies||[]).filter(Le=>Le!==L.id):[...S.dependencies||[],L.id];ce("dependencies",Ne);},className:"px-2 py-1 rounded-full text-xs transition-colors",style:{backgroundColor:re?`${c.accent}30`:c.bgPrimary,color:re?c.accent:c.textSecondary,border:`1px solid ${re?c.accent:c.borderLight}`},disabled:l,children:L.name},L.id)})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${c.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:c.textSecondary},onMouseEnter:L=>L.currentTarget.style.backgroundColor=c.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",disabled:l,children:"Cancelar"}),jsx("button",{type:"submit",disabled:l,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:c.accent,color:"#FFF"},onMouseEnter:L=>!l&&(L.currentTarget.style.opacity="0.9"),onMouseLeave:L=>!l&&(L.currentTarget.style.opacity="1"),children:l?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:p==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var ef=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],Td=()=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707"}),jsx("circle",{cx:"12",cy:"12",r:"4"})]}),tf=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),af=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),rf=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),of=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function cn({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:l,onDependencyCreate:p,onDependencyDelete:m}){let[n,u]=useState(false),[d,i]=useState(false),[c,v]=useState([]),[f,y]=useState(""),[x,b]=useState(false),[g,w]=useState(true),T=useRef(null),k=useRef(null),N=useRef(null),{enabled:h=true,placeholder:M='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:D="bottom-right",onCommand:$,suggestions:W=ef,maxHistory:F=50,persistHistory:G}=a,Z=G?.storageKey||"gantt-ai-history",ve=G?.maxMessages??5;useEffect(()=>{if(G?.enabled)try{let R=localStorage.getItem(Z);if(R){let K=JSON.parse(R).map(te=>({...te,timestamp:new Date(te.timestamp)}));v(K.slice(-ve));}}catch(R){console.warn("[GanttAIAssistant] Failed to load persisted history:",R);}},[G?.enabled,Z,ve]),useEffect(()=>{if(G?.enabled&&c.length>0)try{let R=c.filter(P=>!P.isLoading).slice(-ve);localStorage.setItem(Z,JSON.stringify(R));}catch(R){console.warn("[GanttAIAssistant] Failed to persist history:",R);}},[c,G?.enabled,Z,ve]),useEffect(()=>{k.current&&k.current.scrollIntoView({behavior:"smooth"});},[c]),useEffect(()=>{n&&!d&&T.current&&setTimeout(()=>T.current?.focus(),100);},[n,d]);let ke=useCallback(R=>{if(R.success)switch(R.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":R.taskId&&R.updates&&o?.(R.taskId,R.updates);break;case "create_task":R.newTask&&s?.(R.newTask);break;case "delete_task":R.taskId&&l?.(R.taskId);break;case "link_tasks":R.dependencyFrom&&R.dependencyTo&&p?.(R.dependencyFrom,R.dependencyTo);break;case "unlink_tasks":R.taskId&&R.dependencyFrom&&m?.(R.taskId,R.dependencyFrom);break}},[o,s,l,p,m]),Me=useCallback(async R=>{if(!R.trim()||x)return;let P={id:`user-${Date.now()}`,role:"user",content:R,timestamp:new Date};v(te=>[...te.slice(-(F-1)),P]),y(""),w(false),b(true);let K={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(te=>[...te,K]);try{if($){let te=await $(R,e);v(Y=>{let ce=Y.filter(je=>!je.isLoading),pe={id:`assistant-${Date.now()}`,role:"assistant",content:te.message,timestamp:new Date,command:te};return [...ce,pe]}),ke(te);}else v(te=>[...te.filter(ce=>!ce.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(te){v(Y=>[...Y.filter(pe=>!pe.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${te instanceof Error?te.message:"Unknown error"}`,timestamp:new Date}]);}finally{b(false);}},[x,F,$,e,ke]),Oe=R=>{R.preventDefault(),Me(f);},B=R=>{y(R),T.current?.focus();};if(useEffect(()=>{let R=P=>{(P.metaKey||P.ctrlKey)&&P.key==="k"&&(P.preventDefault(),u(K=>!K),n||i(false)),P.key==="Escape"&&n&&u(false);};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[n]),useEffect(()=>{if(!n)return;let R=K=>{let te=K.target;N.current&&!N.current.contains(te)&&u(false);},P=setTimeout(()=>{document.addEventListener("mousedown",R);},100);return ()=>{clearTimeout(P),document.removeEventListener("mousedown",R);}},[n]),!h)return null;let S={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(at,{children:[jsx(AnimatePresence,{children:!n&&jsxs(motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},className:`fixed ${S[D]} z-[99999] flex items-center gap-2 px-4 py-3 rounded-full shadow-lg transition-colors`,style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)",color:"white",boxShadow:"0 4px 20px rgba(59, 130, 246, 0.4)"},onClick:()=>u(true),children:[jsx(Td,{}),jsx("span",{className:"text-sm font-medium",children:"AI Assistant"}),jsx("kbd",{className:"hidden sm:inline-flex items-center gap-0.5 px-1.5 py-0.5 text-[10px] font-mono rounded bg-white/20",children:"\u2318K"})]})}),jsx(AnimatePresence,{children:n&&jsxs(motion.div,{ref:N,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:d?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${S[D]} z-[99999] w-96 rounded-2xl overflow-hidden shadow-2xl flex flex-col`,style:{background:t.bgPrimary,border:`1px solid ${t.border}`,boxShadow:`0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px ${t.border}`},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:"linear-gradient(135deg, #3B82F6 0%, #2563EB 100%)"},children:[jsxs("div",{className:"flex items-center gap-2 text-white",children:[jsx(Td,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>i(R=>!R),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(rf,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(af,{})})]})]}),jsx(AnimatePresence,{children:!d&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[c.length===0&&g&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-sm text-center",style:{color:t.textSecondary},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:W.slice(0,4).map((R,P)=>jsx("button",{onClick:()=>B(R),className:"text-xs px-3 py-1.5 rounded-full transition-colors",style:{background:t.bgSecondary,color:t.textSecondary,border:`1px solid ${t.border}`},children:R.length>30?R.slice(0,30)+"...":R},P))})]}),c.map(R=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${R.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${R.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:R.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:R.role==="user"?"white":t.textPrimary},children:[R.isLoading?jsx(of,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:R.content}),R.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:R.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:R.command.success?"#10B981":"#EF4444"},children:[R.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:R.command.type.replace(/_/g," ")})]})]})},R.id)),jsx("div",{ref:k})]}),jsxs("form",{onSubmit:Oe,className:"p-3 border-t",style:{borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:t.bgSecondary,border:`1px solid ${t.border}`},children:[jsx("input",{ref:T,type:"text",value:f,onChange:R=>y(R.target.value),placeholder:M,disabled:x,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!f.trim()||x,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:f.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:f.trim()?"white":t.textSecondary},children:jsx(tf,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Dd(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((n,u=true)=>{r(d=>{let i=typeof n=="function"?n(d.present):n;if(o.current)return {...d,present:i};if(!u)return {...d,present:i};let c=[...d.past,d.present];return c.length>t&&c.shift(),{past:c,present:i,future:[]}});},[t]),l=useCallback(()=>{r(n=>{if(n.past.length===0)return n;let u=n.past[n.past.length-1],d=n.past.slice(0,n.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:u,future:[n.present,...n.future]}});},[]),p=useCallback(()=>{r(n=>{if(n.future.length===0)return n;let u=n.future[0],d=n.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...n.past,n.present],present:u,future:d}});},[]),m=useCallback(()=>{r(n=>({past:[],present:n.present,future:[]}));},[]);return {state:a.present,setState:s,undo:l,redo:p,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:m}}function Nd({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=l=>{let p=navigator.platform.toUpperCase().indexOf("MAC")>=0,m=p?l.metaKey:l.ctrlKey;if(m&&l.key==="z"&&!l.shiftKey&&a){l.preventDefault(),e();return}if(r){if(!p&&m&&l.key==="y"){l.preventDefault(),t();return}if(p&&m&&l.shiftKey&&l.key==="z"){l.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var df={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${ne.formatDate(e.startDate)} - ${ne.formatDate(e.endDate)}`);let a=ne.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} 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 a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,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=>ne.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Sd(e){return {...df,...e}}var bf=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Md=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:l="week",rowDensity:p="comfortable",showThemeSelector:m=true,showExportButton:n=true,availableUsers:u=[],templates:d,enableAutoCriticalPath:i=true,aiAssistant:c,locale:v="en",customTranslations:f,showCreateTaskButton:y=false,createTaskLabel:x,onCreateTask:b,onThemeChange:g,onTaskClick:w,onTaskDblClick:T,onTaskContextMenu:k,onTaskUpdate:N,onProgressChange:h,onTaskEdit:M,onTaskAddSubtask:D,onTaskMarkIncomplete:$,onTaskSetInProgress:W,onDependencyCreate:F,onDependencyDelete:G,onBeforeTaskAdd:Z,onAfterTaskAdd:ve,onBeforeTaskUpdate:ke,onAfterTaskUpdate:Me,onBeforeTaskDelete:Oe,onAfterTaskDelete:B}=a,R=useContext(jo)?.theme,[P,K]=useState(R||s||"dark"),[te,Y]=useState(l),[ce,pe]=useState(p),[je,me]=useState(1),[qe,L]=useState(0),[re,Ne]=useState(false),[Le,Be]=useState(null),[Je,kt]=useState({isOpen:false,x:0,y:0,task:null}),[xe,tt]=useState(null),[Ze,st]=useState(null);useEffect(()=>{R&&R!==P&&K(R);},[R]),useEffect(()=>{s&&s!==P&&K(s);},[s]);let Nt=useCallback(E=>{K(E),g?.(E);},[g]),{state:be,setState:O,undo:Ce,redo:Ke,canUndo:Ve,canRedo:St,clearHistory:q}=Dd(t,50);useEffect(()=>{O(t);},[t,O]);let J=useRef(t),we=useRef(true);useEffect(()=>{if(we.current){we.current=false,J.current=be;return}if(!r)return;let E=JSON.stringify(J.current),z=JSON.stringify(be);E!==z&&(J.current=be,r(be));},[be,r]);let he=useMemo(()=>ks(v,f),[v,f]),Q=useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),[De,ge]=useState(()=>Q(he));useEffect(()=>{ge(E=>E.map(z=>({...z,label:he.columns[z.id==="name"?"taskName":z.id]||z.label})));},[he]);let Te=useMemo(()=>{let E=De.filter(oe=>oe.visible),z=E.some(oe=>oe.id!=="name");return E.reduce((oe,ye)=>oe+ye.width,0)+(z?20:0)},[De]);useEffect(()=>{Le!==null&&Le>Te&&(De.filter(j=>j.visible).some(j=>j.id!=="name")||Be(null));},[De,Te,Le]);let ue=useMemo(()=>Le!==null?Math.max(280,Le,Te):Math.max(280,Te),[Le,Te]),Pe=useRef(null),Ae=useRef(null),Fe=useRef(null),U=useMemo(()=>Vl(P),[P]),H=useMemo(()=>({theme:U,themeName:P}),[U,P]),ot=useMemo(()=>Sd(d),[d]),Ue=useMemo(()=>{if(!i)return be;let E=ne.calculateCriticalPath(be),z=j=>j.map(oe=>({...oe,isCriticalPath:E.includes(oe.id),subtasks:oe.subtasks?z(oe.subtasks):void 0}));return z(be)},[be,i]),A=bf(ce);Nd({undo:Ce,redo:Ke,canUndo:Ve,canRedo:St,enabled:true}),useImperativeHandle(o,()=>({getTask:E=>ne.findTaskById(be,E),addTask:(E,z)=>{O(j=>{if(!z)return [...j,{...E,level:0}];let oe=ye=>ye.map(Ee=>Ee.id===z?{...Ee,subtasks:[...Ee.subtasks||[],{...E,parentId:z,level:(Ee.level||0)+1}],isExpanded:true}:Ee.subtasks?{...Ee,subtasks:oe(Ee.subtasks)}:Ee);return oe(j)});},updateTask:(E,z)=>{O(j=>{let oe=ye=>ye.map(Ee=>Ee.id===E?{...Ee,...z}:Ee.subtasks?{...Ee,subtasks:oe(Ee.subtasks)}:Ee);return oe(j)});},deleteTask:E=>{O(z=>{let j=oe=>oe.filter(ye=>ye.id===E?false:(ye.subtasks&&(ye.subtasks=j(ye.subtasks)),true));return j(z)});},deleteTasks:E=>{O(z=>Es(z,E));},duplicateTask:E=>{O(z=>Ps(z,[E]));},splitTask:(E,z,j=3)=>{O(oe=>ne.splitTask(oe,E,z,j));},calculateEndDate:ne.calculateEndDate,calculateDuration:ne.calculateDuration,validateDependency:(E,z)=>!ne.validateDependencies(be,E,z),getAllTasks:()=>ne.flattenTasks(be),getTasksByStatus:E=>ne.flattenTasks(be).filter(z=>z.status===E),getTasksByParent:E=>E?ne.findTaskById(be,E)?.subtasks||[]:be.filter(j=>!j.parentId),getCriticalPath:()=>ne.flattenTasks(be).filter(E=>E.isCriticalPath),indentTask:E=>{O(z=>Ds(z,[E]));},outdentTask:E=>{O(z=>Ns(z,[E]));},moveTask:(E,z)=>{O(j=>Ss(j,[E],z));},createSubtask:async E=>{let{tasks:z,newTask:j}=Is(be,E);if(Z){let oe=Z({...j,parentId:E});if((oe instanceof Promise?await oe:oe)===false)return}O(z),ve&&ve({...j,parentId:E});},scrollToTask:E=>{let j=ne.flattenTasks(be).findIndex(oe=>oe.id===E);if(j!==-1&&Pe.current){let oe=j*A;Pe.current.scrollTo({top:oe,behavior:"smooth"}),Ae.current&&Ae.current.scrollTo({top:oe,behavior:"smooth"});}},highlightTask:(E,z=2e3)=>{},expandTask:E=>{O(z=>{let j=oe=>oe.map(ye=>ye.id===E?{...ye,isExpanded:true}:ye.subtasks?{...ye,subtasks:j(ye.subtasks)}:ye);return j(z)});},collapseTask:E=>{O(z=>{let j=oe=>oe.map(ye=>ye.id===E?{...ye,isExpanded:false}:ye.subtasks?{...ye,subtasks:j(ye.subtasks)}:ye);return j(z)});},expandAll:()=>{O(E=>{let z=j=>j.map(oe=>({...oe,isExpanded:true,subtasks:oe.subtasks?z(oe.subtasks):void 0}));return z(E)});},collapseAll:()=>{O(E=>{let z=j=>j.map(oe=>({...oe,isExpanded:false,subtasks:oe.subtasks?z(oe.subtasks):void 0}));return z(E)});},undo:Ce,redo:Ke,canUndo:()=>Ve,canRedo:()=>St,clearHistory:q,exportToPNG:async()=>{if(!Fe.current)throw new Error("Gantt container not found");let E=await Pd(Fe.current,{backgroundColor:U.bgPrimary,scale:2});return new Promise((z,j)=>{E.toBlob(oe=>{oe?z(oe):j(new Error("Failed to create blob from canvas"));},"image/png");})},exportToPDF:async E=>{await ne.exportToPDF(be,E);},exportToExcel:async E=>{await ne.exportToExcel(be,E);},exportToJSON:()=>ne.exportToJSON(be),exportToCSV:()=>ne.exportToCSV(be),importFromJSON:E=>{let z=ne.importFromJSON(E);O(z);},getTasks:()=>be,refresh:()=>{O(E=>[...E]);},clearAll:()=>{O([]);}}),[be,Ce,Ke,Ve,St,q,U,A]);let ie=useCallback(E=>{ge(z=>z.map(j=>j.id===E?{...j,visible:!j.visible}:j));},[]),Se=useCallback((E,z)=>{ge(j=>j.map(oe=>{if(oe.id!==E)return oe;let ye=oe.minWidth??100,Ee=oe.maxWidth??800,Wt=Math.max(ye,Math.min(Ee,z));return {...oe,width:Wt}}));},[]),et=useCallback(E=>{O(z=>As(z,E)),a.onTaskToggleExpand?.(E);},[a]),gt=useCallback((E,z)=>{if(ke&&ke(E,z)===false)return;let oe=ne.findTaskById(be,E)?.progress,ye=Wt=>Wt.map(Gt=>Gt.id===E?{...Gt,...z}:Gt.subtasks?{...Gt,subtasks:ye(Gt.subtasks)}:Gt);O(ye(be));let Ee=ne.findTaskById(ye(be),E);Ee&&(N?.(Ee),Me?.(Ee),z.progress!==void 0&&oe!==void 0&&z.progress!==oe&&h?.(E,oe,z.progress));},[be,N,ke,Me,h]),wt=useCallback(E=>{E.length!==0&&(O(z=>Ds(z,E)),a.onTaskIndent?.(E[0]));},[a]),Sr=useCallback(E=>{E.length!==0&&(O(z=>Ns(z,E)),a.onTaskOutdent?.(E[0]));},[a]),sr=useCallback((E,z,j)=>{O(oe=>pd(oe,E,z,j)),a.onTaskReparent?.(E,z,j);},[a]),ja=useCallback((E,z)=>{E.length!==0&&(O(j=>Ss(j,E,z)),a.onTaskMove?.(E[0],z));},[a]),ir=useCallback(async E=>{let z=[];for(let j of E)Oe&&await Promise.resolve(Oe(j))===false||z.push(j);z.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(z):(O(j=>Es(j,z)),z.forEach(j=>a.onTaskDelete?.(j))),B&&z.forEach(j=>B(j)));},[a,Oe,B]),se=useCallback(E=>{O(z=>Ps(z,E)),E.forEach(z=>a.onTaskDuplicate?.(z));},[a]),Ct=useCallback((E,z)=>{O(j=>{let{tasks:oe,newTask:ye}=cd(j,E,z);return Z&&Z(ye)===false?j:(a.onTaskCreate?.(ye.parentId,ye.position||0),ve?.(ye),oe)});},[a,Z,ve]),Xt=useCallback((E,z)=>{O(j=>Ms(j,E,z)),a.onTaskRename?.(E,z);},[a]),Ka=useCallback(E=>{O(z=>{let{tasks:j}=Is(z,E);return a.onTaskCreate?.(E,0),j});},[a]),Do=useCallback((E,z,j)=>{let oe=E.startDate?Math.round((z.getTime()-E.startDate.getTime())/864e5):0,ye=Gt=>Gt.map(Jt=>Jt.id===E.id?{...Jt,startDate:z,endDate:j,...E.segments&&{segments:E.segments}}:Jt.subtasks?{...Jt,subtasks:ye(Jt.subtasks)}:Jt),Ee=ye(be);Ee=ne.autoScheduleDependents(Ee,E.id,oe),O(Ee);let Wt={...E,startDate:z,endDate:j};N?.(Wt);},[be,N]),Er=useCallback((E,z)=>{k?.(E,z),kt({isOpen:true,x:z.clientX,y:z.clientY,task:E});},[k]),Oa=useCallback((E,z)=>{let j=ne.splitTask(be,E.id,z);O(j),kt({isOpen:false,x:0,y:0,task:null});},[be]),Ya=useCallback(E=>{T?.(E),M||tt(E);},[T,M]),Et=useCallback((E,z,j)=>{let oe=new Map,ye=ka=>{ka.forEach($a=>{$a.dependencies&&oe.set($a.id,$a.dependencies),$a.subtasks&&ye($a.subtasks);});};ye(j);let Ee=oe.get(z)||[];oe.set(z,[...Ee,E]);let Wt=new Set,Gt=new Set,Jt=ka=>{if(!Wt.has(ka)){Wt.add(ka),Gt.add(ka);let $a=oe.get(ka)||[];for(let lr of $a){if(!Wt.has(lr)&&Jt(lr))return true;if(Gt.has(lr))return true}}return Gt.delete(ka),false};return Jt(z)},[]),No=useCallback((E,z)=>{if(Et(E.id,z,be)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
277
277
|
|
|
278
|
-
Task dependencies must flow in one direction only.`);return}let j=
|
|
278
|
+
Task dependencies must flow in one direction only.`);return}let j=oe=>oe.map(ye=>{if(ye.id===z){let Ee=ye.dependencies||[];if(!Ee.includes(E.id))return {...ye,dependencies:[...Ee,E.id]}}return ye.subtasks?{...ye,subtasks:j(ye.subtasks)}:ye});O(j(be)),F?.(E.id,z);},[be,F,Et]),So=useCallback((E,z)=>{let j=oe=>oe.map(ye=>{if(ye.id===E&&ye.dependencies){let Ee=ye.dependencies.filter(Wt=>Wt!==z);return {...ye,dependencies:Ee}}return ye.subtasks?{...ye,subtasks:j(ye.subtasks)}:ye});O(j(be)),G?.(E,z);},[be,G]),{startDate:Li,endDate:Yr}=useMemo(()=>{let E=be.filter(Ee=>Ee.startDate&&Ee.endDate);if(E.length===0){let Ee=new Date,Wt=new Date(Ee);Wt.setDate(Wt.getDate()-30);let Gt=new Date(Ee);return Gt.setDate(Gt.getDate()+60),{startDate:Wt,endDate:Gt}}let z=E.flatMap(Ee=>[Ee.startDate,Ee.endDate]).filter(Ee=>Ee!==void 0),j=new Date(Math.min(...z.map(Ee=>Ee.getTime()))),oe=new Date(Math.max(...z.map(Ee=>Ee.getTime()))),ye=te==="day"?7:te==="week"?14:30;return j.setDate(j.getDate()-ye),oe.setDate(oe.getDate()+ye),{startDate:j,endDate:oe}},[be,te]),_c=useCallback(async()=>{if(!Fe.current)return;let E=await Pd(Fe.current,{backgroundColor:U.bgPrimary,scale:2}),z=document.createElement("a");z.download="gantt-chart.png",z.href=E.toDataURL("image/png"),z.click();},[U]),Vc=useCallback(async()=>{await ne.exportToPDF(be);},[be]),jc=useCallback(async()=>{await ne.exportToExcel(be);},[be]),Kc=useCallback(()=>{let E=ne.exportToCSV(be),z=new Blob([E],{type:"text/csv;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(z),j.download="gantt-chart.csv",j.click(),URL.revokeObjectURL(j.href);},[be]),Yc=useCallback(()=>{let E=ne.exportToJSON(be),z=new Blob([E],{type:"application/json;charset=utf-8;"}),j=document.createElement("a");j.href=URL.createObjectURL(z),j.download="gantt-chart.json",j.click(),URL.revokeObjectURL(j.href);},[be]),qc=useCallback(()=>{ne.exportToMSProject(be,"Gantt Project","project.xml");},[be]),Xc=E=>{E.preventDefault(),Ne(true);};return useEffect(()=>{let E=Ae.current,z=Pe.current;if(!E||!z)return;let j=z.querySelector(".gantt-taskgrid-content"),oe=()=>{let Jt=E.scrollTop;L(Jt),j&&(j.style.transform=`translateY(-${Jt}px)`);},ye=Jt=>{if(re&&z){let $a=z.parentElement?.getBoundingClientRect()?.left||0,lr=Jt.clientX-$a,Jc=280,Zc=Math.min(window.innerWidth-300,800);lr>=Jc&&lr<=Zc&&Be(lr);}},Ee=()=>{Ne(false);},Wt=z.querySelector(".gantt-grid-scroll")||z,Gt=Jt=>{let ka=Jt;ka.deltaY!==0&&(E.scrollTop+=ka.deltaY,Jt.preventDefault());};return E.addEventListener("scroll",oe),Wt.addEventListener("wheel",Gt,{passive:false}),document.addEventListener("mousemove",ye),document.addEventListener("mouseup",Ee),()=>{E.removeEventListener("scroll",oe),Wt.removeEventListener("wheel",Gt),document.removeEventListener("mousemove",ye),document.removeEventListener("mouseup",Ee);}},[re]),jsx(Ur.Provider,{value:he,children:jsx(Fn.Provider,{value:H,children:jsxs("div",{ref:Fe,className:"flex flex-col h-full w-full",style:{backgroundColor:U.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(Yo,{theme:U,timeScale:te,onTimeScaleChange:Y,zoom:je,onZoomChange:me,currentTheme:P,onThemeChange:Nt,rowDensity:ce,onRowDensityChange:pe,showThemeSelector:m,showCreateTaskButton:y,createTaskLabel:x,onCreateTask:b,onExportPNG:n?_c:void 0,onExportPDF:n?Vc:void 0,onExportExcel:n?jc:void 0,onExportCSV:n?Kc:void 0,onExportJSON:n?Yc:void 0,onExportMSProject:n?qc:void 0}),jsxs("div",{ref:Pe,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{className:"gantt-grid-scroll flex-shrink-0",style:{width:ue,overflow:"hidden"},children:jsx(Zo,{tasks:Ue,theme:U,rowHeight:A,availableUsers:u,templates:ot,onTaskClick:w,onTaskDblClick:Ya,onTaskContextMenu:k,onTaskToggle:et,scrollTop:qe,columns:De,onToggleColumn:ie,onColumnResize:Se,onTaskUpdate:gt,onTaskIndent:wt,onTaskOutdent:Sr,onTaskMove:ja,onMultiTaskDelete:ir,onTaskDuplicate:se,onTaskCreate:Ct,onTaskRename:Xt,onCreateSubtask:Ka,onOpenTaskModal:w?E=>w(E):void 0,onDeleteRequest:(E,z)=>st({taskId:E,taskName:z}),onTaskReparent:sr})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize",style:{width:6,marginLeft:-3,zIndex:10},onMouseDown:Xc}),jsx("div",{ref:Ae,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(sn,{tasks:Ue,theme:U,rowHeight:A,timeScale:te,startDate:Li,endDate:Yr,zoom:je,templates:ot,onTaskClick:w,onTaskDblClick:Ya,onTaskContextMenu:Er,onTaskDateChange:Do,onDependencyCreate:No,onDependencyDelete:So})})]}),Je.task&&jsx(Wr,{isOpen:Je.isOpen,x:Je.x,y:Je.y,theme:U,onClose:()=>kt({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=Je.task;return E?E.subtasks&&E.subtasks.length>0?[{id:"addSubtask",label:he.contextMenu?.addSubtask||"Add Subtask",icon:vt.Add,onClick:()=>{D?D(E):Ka(E.id);}},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:he.contextMenu?.deleteTask||"Delete Task",icon:vt.Delete,onClick:()=>{st({taskId:E.id,taskName:E.name});}}]:[{id:"edit",label:he.contextMenu?.editTask||"Edit Task",icon:vt.Pencil,onClick:()=>{M?M(E):tt(E);}},{id:"addSubtask",label:he.contextMenu?.addSubtask||"Add Subtask",icon:vt.Add,onClick:()=>{D?D(E):Ka(E.id);}},{id:"separator-status",label:"",separator:true,onClick:()=>{}},{id:"markIncomplete",label:he.contextMenu?.markIncomplete||"Mark Incomplete",icon:vt.MarkIncomplete,onClick:()=>{$?$(E):gt(E.id,{status:"todo",progress:0});},disabled:E.status==="todo"},{id:"setInProgress",label:he.contextMenu?.setInProgress||"Set In Progress",icon:vt.SetInProgress,onClick:()=>{W?W(E):gt(E.id,{status:"in-progress"});},disabled:E.status==="in-progress"},{id:"markComplete",label:he.contextMenu?.markComplete||"Mark Complete",icon:vt.MarkComplete,onClick:()=>{gt(E.id,{status:"completed",progress:100});},disabled:E.status==="completed"},{id:"separator-advanced",label:"",separator:true,onClick:()=>{}},{id:"split",label:he.contextMenu?.splitTask||"Split Task",icon:vt.Split,onClick:()=>{if(!E.startDate||!E.endDate){console.warn("Cannot split task without dates");return}let j=E.startDate.getTime(),oe=E.endDate.getTime(),ye=j+(oe-j)/2,Ee=new Date(ye);Oa(E,Ee);},disabled:!E.startDate||!E.endDate},{id:"separator-delete",label:"",separator:true,onClick:()=>{}},{id:"delete",label:he.contextMenu?.deleteTask||"Delete Task",icon:vt.Delete,onClick:()=>{st({taskId:E.id,taskName:E.name});}}]:[]})()}),xe&&jsx(dn,{isOpen:true,onClose:()=>tt(null),task:xe,onSubmit:E=>{gt(xe.id,E),tt(null);},mode:"edit",theme:P}),jsx(AnimatePresence,{children:Ze&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>st(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:U.bgSecondary,border:`1px solid ${U.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${U.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:U.textPrimary,fontFamily:"Inter, sans-serif"},children:[he.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:U.textSecondary,fontFamily:"Inter, sans-serif"},children:v==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsxs("p",{className:"text-sm leading-relaxed",style:{color:U.textSecondary,fontFamily:"Inter, sans-serif"},children:[v==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:U.textPrimary},children:['"',Ze.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:U.bgPrimary,borderTop:`1px solid ${U.border}`},children:[jsx("button",{onClick:()=>st(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:U.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=U.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:v==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{ir([Ze.taskId]),st(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),v==="es"?"Eliminar":"Delete"]})]})]})})}),c?.enabled&&jsx(cn,{tasks:be,theme:U,config:c,onTasksUpdate:O,onTaskUpdate:gt,onTaskCreate:E=>{O(z=>[...z,E]);},onTaskDelete:E=>{ir([E]);},onDependencyCreate:(E,z)=>{let j=ne.findTaskById(be,E);j&&No(j,z);},onDependencyDelete:So})]})})})});var Ad=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
279
279
|
|
|
280
280
|
AVAILABLE COMMANDS:
|
|
281
281
|
1. move_task - Move a task to a different date
|
|
@@ -316,39 +316,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
316
316
|
|
|
317
317
|
Always try to match task names case-insensitively and handle partial matches.
|
|
318
318
|
If you can't find a task by name, search through the provided task list.
|
|
319
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
320
|
-
${
|
|
319
|
+
If ambiguous, ask for clarification in the message field.`;function Id(e){return `CURRENT TASKS:
|
|
320
|
+
${Ld(e).map(r=>{let o=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",l=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${l}`}).join(`
|
|
321
321
|
`)}
|
|
322
322
|
|
|
323
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Cd(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ga(e,t){let a=Cd(e),r=t.toLowerCase().trim(),o=a.find(c=>c.name.toLowerCase()===r);if(o)return o;let s=a.find(c=>c.name.toLowerCase().includes(r));if(s)return s;let d=r.split(/\s+/);return a.find(c=>{let p=c.name.toLowerCase();return d.every(n=>p.includes(n))})}function Bs(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let u={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(u!==void 0){let v=new Date(r),f=v.getDay(),y=u-f;return y<=0&&(y+=7),v.setDate(v.getDate()+y),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),u=s[2].toLowerCase(),v=new Date(r);return u==="day"||u==="d\xEDa"||u==="dias"?v.setDate(v.getDate()+i):u==="week"||u==="semana"||u==="semanas"?v.setDate(v.getDate()+i*7):(u==="month"||u==="mes"||u==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let c=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let i=parseInt(c[1],10),u=parseInt(c[2],10)-1,v=parseInt(c[3],10);return new Date(v,u,i)}let p={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),u=p[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(u!==void 0)return new Date(v,u,i)}let m={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},l=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let i=m[l[1].toLowerCase()],u=parseInt(l[2],10),v=l[3]?parseInt(l[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,u)}return null}function Rs(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Os(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Td(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Dd(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),m=r[2].trim(),l=Ga(t,n),i=Bs(m);if(!l)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:l.id,taskName:l.name,message:`Could not parse the date "${m}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let u=l.startDate&&l.endDate?Math.round((l.endDate.getTime()-l.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+u),{type:"move_task",taskId:l.id,taskName:l.name,updates:{startDate:i,endDate:v},message:`Moved "${l.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),m=o[2].trim(),l=Ga(t,n),i=Rs(m);if(!l)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!l.endDate)return {type:"resize_task",taskId:l.id,taskName:l.name,message:`Could not parse the duration "${m}".`,success:false,error:"Invalid duration"};let u=new Date(l.endDate);return u.setDate(u.getDate()+i),{type:"resize_task",taskId:l.id,taskName:l.name,updates:{endDate:u},message:`Extended "${l.name}" by ${i} days. New end date: ${u.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),m=s[2].trim(),l=Ga(t,n),i=Os(m);return l?i===null?{type:"set_progress",taskId:l.id,taskName:l.name,message:`Could not parse the progress value "${m}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:l.id,taskName:l.name,updates:{progress:i},message:`Set "${l.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let d=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]&&d[2]){let n=d[1].trim(),m=d[2].trim(),l=Ga(t,n);return l?{type:"rename_task",taskId:l.id,taskName:l.name,updates:{name:m},message:`Renamed "${l.name}" to "${m}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let c=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let n=c[1].trim(),m=c[2].trim(),l=Ga(t,n),i=Ga(t,m);return l?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:l.id,dependencyTo:i.id,message:`Linked "${l.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:m,message:`Could not find a task named "${m}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let p=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]){let n=p[1].trim(),m=Ga(t,n);return m?{type:"delete_task",taskId:m.id,taskName:m.name,message:`Deleted "${m.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Nd(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function ef(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 tf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function sn(e,t=[],a=[]){let r=e.assignedUserIds?.map(m=>{let l=a.find(i=>i.id===m);return l?{name:l.name,initials:l.initials,color:l.color}:null}).filter(m=>m!==null),o=t.filter(m=>m.metadata?.parentCardId===e.id).map(m=>sn(m,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(m=>m.type==="finish-to-start").map(m=>m.taskId));let d=m=>{if(m)return typeof m=="string"?new Date(m):m},c=d(e.startDate),p=d(e.endDate),n=e.metadata?.isMilestone===true||c&&p&&Math.abs(p.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:p,progress:e.progress||0,status:ef(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Sd(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:tf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function Ed(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>sn(r,e,t))}var $s={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},zs={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},ln={en:$s,es:zs};function Us(e){return ln[e]||ln.en}function dn(e,t){let a=Us(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function Id(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Id(r.subtasks,t+1));return a}function uf({status:e,progress:t}){return t===100||e==="completed"?jsx(CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsx(PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsx(Circle,{className:"w-5 h-5 text-gray-400"})}function Ld({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:d}){let{theme:c="dark",locale:p="en",customTranslations:n,showSearch:m=true,showHierarchy:l=true}=t,i=dn(p,n),u=c==="dark",[v,f]=useState(new Set),[y,x]=useState("startDate"),[b,g]=useState("asc"),[k,N]=useState("");useMemo(()=>{let T=new Set;function $(W){for(let L of W)L.subtasks?.length&&(T.add(L.id),$(L.subtasks));}$(e),f(T);},[e]);let h=useCallback(T=>{f($=>{let W=new Set($);return W.has(T)?W.delete(T):W.add(T),W}),a.onTaskToggleExpand?.(T);},[a]),E=useCallback(T=>{y===T?g($=>$==="asc"?"desc":"asc"):(x(T),g("asc")),a.onSortChange?.({column:T,direction:b==="asc"?"desc":"asc"});},[y,b,a]),C=useMemo(()=>{let T=Id(e);if(k.trim()){let W=k.toLowerCase();T=T.filter(L=>L.name.toLowerCase().includes(W));}let $=[];for(let W of T){let L=W.level===0;W.level>0&&(L=true),(L||k.trim())&&$.push(W);}return k.trim()&&$.sort((W,L)=>{let G,ee;switch(y){case "name":G=W.name.toLowerCase(),ee=L.name.toLowerCase();break;case "startDate":G=W.startDate?.getTime()||0,ee=L.startDate?.getTime()||0;break;case "endDate":G=W.endDate?.getTime()||0,ee=L.endDate?.getTime()||0;break;case "progress":G=W.progress||0,ee=L.progress||0;break;case "status":G=W.status||"todo",ee=L.status||"todo";break;default:return 0}return G<ee?b==="asc"?-1:1:G>ee?b==="asc"?1:-1:0}),$},[e,k,y,b]),F=T=>T?(T instanceof Date?T:new Date(T)).toLocaleDateString(p==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:w("flex-1 flex items-center justify-center",u?"bg-[#0F1117]":"bg-white",s),style:d,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:w("text-lg font-semibold mb-2",u?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsx("p",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-hidden",u?"bg-[#0F1117]":"bg-white",s),style:d,children:[jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",u?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[m&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:w("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:k,onChange:T=>N(T.target.value),placeholder:i.toolbar.searchPlaceholder,className:w("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",u?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxs("div",{className:w("text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[C.length," ",i.pagination.tasks]})]})}),jsxs("div",{className:w("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",u?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxs("button",{onClick:()=>E("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>E("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>E("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>E("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxs("button",{onClick:()=>E("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsx(ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxs("div",{className:"flex-1 overflow-auto",children:[jsx(AnimatePresence,{children:C.map((T,$)=>{let W=v.has(T.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:$*.02},className:w("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",u?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:l?`${24+T.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(T),onDoubleClick:()=>a.onTaskDoubleClick?.(T),children:[jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[l&&T.hasChildren&&jsx("button",{onClick:L=>{L.stopPropagation(),h(T.id);},className:w("p-0.5 rounded",u?"hover:bg-white/10":"hover:bg-gray-200"),children:W?jsx(ChevronDown,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:w("w-4 h-4",u?"text-[#9CA3AF]":"text-gray-400")})}),l&&!T.hasChildren&&jsx("div",{className:"w-5"}),jsx("button",{onClick:L=>{L.stopPropagation(),a.onTaskUpdate?.({...T,progress:T.progress===100?0:100,status:T.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(uf,{status:T.status,progress:T.progress})}),jsx("span",{className:w("truncate",u?"text-white":"text-gray-900",T.progress===100&&(u?"line-through text-[#6B7280]":"line-through text-gray-400")),children:T.name})]}),jsx("div",{className:"col-span-2 flex items-center",children:jsx("span",{className:w("px-2 py-1 rounded-full text-xs font-medium",T.progress===100||T.status==="completed"?"bg-green-500/10 text-green-500":T.progress&&T.progress>0||T.status==="in-progress"?"bg-blue-500/10 text-blue-500":u?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:T.progress===100||T.status==="completed"?i.status.completed:T.progress&&T.progress>0||T.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Calendar,{className:"w-4 h-4"}),F(T.startDate)]}),jsxs("div",{className:w("col-span-2 flex items-center gap-1 text-sm",u?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Clock,{className:"w-4 h-4"}),F(T.endDate)]}),jsx("div",{className:"col-span-1 flex items-center",children:jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:w("flex-1 h-1.5 rounded-full overflow-hidden",u?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:w("h-full rounded-full transition-all",T.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${T.progress||0}%`}})}),jsxs("span",{className:w("text-xs w-8",u?"text-[#9CA3AF]":"text-gray-500"),children:[T.progress||0,"%"]})]})})]},T.id)})}),C.length===0&&k&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:w("w-12 h-12 mx-auto mb-4",u?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:w(u?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Ws={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Gs={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},Hs={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},pn={dark:Ws,light:Gs,neutral:Hs};function Fd(e){return pn[e]||pn.dark}var _s={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Vs={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},mn={en:_s,es:Vs};function go(e){return mn[e]||mn.en}function un(e,t){let a=go(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Bd(e){let t=go(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function Rd(e,t=0,a=true){let r=go(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Nf(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function Xs(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function zd({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Wd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:d,style:c}){let{theme:p="dark",locale:n="en",customTranslations:m}=t,l=un(n,m),i=p==="dark",[u,v]=useState(r||new Date),[f,y]=useState(null),[x,b]=useState(null),[g,k]=useState(null),[N,h]=useState(new Date),[E,C]=useState({}),F=4,T=3,[$,W]=useState(false),[L,G]=useState(false),[ee,he]=useState(false),[ye,Me]=useState(null),[V,B]=useState(""),[I,R]=useState(void 0),[M,Y]=useState(null),[K,q]=useState(false),[Ee,we]=useState(false),[Ue,P]=useState(null),[te,fe]=useState(false),[Ie,Oe]=useState(new Date),Ke=useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()-1,1));},[u]),ot=useCallback(()=>{v(new Date(u.getFullYear(),u.getMonth()+1,1));},[u]),Se=useCallback(()=>{v(new Date);},[]),St=useMemo(()=>{let O=u.getFullYear(),Ce=u.getMonth(),Ve=new Date(O,Ce,1),He=new Date(O,Ce+1,0),xt=Ve.getDay(),J=He.getDate(),Q=Nf(e),ke=new Date;ke.setHours(0,0,0,0);let ge=[],ae=xt,De=new Date(O,Ce,0).getDate();for(let Te=ae-1;Te>=0;Te--){let ue=new Date(O,Ce-1,De-Te);ge.push({date:ue,isCurrentMonth:false,isToday:false,isWeekend:ue.getDay()===0||ue.getDay()===6,events:Q.filter(Ae=>Xs(ue,Ae)).map(Ae=>({id:Ae.id,title:Ae.name,start:Ae.startDate,end:Ae.endDate,task:Ae}))});}for(let Te=1;Te<=J;Te++){let ue=new Date(O,Ce,Te),Ae=ue.getTime()===ke.getTime();ge.push({date:ue,isCurrentMonth:true,isToday:Ae,isWeekend:ue.getDay()===0||ue.getDay()===6,events:Q.filter(ce=>Xs(ue,ce)).map(ce=>({id:ce.id,title:ce.name,start:ce.startDate,end:ce.endDate,task:ce}))});}let me=42-ge.length;for(let Te=1;Te<=me;Te++){let ue=new Date(O,Ce+1,Te);ge.push({date:ue,isCurrentMonth:false,isToday:false,isWeekend:ue.getDay()===0||ue.getDay()===6,events:Q.filter(Ae=>Xs(ue,Ae)).map(Ae=>({id:Ae.id,title:Ae.name,start:Ae.startDate,end:Ae.endDate,task:Ae}))});}return ge},[u,e]),Ze=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Je=u.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ye=useCallback((O,Ce)=>{if(!f)return;let Ve={...f,[O]:Ce};y(Ve),a.onTaskUpdate?.(Ve);},[f,a]),it=useCallback(O=>{if(!f)return;let Ce=f.progress||0;O==="completed"?Ce=100:O==="todo"&&(Ce=0);let Ve={...f,status:O,progress:Ce};y(Ve),a.onTaskUpdate?.(Ve),W(false);},[f,a]),$t=useCallback((O,Ce)=>{if(!f)return;let Ve={...f,startDate:O,endDate:Ce};y(Ve),a.onTaskUpdate?.(Ve);},[f,a]),xe=useCallback(()=>{W(false),G(false),k(null);},[]);return o?jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[l.labels.noEvents,"..."]})]})}):s?jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:w("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",d),style:c,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:w("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:l.labels.noEvents}),jsx("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:l.labels.newTask})]})}):jsxs("div",{className:w("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",d),style:c,children:[jsx("div",{className:w("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:w("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:Je}),jsx("button",{onClick:Se,className:w("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:l.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:Ke,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:ot,className:w("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:w("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:Ze.map(O=>jsx("div",{className:w("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsx("div",{className:w("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:St.map((O,Ce)=>{let Ve=O.date.getDay()===0||O.date.getDay()===6;return jsxs("div",{className:w("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?Ve?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Ve?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let He=E[Ce]||F,xt=O.events.slice(0,He),J=O.events.length-He;return jsxs("div",{className:"space-y-1 flex-1",children:[xt.map(Q=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{y(Q.task),a.onEventClick?.(Q);},whileHover:{scale:1.02},className:w("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Q.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(zd,{task:Q.task}),jsx("span",{className:"truncate",children:Q.title})]})},Q.id)),J>0&&jsxs("button",{onClick:Q=>{Q.stopPropagation(),C(ke=>({...ke,[Ce]:He+T}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",J," ",n==="es"?"M\xC1S":"MORE"]}),He>F&&O.events.length>F&&jsx("button",{onClick:Q=>{Q.stopPropagation(),C(ke=>({...ke,[Ce]:F}));},className:w("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let He=Ce>=28,xt=Ce%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),ye===Ce?Me(null):(Me(Ce),B(""),R(void 0),Y(null),P(null),q(false),we(false),fe(false),Oe(O.date));},className:w("w-5 h-5 rounded flex items-center justify-center transition-all",ye===Ce?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:w("w-3.5 h-3.5 transition-transform",ye===Ce&&"rotate-45")})}),jsx(AnimatePresence,{children:ye===Ce&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Me(null),B(""),R(void 0),Y(null),P(null),q(false),we(false),fe(false);}}),jsxs(motion.div,{initial:{opacity:0,y:He?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:He?-5:5,scale:.95},transition:{duration:.12},className:w("absolute w-[320px] rounded-lg shadow-2xl z-50",He?"bottom-full mb-1":"top-full mt-1",xt?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>{J.stopPropagation(),q(false),we(false),fe(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:V,onChange:J=>B(J.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:w("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:J=>{if(J.key==="Enter"&&V.trim()){let Q=t.availableUsers?.find(ge=>ge.id===M),ke=Ue||O.date;a.onTaskCreate?.({name:V.trim(),startDate:ke,endDate:ke,priority:I,assignees:Q?[Q]:void 0}),B(""),R(void 0),Y(null),P(null),Me(null);}J.key==="Escape"&&(Me(null),B(""),R(void 0),Y(null),P(null));}})}),jsxs("div",{className:w("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),q(!K),we(false);},className:w("p-1 rounded transition-colors",I?I==="urgent"||I==="high"?"text-red-400 bg-red-500/20":I==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:K&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(J=>jsxs("button",{onClick:()=>{R(J.id),q(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",I===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:w("w-2 h-2 rounded-full",J.color)}),jsx("span",{className:i?"text-white":"text-gray-900",children:J.label})]},J.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:J=>{J.stopPropagation(),fe(!te),q(false),we(false),Oe(Ue||O.date);},className:w("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Ue?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(Ue||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:te&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsx("div",{className:w("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let J=new Date,Q=new Date(J);Q.setDate(J.getDate()+1);let ke=new Date(J);ke.setDate(J.getDate()+((6-J.getDay()+7)%7||7));let ge=new Date(J);ge.setDate(J.getDate()+((1-J.getDay()+7)%7||7));let ae=new Date(J);ae.setDate(J.getDate()+14);let De=new Date(J);return De.setDate(J.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:ke,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ge,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:ae,display:ae.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:De,display:De.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Te,ue)=>jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{P(Te.date),fe(false);},children:[jsx("span",{children:Te.label}),jsx("span",{className:w("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Te.display})]},ue))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:w("text-xs font-medium",i?"text-white":"text-gray-900"),children:Ie.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>Oe(new Date),className:w("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Oe(new Date(Ie.getFullYear(),Ie.getMonth()-1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>Oe(new Date(Ie.getFullYear(),Ie.getMonth()+1)),className:w("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(J=>jsx("div",{className:w("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:J},J))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let J=Ie.getFullYear(),Q=Ie.getMonth(),ke=new Date(J,Q,1).getDay(),ge=new Date(J,Q+1,0).getDate(),ae=new Date(J,Q,0).getDate(),De=new Date,me=[];for(let ue=ke-1;ue>=0;ue--)me.push({dayNum:ae-ue,isCurrentMonth:false,date:new Date(J,Q-1,ae-ue)});for(let ue=1;ue<=ge;ue++)me.push({dayNum:ue,isCurrentMonth:true,date:new Date(J,Q,ue)});let Te=42-me.length;for(let ue=1;ue<=Te;ue++)me.push({dayNum:ue,isCurrentMonth:false,date:new Date(J,Q+1,ue)});return me.map((ue,Ae)=>{let ce=ue.date.toDateString()===De.toDateString(),Le=(Ue||O.date).toDateString()===ue.date.toDateString();return jsx("button",{className:w("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ue.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),ue.isCurrentMonth&&(i?"text-white":"text-gray-900"),ce&&"ring-1 ring-[#3B82F6]",Le&&"bg-[#7C3AED] text-white",!Le&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{P(ue.date),fe(false);},children:ue.dayNum},Ae)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:J=>{J.stopPropagation(),we(!Ee),q(false);},className:w("p-1 rounded transition-colors",M?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:M?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(J=>J.id===M)?.color||"#7C3AED"},children:t.availableUsers?.find(J=>J.id===M)?.initials||t.availableUsers?.find(J=>J.id===M)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:Ee&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:J=>J.stopPropagation(),children:[jsxs("button",{onClick:()=>{Y(null),we(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!M&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:w("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(J=>jsxs("button",{onClick:()=>{Y(J.id),we(false);},className:w("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",M===J.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:J.color||"#7C3AED"},children:J.initials||J.name?.slice(0,2).toUpperCase()}),jsx("span",{className:i?"text-white":"text-gray-900",children:J.name})]},J.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:w("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(V.trim()){let J=t.availableUsers?.find(ke=>ke.id===M),Q=Ue||O.date;a.onTaskCreate?.({name:V.trim(),startDate:Q,endDate:Q,priority:I,assignees:J?[J]:void 0}),B(""),R(void 0),Y(null),P(null),Me(null);}},disabled:!V.trim(),className:w("px-2.5 py-1 rounded text-xs font-medium transition-colors",V.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:w("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},Ce)})})]})}),jsx(AnimatePresence,{children:f&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:w("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:w("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:w("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:w("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:w("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxs("button",{className:w("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsx(Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsx("div",{className:"flex-1"}),jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:()=>y(null),className:w("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let O=f.progress===100?0:100,Ve={...f,progress:O,status:O===100?"completed":"todo"};y(Ve),a.onTaskUpdate?.(Ve);},className:w("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:w("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.name})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{xe(),W(!$);},className:w("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:$&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxs("button",{onClick:()=>it(O.id),className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===O.id||O.id==="completed"&&f.progress===100||O.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||O.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:w("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(User,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((O,Ce)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},Ce)),f.assignees.length>3&&jsxs("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{k(g?null:"start"),h(f.startDate||new Date);},className:w("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:w("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsx(X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsx(AnimatePresence,{children:g&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>k(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:w("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:w("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,Ce=new Date(O);Ce.setDate(O.getDate()+1);let Ve=new Date(O);Ve.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let He=new Date(O);He.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let xt=new Date(O);xt.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let J=new Date(O);J.setDate(O.getDate()+14);let Q=new Date(O);return Q.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ve,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:He,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:xt,display:xt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ge,ae)=>jsxs("button",{className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let De=f.endDate&&ge.date>f.endDate?ge.date:f.endDate;$t(ge.date,De),k("end");}else {let De=f.startDate&&ge.date<f.startDate?ge.date:f.startDate;$t(De,ge.date),k(null);}},children:[jsx("span",{children:ge.label}),jsx("span",{className:w("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:ge.display})]},ae))})(),jsx("div",{className:w("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{$t(void 0,void 0),k(null);},className:w("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:w("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:N.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>h(new Date),className:w("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>h(new Date(N.getFullYear(),N.getMonth()-1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsx("button",{onClick:()=>h(new Date(N.getFullYear(),N.getMonth()+1)),className:w("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-4 h-4"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsx("div",{className:w("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=N.getFullYear(),Ce=N.getMonth(),Ve=new Date(O,Ce,1).getDay(),He=new Date(O,Ce+1,0).getDate(),xt=new Date(O,Ce,0).getDate(),J=new Date,Q=[];for(let ge=Ve-1;ge>=0;ge--)Q.push({day:xt-ge,isCurrentMonth:false,date:new Date(O,Ce-1,xt-ge)});for(let ge=1;ge<=He;ge++)Q.push({day:ge,isCurrentMonth:true,date:new Date(O,Ce,ge)});let ke=42-Q.length;for(let ge=1;ge<=ke;ge++)Q.push({day:ge,isCurrentMonth:false,date:new Date(O,Ce+1,ge)});return Q.map((ge,ae)=>{let De=ge.date.toDateString()===J.toDateString(),me=f.startDate?.toDateString()===ge.date.toDateString(),Te=f.endDate?.toDateString()===ge.date.toDateString(),ue=me||Te,Ae=f.startDate&&f.endDate&&ge.date>=f.startDate&&ge.date<=f.endDate;return jsx("button",{className:w("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!ge.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),ge.isCurrentMonth&&(i?"text-white":"text-gray-900"),De&&"ring-2 ring-[#3B82F6]",me&&"bg-[#3B82F6] text-white",Te&&!me&&"bg-[#7C3AED] text-white",Ae&&!ue&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!ue&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let ce=new Date(ge.date);if(g==="start"){let Le=f.endDate&&ce>f.endDate?ce:f.endDate;$t(ce,Le),k("end");}else {let Le=f.startDate&&ce<f.startDate?ce:f.startDate;$t(Le,ce),k(null);}},children:ge.day},ae)})})()})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{xe(),G(!L);},className:w("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:L&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:w("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(O=>jsxs("button",{onClick:()=>{Ye("priority",O.id),G(false);},className:w("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:w("w-2 h-2 rounded-full",O.color)}),jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:w("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:w("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ee?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:O=>{let Ce=parseInt(O.target.value),Ve=f.status;Ce===100?Ve="completed":Ce>0?Ve="in-progress":Ve="todo";let He={...f,progress:Ce,status:Ve};y(He),a.onTaskUpdate?.(He);},onBlur:()=>he(false),className:w("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>he(true),className:w("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:w("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxs("span",{className:w("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Link2,{className:w("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:w("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsx("span",{className:w("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxs("button",{className:w("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsx(FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxs("button",{className:w("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(O=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:w("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:w("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:w("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsx("button",{className:w("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:w("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:w("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxs("div",{className:w("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx(Upload,{className:w("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxs("p",{className:w("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsx("span",{className:w("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxs("div",{className:w("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxs("div",{className:w("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsx(MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsx("div",{className:w("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsx("div",{className:w("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:w("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsx(AnimatePresence,{children:x&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:w("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:w("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsx("span",{className:w("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>b(null),className:w("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map(O=>jsxs("button",{onClick:()=>{b(null),y(O.task);},className:w("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(zd,{task:O.task}),jsx("span",{className:w("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var Js={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},Zs={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da"},Qs={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},hn={dark:Js,light:Zs,neutral:Qs};function Gd(e){return hn[e]||hn.dark}function Ef({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:d,className:c}){let[p,n]=useState(false),m=useMemo(()=>t.filter(u=>e.cardIds.includes(u.id)),[t,e.cardIds]),l=useMemo(()=>{let u=m.length,v=new Set(m.flatMap(x=>x.assignedUserIds||[])).size,f=m.map(x=>x.priority).filter(Boolean),y=new Set(m.flatMap(x=>x.labels||[])).size;return {totalCards:u,uniqueAssignees:v,priorities:f,labels:y}},[m]),i=()=>{o?.(e.id);};return jsxs("div",{className:w("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:w("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:l.totalCards}),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"]})]}),p&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:u=>{u.stopPropagation(),d?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[l.uniqueAssignees," assignees"]})]}),l.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[l.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:m.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:m.map(u=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(u),children:a(u)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(u),children:[jsx("h4",{children:u.title}),u.description&&jsxs("p",{children:[u.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,u.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},u.id))})})]})}var _d={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function fo(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 bo(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 Vd(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 jd({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:d,className:c}){let p=useMemo(()=>({..._d,...d}),[d]),[n,m]=useState(new Set),l=useRef(null),i=useMemo(()=>{if(!p.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let k=g.timestamp.toISOString().split("T")[0],N=b.get(k);N?N.push(g):b.set(k,[g]);}),Array.from(b.entries()).sort((g,k)=>k[0].localeCompare(g[0])).map(([g,k])=>({date:new Date(g),events:k.sort((N,h)=>h.timestamp.getTime()-N.timestamp.getTime())}))},[e,p.groupByDay]),{uniqueUsers:u,uniqueTypes:v}=useMemo(()=>{let b=new Set,g=new Set;return e.forEach(k=>{b.add(k.userId),g.add(k.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{m(g=>{let k=new Set(g);return k.has(b)?k.delete(b):k.add(b),k});},y=b=>{let k=new Date().getTime()-b.getTime(),N=Math.floor(k/6e4),h=Math.floor(k/36e5),E=Math.floor(k/864e5);return N<1?"just now":N<60?`${N}m ago`:h<24?`${h}h ago`:E<7?`${E}d ago`:b.toLocaleDateString()},x=useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return useEffect(()=>{if(s&&l.current){let b=l.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:w("history-timeline-empty",c),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:w("history-timeline",p.compact&&"compact",c),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxs("option",{value:b,children:[bo(b)," ",b.replace("_"," ")]},b))]}),u.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),u.map(b=>jsx("option",{value:b,children:b},b))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),x>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsx("div",{className:"history-timeline-container",ref:l,children:i.map(b=>jsxs("div",{className:"history-timeline-group",children:[p.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((g,k)=>{let N=n.has(g.id),h=s===g.id,E=Vd(g.type);return jsxs("div",{"data-event-id":g.id,className:w("history-timeline-event",N&&"expanded",h&&"selected"),onClick:()=>o?.(g),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:E},children:p.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:bo(g.type)})}),k<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:E}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[p.showAvatars&&g.userAvatar&&jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsx("span",{className:"history-timeline-event-action",children:fo(g)})]})]}),jsx("div",{className:"history-timeline-event-time",children:p.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:C=>{C.stopPropagation(),f(g.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([C,F])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[C,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(F.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(F.to)})]})]},C)),g.metadata&&Object.keys(g.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(g.metadata).map(([C,F])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[C,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(F)})]},C))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function Yd({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:d,onGoToEvent:c,onSpeedChange:p,className:n}){let m=[.5,1,1.5,2,3],l=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:w("history-replay-empty",n),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:w("history-replay",n),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:l&&bo(l.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:l&&fo(l)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:l&&l.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:u=>c(parseInt(u.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((u,v)=>jsx("div",{className:w("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>c(v),title:fo(u)},u.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:d,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:m.map(u=>jsxs("button",{className:w("history-replay-speed-btn",e.speed===u&&"active"),onClick:()=>p(u),children:[u,"x"]},u))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:l&&l.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(u=>jsx("span",{className:"history-replay-card-preview-label-tag",children:u},u))})]})]})]})]}):jsxs("div",{className:w("history-replay-start",n),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ei(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 ti(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 qd(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 Xd(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Ff(e,t,a,r,o,s=100){let d=e.map(p=>({...p,x:p.x??a/2+Math.random()*100-50,y:p.y??r/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(d.map(p=>[p.id,p]));for(let p=0;p<s;p++){let n=1-p/s;d.forEach(m=>{let l=a/2,i=r/2;m.vx+=(l-m.x)*o.centerForce*n,m.vy+=(i-m.y)*o.centerForce*n,d.forEach(u=>{if(m.id===u.id)return;let v=m.x-u.x,f=m.y-u.y,y=Math.sqrt(v*v+f*f)||1,x=o.chargeStrength*n/(y*y);m.vx+=v/y*x,m.vy+=f/y*x;});}),t.forEach(m=>{let l=c.get(typeof m.source=="string"?m.source:m.source.id),i=c.get(typeof m.target=="string"?m.target:m.target.id);if(!l||!i)return;let u=i.x-l.x,v=i.y-l.y,f=Math.sqrt(u*u+v*v)||1,y=(f-o.linkDistance)/f*o.forceStrength*n;l.vx+=u*y,l.vy+=v*y,i.vx-=u*y,i.vy-=v*y;}),d.forEach(m=>{m.fx!==null&&m.fx!==void 0?(m.x=m.fx,m.vx=0):m.x+=m.vx,m.fy!==null&&m.fy!==void 0?(m.y=m.fy,m.vy=0):m.y+=m.vy,m.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,m.x)),m.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,m.y)),m.vx*=.9,m.vy*=.9;});}return d}function Jd({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:d,onInteraction:c,className:p}){let n=useRef(null),[m,l]=useState([]),[i,u]=useState(null),[v,f]=useState(null),[y,x]=useState(null),[b,g]=useState(1),[k,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let L=Ff(e,t,a.width,a.height,a,150);l(L);},[e,t,a]);let h=useCallback((L,G)=>{a.enableDragging&&(G.stopPropagation(),u(L));},[a.enableDragging]),E=useCallback(L=>{if(!i||!n.current)return;let ee=n.current.getBoundingClientRect(),he=(L.clientX-ee.left-k.x)/b,ye=(L.clientY-ee.top-k.y)/b;l(Me=>Me.map(V=>V.id===i?{...V,x:he,y:ye,fx:he,fy:ye}:V));},[i,b,k]),C=useCallback(()=>{u(null);},[]),F=useCallback((L,G)=>{G.stopPropagation(),c?.({type:"node-click",node:L,position:{x:G.clientX,y:G.clientY}});},[c]),T=useCallback((L,G)=>{G.stopPropagation(),c?.({type:"edge-click",edge:L,position:{x:G.clientX,y:G.clientY}});},[c]),$=useCallback(L=>{let G=m.find(ee=>ee.id===L);return G?{x:G.x,y:G.y}:{x:0,y:0}},[m]),W=useCallback(L=>{if(L.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return L.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let G=L.card.priority;return G==="URGENT"?"#ef4444":G==="HIGH"?"#f59e0b":G==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return L.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:w("relationships-graph-empty",p),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:w("relationships-graph",p),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:d.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:d.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(L=>Math.min(L+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(L=>Math.max(L-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(L=>L.type))).map(L=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:ei(L)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[qd(L)," ",ti(L)]})]},L))}),jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:E,onMouseUp:C,onMouseLeave:C,children:[jsxs("g",{transform:`translate(${k.x}, ${k.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(L=>{let G=$(typeof L.source=="string"?L.source:L.source.id),ee=$(typeof L.target=="string"?L.target:L.target.id),he=Xd(L.type),ye=y===L.id,Me=L.onCriticalPath;return jsxs("g",{className:w("relationships-graph-edge",ye&&"hovered",Me&&"critical"),onMouseEnter:()=>x(L.id),onMouseLeave:()=>x(null),onClick:V=>T(L,V),children:[jsx("line",{x1:G.x,y1:G.y,x2:ee.x,y2:ee.y,stroke:ei(L.type),strokeWidth:Me?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ye?1:.6,markerEnd:he?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ye&&jsx("text",{x:(G.x+ee.x)/2,y:(G.y+ee.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ti(L.type)})]},L.id)})}),jsx("g",{className:"relationships-graph-nodes",children:m.map(L=>{let G=v===L.id,ee=L.onCriticalPath;return jsxs("g",{className:w("relationships-graph-node",G&&"hovered",ee&&"critical"),transform:`translate(${L.x}, ${L.y})`,onMouseDown:he=>h(L.id,he),onMouseEnter:()=>f(L.id),onMouseLeave:()=>f(null),onClick:he=>F(L,he),children:[jsx("circle",{r:ee?a.nodeSize*1.2:a.nodeSize,fill:W(L),stroke:ee?"#fbbf24":"#ffffff",strokeWidth:ee?3:2,opacity:G?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:L.card.title.length>20?L.card.title.substring(0,20)+"...":L.card.title})]},L.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function ec({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,d]=useState(""),[c,p]=useState(false),[n,m]=useState(null),[l,i]=useState(null),u=useRef(null),v=c||o;useEffect(()=>{e&&u.current&&u.current.focus();},[e]),useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let f=()=>{v||(d(""),m(null),i(null),t());},y=async()=>{if(!(!s.trim()||v)){p(true),m(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){m(b instanceof Error?b.message:"Failed to generate plan");}finally{p(false);}}},x=()=>{l&&(a(l),f());};return e?jsxs(Qe,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:f,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:l?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),l.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:l.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",l.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:l.columns.map((b,g)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",l.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[l.cards.slice(0,10).map((b,g)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),l.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",l.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:u,value:s,onChange:b=>d(b.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:v}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((b,g)=>jsx("button",{onClick:()=>d(b),disabled:v,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:b},g))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:v&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:f,disabled:v,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"}),l?jsx("button",{onClick:x,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"}):jsx("button",{onClick:y,disabled:!s.trim()||v,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:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var ai={"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 Rf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Of={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 $f(e,t,a){let r=ai[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function ho(e){return `$${e.toFixed(4)}`}var ri=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=$f(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(l=>l.timestamp>=t.start&&l.timestamp<=t.end));let r=a.length,o=a.reduce((l,i)=>l+i.cost,0),s=a.reduce((l,i)=>l+i.inputTokens,0),d=a.reduce((l,i)=>l+i.outputTokens,0),c=a.filter(l=>l.success),p=a.reduce((l,i)=>l+i.duration,0),n={},m={};return a.forEach(l=>{n[l.feature]=(n[l.feature]||0)+1,m[l.feature]=(m[l.feature]||0)+l.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:d,operationsByFeature:n,costsByFeature:m,averageDuration:r>0?p/r:0,successRate:r>0?c.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,d=new Date;a==="month"?d.setMonth(s.getMonth()-1):d.setDate(s.getDate()-1);let c=this.operations.filter(m=>m.timestamp>=d).length,p=Math.max(0,o-c),n=c/o*100;return {used:c,limit:o,remaining:p,percentUsed:n,isExceeded:c>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},kr=new ri;function rc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(kr.getStats()),[s,d]=useState(kr.checkLimit(a));if(useEffect(()=>{if(!e)return;let p=setInterval(()=>{o(kr.getStats()),d(kr.checkLimit(a));},1e3);return ()=>clearInterval(p)},[e,a]),useEffect(()=>{let p=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,t]),!e)return null;let c=kr.getRecentOperations(5);return jsxs(Qe,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:p=>p.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[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:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ho(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([p,n])=>{let m=r.costsByFeature[p]||0,l=r.totalOperations>0?n/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:p.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ho(m)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${l}%`}})})]},p)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:c.map(p=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:p.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(p.timestamp).toLocaleTimeString()," \u2022"," ",p.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[p.inputTokens+p.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ho(p.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${p.success?"bg-green-400":"bg-red-400"}`})]})]},p.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),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 sc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[d,c]=useState(""),[p,n]=useState(""),[m,l]=useState(""),[i,u]=useState(false),[v,f]=useState(null),[y,x]=useState(null),[b,g]=useState(null),k=useRef(null),N=i||o;useEffect(()=>{e&&k.current&&k.current.focus();},[e]),useEffect(()=>{let T=$=>{$.key==="Escape"&&!N&&h();};if(e)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,N]);let h=()=>{N||(c(""),n(""),l(""),f(null),x(null),g(null),t());},E=async()=>{if(!(!d.trim()||N)){u(true),f(null),x(null),g(null);try{let T=await r({prompt:d.trim(),projectName:s||"Mi Proyecto",startDate:p||void 0,endDate:m||void 0});x(T.tasks.tasks),g({from_cache:T.from_cache,tokens_used:T.tokens_used,mock_mode:T.mock_mode,similarity:T.similarity,tokens_saved:T.tokens_saved});}catch(T){f(T instanceof Error?T.message:"Failed to generate tasks");}finally{u(false);}}},C=()=>{y&&(a(y),h());};if(!e)return null;let F=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(Qe,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:h}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:T=>T.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:h,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&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"}),b?.from_cache?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 (",F,"% similar)"]}):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"}),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:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&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:[b.tokens_saved," tokens saved"]}),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:[y.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((T,$)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",$+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:T.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),T.start," \u2192 ",T.end]}),jsxs("span",{children:[T.duration," days"]}),T.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",T.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${T.priority==="high"?"bg-red-500/20 text-red-400":T.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:T.priority})]})},T.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:k,value:d,onChange:T=>c(T.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:N}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:p,onChange:T=>n(T.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:N})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:T=>l(T.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:N})]})]}),v&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((T,$)=>jsx("button",{onClick:()=>c(T),disabled:N,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:T},$))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:N&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:h,disabled:N,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"}),y?jsx("button",{onClick:C,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"}):jsx("button",{onClick:E,disabled:!d.trim()||N,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:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function xn({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(y=>{t&&Eo(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=useCallback(async(y,x,b)=>{r(g=>{let k=g.cards.find(T=>T.id===y);if(!k)return g;let N=k.columnId,h={...k,columnId:x,position:b},E=g.cards.map(T=>T.id===y?h:T),C=g.columns.map(T=>{if(T.id===N)return {...T,cardIds:T.cardIds.filter($=>$!==y)};if(T.id===x){let $=E.filter(W=>W.columnId===x).sort((W,L)=>W.position-L.position);return {...T,cardIds:$.map(W=>W.id)}}return T}),F={...g,cards:E,columns:C};return o(F),F});},[o]),d=useCallback(async(y,x)=>{r(b=>{let g=b.cards.map(N=>N.id===y?{...N,...x}:N),k={...b,cards:g};return o(k),k});},[o]),c=useCallback(async y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x},k=b.columns.map(h=>h.id===y.columnId?{...h,cardIds:[...h.cardIds,x]}:h),N={...b,cards:[...b.cards,g],columns:k};return o(N),N});},[o]),p=useCallback(async y=>{r(x=>{let b=x.cards.find(h=>h.id===y);if(!b)return x;let g=x.cards.filter(h=>h.id!==y),k=x.columns.map(h=>h.id===b.columnId?{...h,cardIds:h.cardIds.filter(E=>E!==y)}:h),N={...x,cards:g,columns:k};return o(N),N});},[o]),n=useCallback(async y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x,cardIds:[]},k={...b,columns:[...b.columns,g]};return o(k),k});},[o]),m=useCallback(async(y,x)=>{r(b=>{let g=b.columns.map(N=>N.id===y?{...N,...x}:N),k={...b,columns:g};return o(k),k});},[o]),l=useCallback(async y=>{r(x=>{let b=x.cards.filter(N=>N.columnId!==y),g=x.columns.filter(N=>N.id!==y),k={...x,cards:b,columns:g};return o(k),k});},[o]),i=useCallback(y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(y),x},[c]),u=useCallback(y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(y),x},[n]),v=useCallback(()=>{r(y=>{let x={...y,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:d,onCardCreate:c,onCardDelete:p,onColumnCreate:n,onColumnUpdate:m,onColumnDelete:l},setBoard:r,helpers:{addCard:i,addColumn:u,deleteCard:p,deleteColumn:l,clearBoard:v}}}function lc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=xn({initialBoard:e,onPersist:a}),d=useMemo(()=>({addCard:(p,n,m={})=>{s.addCard({title:n,columnId:p,position:r.cards.filter(l=>l.columnId===p).length,...m});},addColumn:(p,n)=>{let m=r.columns.length>0?Math.max(...r.columns.map(l=>l.position)):0;s.addColumn({title:p,position:n??m+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:d}}var yo={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},cc={by:"none",order:"asc"};function pc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...yo,...e}),[s,d]=useState({...cc,...t}),c=useCallback(f=>{o(y=>({...y,...f}));},[]),p=useCallback(f=>{d(y=>({...y,...f}));},[]),n=useCallback(()=>{o(yo),d(cc);},[]),m=useCallback(()=>{a&&o({...yo,assignees:[a]});},[a]),l=useCallback(()=>{o({...yo,dateFilter:"overdue"});},[]),i=useCallback(()=>{o({...yo,priorities:["HIGH","URGENT"]});},[]),u=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=useCallback(f=>{let y=[...f];if(r.search){let x=r.search.toLowerCase();y=y.filter(b=>b.title.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,b=x.getFullYear(),g=String(x.getMonth()+1).padStart(2,"0"),k=String(x.getDate()).padStart(2,"0"),N=`${b}-${g}-${k}`;y=y.filter(h=>{if(!h.endDate&&!h.dueDate)return false;let E=h.endDate||h.dueDate;if(!E)return false;let C;if(typeof E=="string")C=E.split("T")[0]||E;else {let F=E.getUTCFullYear(),T=String(E.getUTCMonth()+1).padStart(2,"0"),$=String(E.getUTCDate()).padStart(2,"0");C=`${F}-${T}-${$}`;}switch(r.dateFilter){case "overdue":return C<N;case "today":return C===N;case "this-week":let F=new Date(N+"T00:00:00"),T=new Date(C+"T00:00:00"),$=new Date(F);return $.setDate($.getDate()+7),T>=F&&T<=$;case "custom":if(r.dateRange){let W=typeof E=="string"?new Date(E):E;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(y=y.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(x=>x.labels&&x.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(y=y.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&y.sort((x,b)=>{let g=0;switch(s.by){case "created":let k=x.createdAt?new Date(x.createdAt).getTime():0,N=b.createdAt?new Date(b.createdAt).getTime():0;g=k-N;break;case "priority":let h={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},E=h[x.priority||"LOW"],C=h[b.priority||"LOW"];g=E-C;break;case "dueDate":let F=x.endDate||x.dueDate,T=b.endDate||b.dueDate;if(!F)return 1;if(!T)return -1;let $=typeof F=="string"?new Date(F).getTime():F.getTime(),W=typeof T=="string"?new Date(T).getTime():T.getTime();g=$-W;break;case "title":g=x.title.localeCompare(b.title);break;case "estimate":let L=x.estimatedTime||0,G=b.estimatedTime||0;g=L-G;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:c,setSort:p,resetFilters:n,filterMyTasks:m,filterOverdue:l,filterHighPriority:i,applyFilters:v,hasActiveFilters:u}}var uc,gc;if(typeof window<"u")try{let e=Do("ai");uc=e.generateObject,gc=e.generateText;}catch{}function fc(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(uc&&gc&&e.apiKey),d=useCallback(async l=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(null);try{return console.log("Generating plan for:",l),{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: ${l}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(i){let u=i instanceof Error?i:new Error("Failed to generate plan");throw o(u),u}finally{a(false);}},[s]),c=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",l.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let u=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(u),u}finally{a(false);}},[s]),p=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(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(i){let u=i instanceof Error?i:new Error("Failed to predict risks");throw o(u),u}finally{a(false);}},[s]),n=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Generating subtasks for:",l.title),[{title:`Subtask 1 for: ${l.title}`,position:l.position+.1,columnId:l.columnId},{title:`Subtask 2 for: ${l.title}`,position:l.position+.2,columnId:l.columnId}]}catch(i){let u=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(u),u}finally{a(false);}},[s]),m=useCallback(async l=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",l.title),{hours:8,confidence:.75}}catch(i){let u=i instanceof Error?i:new Error("Failed to estimate effort");throw o(u),u}finally{a(false);}},[s]);return {onGeneratePlan:d,onSuggestAssignee:c,onPredictRisks:p,onGenerateSubtasks:n,onEstimateEffort:m,isAvailable:s,isLoading:t,error:r}}function ni(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function bc(e){let{cards:t}=e,[a,r]=ni(),o=useCallback(l=>a.selectedCardIds.includes(l),[a.selectedCardIds]),s=useCallback((l,i)=>{if(!i){r({selectedCardIds:[l],lastSelectedCardId:l});return}let u=i.ctrlKey||i.metaKey,v=i.shiftKey;if(u)a.selectedCardIds.includes(l)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==l),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});else if(v&&a.lastSelectedCardId){let f=t.find(x=>x.id===l),y=t.find(x=>x.id===a.lastSelectedCardId);if(f&&y&&f.columnId===y.columnId){let x=t.filter(C=>C.columnId===f.columnId).sort((C,F)=>C.position-F.position),b=x.findIndex(C=>C.id===a.lastSelectedCardId),g=x.findIndex(C=>C.id===l),[k,N]=b<g?[b,g]:[g,b],h=x.slice(k,N+1).map(C=>C.id),E=Array.from(new Set([...a.selectedCardIds,...h]));r({selectedCardIds:E,lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});}else r({selectedCardIds:[l],lastSelectedCardId:l});},[t,a,r]),d=useCallback(l=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==l),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),c=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),p=useCallback(()=>{r({selectedCardIds:t.map(l=>l.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=useCallback(l=>{a.selectedCardIds.includes(l)?d(l):r({selectedCardIds:[...a.selectedCardIds,l],lastSelectedCardId:l});},[a,d,r]),m=useCallback(()=>t.filter(l=>a.selectedCardIds.includes(l.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:d,clearSelection:c,selectAll:p,toggleCard:n,getSelectedCards:m}}var hc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function yc(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...hc,...a}),[a]),[s,d]=useState([]),c=useCallback((f,y,x,b,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let k={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:y,columnId:x,strategy:b,color:g,isExpanded:true,position:s.filter(N=>N.columnId===x).length,createdAt:new Date};d(N=>[...N,k]);},[o.minCardsPerStack,s]),p=useCallback(f=>{d(y=>y.filter(x=>x.id!==f));},[]),n=useCallback(f=>{d(y=>y.map(x=>x.id===f?{...x,isExpanded:!x.isExpanded}:x));},[]),m=useCallback((f,y)=>{d(x=>x.map(b=>b.id===f&&!b.cardIds.includes(y)?{...b,cardIds:[...b.cardIds,y]}:b));},[]),l=useCallback((f,y)=>{d(x=>x.map(b=>{if(b.id===f){let g=b.cardIds.filter(k=>k!==y);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=useCallback(f=>s.filter(y=>y.columnId===f).sort((y,x)=>y.position-x.position),[s]),u=useCallback(async f=>{let y=t.filter(N=>N.columnId===f);if(y.length<o.minCardsPerStack*2)return [];let x=[],b=new Map;y.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(h=>{b.has(h)||b.set(h,[]),b.get(h).push(N);});}),b.forEach((N,h)=>{N.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${h}`,cardIds:N.map(E=>E.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${N.length} cards with label "${h}"`,confidence:.85});});let g=new Map;y.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(h=>{g.has(h)||g.set(h,[]),g.get(h).push(N);});}),g.forEach((N,h)=>{N.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${h.slice(-4)}`,cardIds:N.map(E=>E.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let k=new Map;if(y.forEach(N=>{N.priority&&(k.has(N.priority)||k.set(N.priority,[]),k.get(N.priority).push(N));}),k.forEach((N,h)=>{if(N.length>=o.minCardsPerStack){let E={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[h.toLowerCase()]||"\u26AA";x.push({stack:{title:`${E} ${h} Priority`,cardIds:N.map(C=>C.id),columnId:f,strategy:"priority",color:h==="high"||h==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${h} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let N of y){let E=(await r.findSimilar(N,y)).filter(C=>C.similarity>=o.autoStackConfidenceThreshold);if(E.length>=o.minCardsPerStack-1){let C=[N.id,...E.map(T=>T.card.id)],F=E.reduce((T,$)=>T+$.similarity,0)/E.length;x.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:C,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${E.length+1} similar tasks`,confidence:F});}}return x.filter(N=>N.confidence>=o.autoStackConfidenceThreshold).sort((N,h)=>h.confidence-N.confidence).slice(0,5)},[t,o,r]),v=useCallback(f=>{c(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[c]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let x=await u(y),b=x[0];x.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:s,createStack:c,deleteStack:p,toggleStack:n,addToStack:m,removeFromStack:l,getStacksForColumn:i,getSuggestions:u,applySuggestion:v,config:o}}var vc=createContext(null);function xc({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,d=new Map;t?.columns?.forEach(p=>{let{Column:n}=Do("@libxai/core");s.set(p.id,new n(p));}),t?.cards?.forEach(p=>{let{Card:n}=Do("@libxai/core");d.set(p.id,new n(p));});let c=null;if(t?.board){let{Board:p}=Do("@libxai/core");c=new p(t.board);}r.current=new BoardStore({board:c,columns:s,cards:d});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(vc.Provider,{value:{store:o},children:e})}function kn(){let e=useContext(vc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function xo(){let e=kn(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,d]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),d(e.getAllCards());}),[e]);let c=useCallback(b=>{e.updateBoard(b);},[e]),p=useCallback(b=>{e.addColumn(b);},[e]),n=useCallback((b,g)=>{e.updateColumn(b,g);},[e]),m=useCallback(b=>{e.deleteColumn(b);},[e]),l=useCallback(b=>e.getColumn(b),[e]),i=useCallback(b=>{e.addCard(b);},[e]),u=useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=useCallback(b=>{e.deleteCard(b);},[e]),f=useCallback((b,g,k)=>{e.moveCard(b,g,k);},[e]),y=useCallback(b=>e.getCard(b),[e]),x=useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:c,addColumn:p,updateColumn:n,deleteColumn:m,getColumn:l,addCard:i,updateCard:u,deleteCard:v,moveCard:f,getCard:y,getCardsByColumn:x}}function wc(e){let{cards:t}=xo();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Cc(e="position",t="asc"){let{cards:a}=xo();return useMemo(()=>[...a].sort((o,s)=>{let d=0;switch(e){case "title":d=o.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},p=o.priority?c[o.priority]:0,n=s.priority?c[s.priority]:0;d=p-n;break}case "createdAt":d=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":d=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":d=o.position-s.position;break}return t==="asc"?d:-d}),[a,e,t])}var wn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Mi.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 a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} 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(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(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,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let d=s[t];if(typeof d=="function")try{let c=await Promise.resolve(d.apply(s,a));c!==void 0&&(o=c,a[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(d=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,d,{plugin:o.id,hook:t});}));}await Promise.all(r);}},tb=new wn;function Dc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:d=false,gap:c=0,getItemKey:p}){let n=useRef(null),m=useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:d,gap:c}),l=m.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},u=d?{width:`${m.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${m.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:n,style:i,className:o,children:jsx("div",{style:u,children:l.map(v=>{let f=e[v.index];if(!f)return null;let y=p?p(f,v.index):v.index,x={position:"absolute",top:d?0:v.start,left:d?v.start:0,width:d?v.size:"100%",height:d?"100%":v.size};return jsx("div",{style:x,"data-index":v.index,children:r(f,v.index)},y)})})})}function Nc(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function Ec({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:d=3,gap:c=16,getItemKey:p,horizontal:n=true}){let m=useRef(null),l=useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>m.current,estimateSize:()=>r,overscan:d,gap:c}),i=l.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${l.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:m,style:u,className:s,children:jsx("div",{style:v,children:i.map(f=>{let y=e[f.index];if(!y)return null;let x=p?p(y,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsx("div",{style:b,"data-index":f.index,children:o(y,f.index)},x)})})})}function Pc(e){let t=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 Mc(e,t=10){return e>t}var di={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ci={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},pi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},mi={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},ui={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},gi={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},fi={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},bi={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)"},hi={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)"},yi={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},vi={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}},xi={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}},Cn={spacing:di,borderRadius:ci,fontSize:pi,fontWeight:mi,lineHeight:ui,zIndex:gi,duration:fi,easing:bi,shadows:hi,opacity:yi,kanban:vi,gantt:xi};function Ac(e,t,a){return e[t]??a}function ki(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?ki(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function ob(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function wi(e="asakaa"){let t=ki(Cn),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,d=ob(o);a.push(` ${s}: ${d};`);}return `:root {
|
|
323
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function Ld(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function _a(e,t){let a=Ld(e),r=t.toLowerCase().trim(),o=a.find(p=>p.name.toLowerCase()===r);if(o)return o;let s=a.find(p=>p.name.toLowerCase().includes(r));if(s)return s;let l=r.split(/\s+/);return a.find(p=>{let m=p.name.toLowerCase();return l.every(n=>m.includes(n))})}function Ws(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let i=new Date(r);return i.setDate(i.getDate()+1),i}if(a==="yesterday"||a==="ayer"){let i=new Date(r);return i.setDate(i.getDate()-1),i}if(a==="next week"||a==="la pr\xF3xima semana"){let i=new Date(r);return i.setDate(i.getDate()+7),i}let o=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(o){let c={sunday:0,domingo:0,monday:1,lunes:1,tuesday:2,martes:2,wednesday:3,mi\u00E9rcoles:3,miercoles:3,thursday:4,jueves:4,friday:5,viernes:5,saturday:6,s\u00E1bado:6,sabado:6}[o[1].toLowerCase()];if(c!==void 0){let v=new Date(r),f=v.getDay(),y=c-f;return y<=0&&(y+=7),v.setDate(v.getDate()+y),v}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let i=parseInt(s[1],10),c=s[2].toLowerCase(),v=new Date(r);return c==="day"||c==="d\xEDa"||c==="dias"?v.setDate(v.getDate()+i):c==="week"||c==="semana"||c==="semanas"?v.setDate(v.getDate()+i*7):(c==="month"||c==="mes"||c==="meses")&&v.setMonth(v.getMonth()+i),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let p=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(p&&p[1]&&p[2]&&p[3]){let i=parseInt(p[1],10),c=parseInt(p[2],10)-1,v=parseInt(p[3],10);return new Date(v,c,i)}let m={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},n=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(n&&n[1]&&n[2]){let i=parseInt(n[1],10),c=m[n[2].toLowerCase()],v=n[3]?parseInt(n[3],10):r.getFullYear();if(c!==void 0)return new Date(v,c,i)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},d=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(d&&d[1]&&d[2]){let i=u[d[1].toLowerCase()],c=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(i!==void 0)return new Date(v,i,c)}return null}function Gs(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),o=a[2].toLowerCase();if(o==="day"||o==="d\xEDa"||o==="dias")return r;if(o==="week"||o==="semana"||o==="semanas")return r*7;if(o==="month"||o==="mes"||o==="meses")return r*30}return null}function Hs(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Fd(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Bd(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let n=r[1].trim(),u=r[2].trim(),d=_a(t,n),i=Ws(u);if(!d)return {type:"move_task",taskName:n,message:`Could not find a task named "${n}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!i)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let c=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(i);return v.setDate(v.getDate()+c),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:i,endDate:v},message:`Moved "${d.name}" to ${i.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let n=o[1].trim(),u=o[2].trim(),d=_a(t,n),i=Gs(u);if(!d)return {type:"resize_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"};if(!i||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let c=new Date(d.endDate);return c.setDate(c.getDate()+i),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:c},message:`Extended "${d.name}" by ${i} days. New end date: ${c.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let n=s[1].trim(),u=s[2].trim(),d=_a(t,n),i=Hs(u);return d?i===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:i},message:`Set "${d.name}" progress to ${i}%.`,success:true}:{type:"set_progress",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let l=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let n=l[1].trim(),u=l[2].trim(),d=_a(t,n);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:u},message:`Renamed "${d.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}let p=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(p&&p[1]&&p[2]){let n=p[1].trim(),u=p[2].trim(),d=_a(t,n),i=_a(t,u);return d?i?{type:"link_tasks",taskId:i.id,taskName:i.name,dependencyFrom:d.id,dependencyTo:i.id,message:`Linked "${d.name}" \u2192 "${i.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Source task not found"}}let m=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(m&&m[1]){let n=m[1].trim(),u=_a(t,n);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:n,message:`Could not find a task named "${n}".`,success:false,error:"Task not found"}}return null}function Rd(e){if(!e||typeof e!="object")return {type:"unknown",message:"Invalid response from AI",success:false,error:"Invalid response format"};let t=e;return {type:t.type||"unknown",taskId:typeof t.taskId=="string"?t.taskId:void 0,taskName:typeof t.taskName=="string"?t.taskName:void 0,updates:t.updates,newTask:t.newTask,dependencyFrom:typeof t.dependencyFrom=="string"?t.dependencyFrom:void 0,dependencyTo:typeof t.dependencyTo=="string"?t.dependencyTo:void 0,message:typeof t.message=="string"?t.message:"Command processed",success:typeof t.success=="boolean"?t.success:false,error:typeof t.error=="string"?t.error:void 0}}function hf(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 yf(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function mn(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let d=a.find(i=>i.id===u);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(u=>u!==null),o=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>mn(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let l=u=>{if(u)return typeof u=="string"?new Date(u):u},p=l(e.startDate),m=l(e.endDate),n=e.metadata?.isMilestone===true||p&&m&&Math.abs(m.getTime()-p.getTime())<=864e5;return {id:e.id,name:e.title,startDate:p,endDate:m,progress:e.progress||0,status:hf(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:o?.length?o:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:n,isCriticalPath:e.metadata?.isCriticalPath===true}}function Od(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:yf(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $d(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>mn(r,e,t))}var _s={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions"},toolbar:{search:"Search",searchPlaceholder:"Search tasks...",filter:"Filter",clearFilters:"Clear Filters",export:"Export",columns:"Columns",newTask:"New Task"},filters:{status:"Status",assignees:"Assignees",dateRange:"Date Range",showCompleted:"Show Completed",all:"All",none:"None"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",viewDetails:"View Details"},empty:{noTasks:"No tasks yet",noResults:"No tasks match your filters",addFirstTask:"Add your first task"},pagination:{showing:"Showing",of:"of",tasks:"tasks",previous:"Previous",next:"Next"},bulk:{selected:"selected",delete:"Delete",move:"Move to",assignTo:"Assign to"}},Vs={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones"},toolbar:{search:"Buscar",searchPlaceholder:"Buscar tareas...",filter:"Filtrar",clearFilters:"Limpiar Filtros",export:"Exportar",columns:"Columnas",newTask:"Nueva Tarea"},filters:{status:"Estado",assignees:"Asignados",dateRange:"Rango de Fechas",showCompleted:"Mostrar Completadas",all:"Todos",none:"Ninguno"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",viewDetails:"Ver Detalles"},empty:{noTasks:"Sin tareas a\xFAn",noResults:"Ninguna tarea coincide con los filtros",addFirstTask:"Agrega tu primera tarea"},pagination:{showing:"Mostrando",of:"de",tasks:"tareas",previous:"Anterior",next:"Siguiente"},bulk:{selected:"seleccionadas",delete:"Eliminar",move:"Mover a",assignTo:"Asignar a"}},un={en:_s,es:Vs};function js(e){return un[e]||un.en}function gn(e,t){let a=js(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}function Gd(e,t=0){let a=[];for(let r of e)a.push({...r,level:t,hasChildren:(r.subtasks?.length||0)>0,parentPath:[r.id]}),r.subtasks?.length&&r.isExpanded!==false&&a.push(...Gd(r.subtasks,t+1));return a}function Pf({status:e,progress:t}){return t===100||e==="completed"?jsx(CheckCircle2,{className:"w-5 h-5 text-green-500"}):t&&t>0||e==="in-progress"?jsx(PlayCircle,{className:"w-5 h-5 text-blue-500"}):jsx(Circle,{className:"w-5 h-5 text-gray-400"})}function Hd({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:l}){let{theme:p="dark",locale:m="en",customTranslations:n,showSearch:u=true,showHierarchy:d=true}=t,i=gn(m,n),c=p==="dark",[v,f]=useState(new Set),[y,x]=useState("startDate"),[b,g]=useState("asc"),[w,T]=useState("");useMemo(()=>{let D=new Set;function $(W){for(let F of W)F.subtasks?.length&&(D.add(F.id),$(F.subtasks));}$(e),f(D);},[e]);let k=useCallback(D=>{f($=>{let W=new Set($);return W.has(D)?W.delete(D):W.add(D),W}),a.onTaskToggleExpand?.(D);},[a]),N=useCallback(D=>{y===D?g($=>$==="asc"?"desc":"asc"):(x(D),g("asc")),a.onSortChange?.({column:D,direction:b==="asc"?"desc":"asc"});},[y,b,a]),h=useMemo(()=>{let D=Gd(e);if(w.trim()){let W=w.toLowerCase();D=D.filter(F=>F.name.toLowerCase().includes(W));}let $=[];for(let W of D){let F=W.level===0;W.level>0&&(F=true),(F||w.trim())&&$.push(W);}return w.trim()&&$.sort((W,F)=>{let G,Z;switch(y){case "name":G=W.name.toLowerCase(),Z=F.name.toLowerCase();break;case "startDate":G=W.startDate?.getTime()||0,Z=F.startDate?.getTime()||0;break;case "endDate":G=W.endDate?.getTime()||0,Z=F.endDate?.getTime()||0;break;case "progress":G=W.progress||0,Z=F.progress||0;break;case "status":G=W.status||"todo",Z=F.status||"todo";break;default:return 0}return G<Z?b==="asc"?-1:1:G>Z?b==="asc"?1:-1:0}),$},[e,w,y,b]),M=D=>D?(D instanceof Date?D:new Date(D)).toLocaleDateString(m==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):"-";return r?jsx("div",{className:C("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:C("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[i.empty.noTasks,"..."]})]})}):o?jsx("div",{className:C("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:C("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:C("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:C("flex-1 flex items-center justify-center",c?"bg-[#0F1117]":"bg-white",s),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:C("text-lg font-semibold mb-2",c?"text-white":"text-gray-900"),children:i.empty.noTasks}),jsx("p",{className:C("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.addFirstTask})]})}):jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-hidden",c?"bg-[#0F1117]":"bg-white",s),style:l,children:[jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",c?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[u&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:C("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",c?"text-[#9CA3AF]":"text-gray-400")}),jsx("input",{type:"text",value:w,onChange:D=>T(D.target.value),placeholder:i.toolbar.searchPlaceholder,className:C("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",c?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsxs("div",{className:C("text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[h.length," ",i.pagination.tasks]})]})}),jsxs("div",{className:C("flex-shrink-0 grid grid-cols-12 gap-4 px-6 py-3 border-b text-xs font-medium uppercase tracking-wider",c?"border-white/10 bg-white/5 text-[#9CA3AF]":"border-gray-200 bg-gray-50 text-gray-500"),children:[jsx("div",{className:"col-span-5 flex items-center gap-2",children:jsxs("button",{onClick:()=>N("name"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.name,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>N("status"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.status,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>N("startDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.startDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-2 flex items-center gap-1",children:jsxs("button",{onClick:()=>N("endDate"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[i.columns.endDate,jsx(ArrowUpDown,{className:"w-3 h-3"})]})}),jsx("div",{className:"col-span-1 flex items-center gap-1",children:jsxs("button",{onClick:()=>N("progress"),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:["%",jsx(ArrowUpDown,{className:"w-3 h-3"})]})})]}),jsxs("div",{className:"flex-1 overflow-auto",children:[jsx(AnimatePresence,{children:h.map((D,$)=>{let W=v.has(D.id);return jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{delay:$*.02},className:C("grid grid-cols-12 gap-4 px-6 py-3 border-b transition-colors cursor-pointer",c?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),style:{paddingLeft:d?`${24+D.level*24}px`:void 0},onClick:()=>a.onTaskClick?.(D),onDoubleClick:()=>a.onTaskDoubleClick?.(D),children:[jsxs("div",{className:"col-span-5 flex items-center gap-2 min-w-0",children:[d&&D.hasChildren&&jsx("button",{onClick:F=>{F.stopPropagation(),k(D.id);},className:C("p-0.5 rounded",c?"hover:bg-white/10":"hover:bg-gray-200"),children:W?jsx(ChevronDown,{className:C("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:C("w-4 h-4",c?"text-[#9CA3AF]":"text-gray-400")})}),d&&!D.hasChildren&&jsx("div",{className:"w-5"}),jsx("button",{onClick:F=>{F.stopPropagation(),a.onTaskUpdate?.({...D,progress:D.progress===100?0:100,status:D.progress===100?"todo":"completed"});},className:"flex-shrink-0",children:jsx(Pf,{status:D.status,progress:D.progress})}),jsx("span",{className:C("truncate",c?"text-white":"text-gray-900",D.progress===100&&(c?"line-through text-[#6B7280]":"line-through text-gray-400")),children:D.name})]}),jsx("div",{className:"col-span-2 flex items-center",children:jsx("span",{className:C("px-2 py-1 rounded-full text-xs font-medium",D.progress===100||D.status==="completed"?"bg-green-500/10 text-green-500":D.progress&&D.progress>0||D.status==="in-progress"?"bg-blue-500/10 text-blue-500":c?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:D.progress===100||D.status==="completed"?i.status.completed:D.progress&&D.progress>0||D.status==="in-progress"?i.status.inProgress:i.status.todo})}),jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Calendar,{className:"w-4 h-4"}),M(D.startDate)]}),jsxs("div",{className:C("col-span-2 flex items-center gap-1 text-sm",c?"text-[#9CA3AF]":"text-gray-600"),children:[jsx(Clock,{className:"w-4 h-4"}),M(D.endDate)]}),jsx("div",{className:"col-span-1 flex items-center",children:jsxs("div",{className:"flex items-center gap-2 w-full",children:[jsx("div",{className:C("flex-1 h-1.5 rounded-full overflow-hidden",c?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:C("h-full rounded-full transition-all",D.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${D.progress||0}%`}})}),jsxs("span",{className:C("text-xs w-8",c?"text-[#9CA3AF]":"text-gray-500"),children:[D.progress||0,"%"]})]})})]},D.id)})}),h.length===0&&w&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:C("w-12 h-12 mx-auto mb-4",c?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:C(c?"text-[#9CA3AF]":"text-gray-600"),children:i.empty.noResults})]})})]})]})}var Ks={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgSelected:"#1f6feb20",bgAlternate:"#0d111780",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff",checkboxBg:"#21262d",checkboxChecked:"#58a6ff"},Ys={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgSelected:"#dbeafe",bgAlternate:"#f9fafb",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da",checkboxBg:"#ffffff",checkboxChecked:"#0969da"},qs={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgSelected:"#0f4c7520",bgAlternate:"#1a1a2e80",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1",checkboxBg:"#1f3460",checkboxChecked:"#6366f1"},bn={dark:Ks,light:Ys,neutral:qs};function _d(e){return bn[e]||bn.dark}var Xs={navigation:{today:"Today",previous:"Previous",next:"Next",month:"Month",week:"Week",day:"Day"},weekdays:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weekdaysFull:{sunday:"Sunday",monday:"Monday",tuesday:"Tuesday",wednesday:"Wednesday",thursday:"Thursday",friday:"Friday",saturday:"Saturday"},months:{january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{allDay:"All day",moreEvents:"+{count} more",noEvents:"No tasks",newTask:"New Task",viewAll:"View all",week:"Week"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Js={navigation:{today:"Hoy",previous:"Anterior",next:"Siguiente",month:"Mes",week:"Semana",day:"D\xEDa"},weekdays:{sun:"Dom",mon:"Lun",tue:"Mar",wed:"Mi\xE9",thu:"Jue",fri:"Vie",sat:"S\xE1b"},weekdaysFull:{sunday:"Domingo",monday:"Lunes",tuesday:"Martes",wednesday:"Mi\xE9rcoles",thursday:"Jueves",friday:"Viernes",saturday:"S\xE1bado"},months:{january:"Enero",february:"Febrero",march:"Marzo",april:"Abril",may:"Mayo",june:"Junio",july:"Julio",august:"Agosto",september:"Septiembre",october:"Octubre",november:"Noviembre",december:"Diciembre"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{allDay:"Todo el d\xEDa",moreEvents:"+{count} m\xE1s",noEvents:"Sin tareas",newTask:"Nueva Tarea",viewAll:"Ver todo",week:"Semana"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},hn={en:Xs,es:Js};function ho(e){return hn[e]||hn.en}function yn(e,t){let a=ho(e);return t?{navigation:{...a.navigation,...t.navigation},weekdays:{...a.weekdays,...t.weekdays},weekdaysFull:{...a.weekdaysFull,...t.weekdaysFull},months:{...a.months,...t.months},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},tooltips:{...a.tooltips,...t.tooltips}}:a}function Vd(e){let t=ho(e);return [t.months.january,t.months.february,t.months.march,t.months.april,t.months.may,t.months.june,t.months.july,t.months.august,t.months.september,t.months.october,t.months.november,t.months.december]}function jd(e,t=0,a=true){let r=ho(e),o=a?[r.weekdays.sun,r.weekdays.mon,r.weekdays.tue,r.weekdays.wed,r.weekdays.thu,r.weekdays.fri,r.weekdays.sat]:[r.weekdaysFull.sunday,r.weekdaysFull.monday,r.weekdaysFull.tuesday,r.weekdaysFull.wednesday,r.weekdaysFull.thursday,r.weekdaysFull.friday,r.weekdaysFull.saturday];return [...o.slice(t),...o.slice(0,t)]}function Gf(e){let t=[];function a(r){for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);}return a(e),t}function ai(e,t){if(!t.startDate||!t.endDate)return false;let a=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(t.startDate.getFullYear(),t.startDate.getMonth(),t.startDate.getDate()),o=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=o}function qd({task:e}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-green-500 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-blue-500 flex-shrink-0"}):jsx(Circle,{className:"w-3 h-3 text-gray-400 flex-shrink-0"})}function Jd({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:l,style:p}){let{theme:m="dark",locale:n="en",customTranslations:u}=t,d=yn(n,u),i=m==="dark",[c,v]=useState(r||new Date),[f,y]=useState(null),[x,b]=useState(null),[g,w]=useState(null),[T,k]=useState(new Date),[N,h]=useState({}),M=4,D=3,[$,W]=useState(false),[F,G]=useState(false),[Z,ve]=useState(false),[ke,Me]=useState(null),[Oe,B]=useState(""),[S,R]=useState(void 0),[P,K]=useState(null),[te,Y]=useState(false),[ce,pe]=useState(false),[je,me]=useState(null),[qe,L]=useState(false),[re,Ne]=useState(new Date),Le=useCallback(()=>{v(new Date(c.getFullYear(),c.getMonth()-1,1));},[c]),Be=useCallback(()=>{v(new Date(c.getFullYear(),c.getMonth()+1,1));},[c]),Je=useCallback(()=>{v(new Date);},[]),kt=useMemo(()=>{let O=c.getFullYear(),Ce=c.getMonth(),Ke=new Date(O,Ce,1),Ve=new Date(O,Ce+1,0),St=Ke.getDay(),q=Ve.getDate(),J=Gf(e),we=new Date;we.setHours(0,0,0,0);let he=[],Q=St,De=new Date(O,Ce,0).getDate();for(let Te=Q-1;Te>=0;Te--){let ue=new Date(O,Ce-1,De-Te);he.push({date:ue,isCurrentMonth:false,isToday:false,isWeekend:ue.getDay()===0||ue.getDay()===6,events:J.filter(Pe=>ai(ue,Pe)).map(Pe=>({id:Pe.id,title:Pe.name,start:Pe.startDate,end:Pe.endDate,task:Pe}))});}for(let Te=1;Te<=q;Te++){let ue=new Date(O,Ce,Te),Pe=ue.getTime()===we.getTime();he.push({date:ue,isCurrentMonth:true,isToday:Pe,isWeekend:ue.getDay()===0||ue.getDay()===6,events:J.filter(Ae=>ai(ue,Ae)).map(Ae=>({id:Ae.id,title:Ae.name,start:Ae.startDate,end:Ae.endDate,task:Ae}))});}let ge=42-he.length;for(let Te=1;Te<=ge;Te++){let ue=new Date(O,Ce+1,Te);he.push({date:ue,isCurrentMonth:false,isToday:false,isWeekend:ue.getDay()===0||ue.getDay()===6,events:J.filter(Pe=>ai(ue,Pe)).map(Pe=>({id:Pe.id,title:Pe.name,start:Pe.startDate,end:Pe.endDate,task:Pe}))});}return he},[c,e]),xe=n==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],tt=c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Ze=useCallback((O,Ce)=>{if(!f)return;let Ke={...f,[O]:Ce};y(Ke),a.onTaskUpdate?.(Ke);},[f,a]),st=useCallback(O=>{if(!f)return;let Ce=f.progress||0;O==="completed"?Ce=100:O==="todo"&&(Ce=0);let Ke={...f,status:O,progress:Ce};y(Ke),a.onTaskUpdate?.(Ke),W(false);},[f,a]),Nt=useCallback((O,Ce)=>{if(!f)return;let Ke={...f,startDate:O,endDate:Ce};y(Ke),a.onTaskUpdate?.(Ke);},[f,a]),be=useCallback(()=>{W(false),G(false),w(null);},[]);return o?jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:p,children:jsxs("div",{className:"flex flex-col items-center gap-4",children:[jsx("div",{className:"w-8 h-8 animate-spin rounded-full border-b-2 border-[#3B82F6]"}),jsxs("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:[d.labels.noEvents,"..."]})]})}):s?jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:p,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:C("flex-1 flex items-center justify-center",i?"bg-[#0F1117]":"bg-white",l),style:p,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#3B82F6]/10 flex items-center justify-center",children:jsx(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:C("text-lg font-semibold mb-2",i?"text-white":"text-gray-900"),children:d.labels.noEvents}),jsx("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-600"),children:d.labels.newTask})]})}):jsxs("div",{className:C("flex-1 flex flex-col w-full h-full overflow-auto",i?"bg-[#0F1117]":"bg-white",l),style:p,children:[jsx("div",{className:C("flex-shrink-0 px-6 py-4 border-b",i?"border-white/10":"border-gray-200"),children:jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("h2",{className:C("text-xl font-semibold capitalize",i?"text-white":"text-gray-900"),children:tt}),jsx("button",{onClick:Je,className:C("px-3 py-1.5 text-sm rounded-lg transition-colors",i?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:d.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:Le,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:C("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:Be,className:C("p-2 rounded-lg transition-colors",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:C("w-5 h-5",i?"text-[#9CA3AF]":"text-gray-600")})})]})]})}),jsx("div",{className:"flex-1 p-6 min-h-0",children:jsxs("div",{className:"flex flex-col",children:[jsx("div",{className:"grid grid-cols-7 gap-px mb-2",children:xe.map(O=>jsx("div",{className:C("py-2 text-center text-xs font-medium uppercase",i?"text-[#9CA3AF]":"text-gray-500"),children:O},O))}),jsx("div",{className:C("grid grid-cols-7 auto-rows-min gap-px rounded-lg",i?"bg-[#2D2D2D]":"bg-gray-300"),children:kt.map((O,Ce)=>{let Ke=O.date.getDay()===0||O.date.getDay()===6;return jsxs("div",{className:C("min-h-[120px] p-2 transition-colors flex flex-col relative group",i?Ke?"bg-[#1C1F26]":O.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":Ke?"bg-gray-100":O.isCurrentMonth?"bg-white":"bg-gray-50",O.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ve=N[Ce]||M,St=O.events.slice(0,Ve),q=O.events.length-Ve;return jsxs("div",{className:"space-y-1 flex-1",children:[St.map(J=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{y(J.task),a.onEventClick?.(J);},whileHover:{scale:1.02},className:C("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",J.task.progress===100?i?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":i?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(qd,{task:J.task}),jsx("span",{className:"truncate",children:J.title})]})},J.id)),q>0&&jsxs("button",{onClick:J=>{J.stopPropagation(),h(we=>({...we,[Ce]:Ve+D}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",q," ",n==="es"?"M\xC1S":"MORE"]}),Ve>M&&O.events.length>M&&jsx("button",{onClick:J=>{J.stopPropagation(),h(we=>({...we,[Ce]:M}));},className:C("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",i?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:n==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ve=Ce>=28,St=Ce%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),ke===Ce?Me(null):(Me(Ce),B(""),R(void 0),K(null),me(null),Y(false),pe(false),L(false),Ne(O.date));},className:C("w-5 h-5 rounded flex items-center justify-center transition-all",ke===Ce?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",i?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:C("w-3.5 h-3.5 transition-transform",ke===Ce&&"rotate-45")})}),jsx(AnimatePresence,{children:ke===Ce&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Me(null),B(""),R(void 0),K(null),me(null),Y(false),pe(false),L(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Ve?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ve?-5:5,scale:.95},transition:{duration:.12},className:C("absolute w-[320px] rounded-lg shadow-2xl z-50",Ve?"bottom-full mb-1":"top-full mt-1",St?"right-0":"left-0",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:q=>{q.stopPropagation(),Y(false),pe(false),L(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:Oe,onChange:q=>B(q.target.value),placeholder:n==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:C("w-full bg-transparent text-sm outline-none placeholder:opacity-40",i?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:q=>{if(q.key==="Enter"&&Oe.trim()){let J=t.availableUsers?.find(he=>he.id===P),we=je||O.date;a.onTaskCreate?.({name:Oe.trim(),startDate:we,endDate:we,priority:S,assignees:J?[J]:void 0}),B(""),R(void 0),K(null),me(null),Me(null);}q.key==="Escape"&&(Me(null),B(""),R(void 0),K(null),me(null));}})}),jsxs("div",{className:C("px-2.5 py-2 flex items-center justify-between border-t",i?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),Y(!te),pe(false);},className:C("p-1 rounded transition-colors",S?S==="urgent"||S==="high"?"text-red-400 bg-red-500/20":S==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:te&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{R(q.id),Y(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",S===q.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:C("w-2 h-2 rounded-full",q.color)}),jsx("span",{className:i?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:q=>{q.stopPropagation(),L(!qe),Y(false),pe(false),Ne(je||O.date);},className:C("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",je?"bg-[#7C3AED]/20 text-[#7C3AED]":i?"bg-white/5 text-[#9CA3AF] hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),(je||O.date).toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:qe&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsx("div",{className:C("w-40 py-2 border-r",i?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,J=new Date(q);J.setDate(q.getDate()+1);let we=new Date(q);we.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let he=new Date(q);he.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let Q=new Date(q);Q.setDate(q.getDate()+14);let De=new Date(q);return De.setDate(q.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:q,display:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:we,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:he,display:n==="es"?"lun.":"mon."},{label:n==="es"?"2 semanas":"2 weeks",date:Q,display:Q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:De,display:De.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Te,ue)=>jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{me(Te.date),L(false);},children:[jsx("span",{children:Te.label}),jsx("span",{className:C("text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:Te.display})]},ue))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:C("text-xs font-medium",i?"text-white":"text-gray-900"),children:re.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>Ne(new Date),className:C("px-1.5 py-0.5 rounded text-[10px] transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Ne(new Date(re.getFullYear(),re.getMonth()-1)),className:C("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>Ne(new Date(re.getFullYear(),re.getMonth()+1)),className:C("p-0.5 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:C("w-6 h-6 flex items-center justify-center text-[10px]",i?"text-[#6B7280]":"text-gray-400"),children:q},q))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=re.getFullYear(),J=re.getMonth(),we=new Date(q,J,1).getDay(),he=new Date(q,J+1,0).getDate(),Q=new Date(q,J,0).getDate(),De=new Date,ge=[];for(let ue=we-1;ue>=0;ue--)ge.push({dayNum:Q-ue,isCurrentMonth:false,date:new Date(q,J-1,Q-ue)});for(let ue=1;ue<=he;ue++)ge.push({dayNum:ue,isCurrentMonth:true,date:new Date(q,J,ue)});let Te=42-ge.length;for(let ue=1;ue<=Te;ue++)ge.push({dayNum:ue,isCurrentMonth:false,date:new Date(q,J+1,ue)});return ge.map((ue,Pe)=>{let Ae=ue.date.toDateString()===De.toDateString(),Fe=(je||O.date).toDateString()===ue.date.toDateString();return jsx("button",{className:C("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ue.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),ue.isCurrentMonth&&(i?"text-white":"text-gray-900"),Ae&&"ring-1 ring-[#3B82F6]",Fe&&"bg-[#7C3AED] text-white",!Fe&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{me(ue.date),L(false);},children:ue.dayNum},Pe)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),pe(!ce),Y(false);},className:C("p-1 rounded transition-colors",P?"text-[#7C3AED] bg-[#7C3AED]/20":i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:P?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-medium",style:{backgroundColor:t.availableUsers?.find(q=>q.id===P)?.color||"#7C3AED"},children:t.availableUsers?.find(q=>q.id===P)?.initials||t.availableUsers?.find(q=>q.id===P)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:ce&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxs("button",{onClick:()=>{K(null),pe(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",!P&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:C("w-5 h-5 rounded-full flex items-center justify-center",i?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:i?"text-[#9CA3AF]":"text-gray-500",children:n==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(q=>jsxs("button",{onClick:()=>{K(q.id),pe(false);},className:C("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",P===q.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-medium",style:{backgroundColor:q.color||"#7C3AED"},children:q.initials||q.name?.slice(0,2).toUpperCase()}),jsx("span",{className:i?"text-white":"text-gray-900",children:q.name})]},q.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:C("px-3 py-2 text-xs",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(Oe.trim()){let q=t.availableUsers?.find(we=>we.id===P),J=je||O.date;a.onTaskCreate?.({name:Oe.trim(),startDate:J,endDate:J,priority:S,assignees:q?[q]:void 0}),B(""),R(void 0),K(null),me(null),Me(null);}},disabled:!Oe.trim(),className:C("px-2.5 py-1 rounded text-xs font-medium transition-colors",Oe.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":i?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:n==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:C("text-sm font-medium",O.isToday?"text-[#3B82F6]":O.isCurrentMonth?i?"text-white":"text-gray-900":i?"text-[#6B7280]":"text-gray-400"),children:O.date.getDate()})]})]},Ce)})})]})}),jsx(AnimatePresence,{children:f&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>y(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:C("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:C("px-6 py-3 border-b flex items-center gap-3",i?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:C("w-4 h-4",i?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:C("text-xs px-2 py-0.5 rounded",i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:C("text-xs font-mono",i?"text-[#6B7280]":"text-gray-400"),children:f.id.slice(0,8)}),jsxs("button",{className:C("flex items-center gap-1.5 px-2 py-1 rounded text-xs font-medium transition-colors",i?"bg-purple-500/20 text-purple-400 hover:bg-purple-500/30":"bg-purple-100 text-purple-700 hover:bg-purple-200"),children:[jsx(Sparkles,{className:"w-3 h-3"}),"Ask AI"]})]}),jsx("div",{className:"flex-1"}),jsx("button",{className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(Maximize2,{className:"w-4 h-4"})}),jsx("button",{className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(MoreHorizontal,{className:"w-5 h-5"})}),jsx("button",{onClick:()=>y(null),className:C("p-1.5 rounded transition-colors",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let O=f.progress===100?0:100,Ke={...f,progress:O,status:O===100?"completed":"todo"};y(Ke),a.onTaskUpdate?.(Ke);},className:C("mt-1 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors",f.progress===100?"bg-green-500 border-green-500":i?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:f.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("h2",{className:C("text-xl font-semibold flex-1",f.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:f.name})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{be(),W(!$);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.progress===100||f.status==="completed"?"bg-green-500/20 text-green-400":f.progress&&f.progress>0||f.status==="in-progress"?"bg-blue-500/20 text-blue-400":i?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:f.progress===100||f.status==="completed"?n==="es"?"COMPLETADO":"DONE":f.progress&&f.progress>0||f.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:$&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>W(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-white/10 text-white"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500/20 text-blue-400"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500/20 text-green-400"}].map(O=>jsxs("button",{onClick:()=>st(O.id),className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",(f.status===O.id||O.id==="completed"&&f.progress===100||O.id==="in-progress"&&f.progress&&f.progress>0&&f.progress<100||O.id==="todo"&&(!f.progress||f.progress===0)&&f.status!=="in-progress"&&f.status!=="completed")&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:C("w-2 h-2 rounded-full",O.id==="completed"?"bg-green-500":O.id==="in-progress"?"bg-blue-500":"bg-gray-400")}),jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(User,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),f.assignees&&f.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[f.assignees.slice(0,3).map((O,Ce)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:O.color||"#8B5CF6"},title:O.name,children:O.initials||O.name.slice(0,2).toUpperCase()},Ce)),f.assignees.length>3&&jsxs("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:["+",f.assignees.length-3]})]}):jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Sin asignar":"Unassigned"})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{w(g?null:"start"),k(f.startDate||new Date);},className:C("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[f.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:C("mx-1",i?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),f.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End"),(f.startDate||f.endDate)&&jsx(X,{className:"w-3.5 h-3.5 ml-1 opacity-50 hover:opacity-100",onClick:O=>{O.stopPropagation();}})]}),jsx(AnimatePresence,{children:g&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>w(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:C("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:C("w-44 py-2 border-r",i?"border-white/10":"border-gray-200"),children:[(()=>{let O=new Date,Ce=new Date(O);Ce.setDate(O.getDate()+1);let Ke=new Date(O);Ke.setDate(O.getDate()+((6-O.getDay()+7)%7||7));let Ve=new Date(O);Ve.setDate(O.getDate()+((1-O.getDay()+7)%7||7));let St=new Date(O);St.setDate(O.getDate()+(6-O.getDay()+7)%7+7);let q=new Date(O);q.setDate(O.getDate()+14);let J=new Date(O);return J.setDate(O.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:O,display:O.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:Ke,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:Ve,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:St,display:St.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:q,display:q.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:J,display:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((he,Q)=>jsxs("button",{className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(g==="start"){let De=f.endDate&&he.date>f.endDate?he.date:f.endDate;Nt(he.date,De),w("end");}else {let De=f.startDate&&he.date<f.startDate?he.date:f.startDate;Nt(De,he.date),w(null);}},children:[jsx("span",{children:he.label}),jsx("span",{className:C("text-xs",i?"text-[#6B7280]":"text-gray-400"),children:he.display})]},Q))})(),jsx("div",{className:C("border-t mt-2 pt-2",i?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Nt(void 0,void 0),w(null);},className:C("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",i?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:C("text-xs mb-3 px-2 py-1 rounded",i?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:g==="start"?n==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":n==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>k(new Date),className:C("p-1 rounded text-sm transition-colors",i?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>k(new Date(T.getFullYear(),T.getMonth()-1)),className:C("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-4 h-4"})}),jsx("button",{onClick:()=>k(new Date(T.getFullYear(),T.getMonth()+1)),className:C("p-1 rounded",i?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-4 h-4"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(n==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(O=>jsx("div",{className:C("w-8 h-8 flex items-center justify-center text-xs",i?"text-[#6B7280]":"text-gray-400"),children:O},O))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=T.getFullYear(),Ce=T.getMonth(),Ke=new Date(O,Ce,1).getDay(),Ve=new Date(O,Ce+1,0).getDate(),St=new Date(O,Ce,0).getDate(),q=new Date,J=[];for(let he=Ke-1;he>=0;he--)J.push({day:St-he,isCurrentMonth:false,date:new Date(O,Ce-1,St-he)});for(let he=1;he<=Ve;he++)J.push({day:he,isCurrentMonth:true,date:new Date(O,Ce,he)});let we=42-J.length;for(let he=1;he<=we;he++)J.push({day:he,isCurrentMonth:false,date:new Date(O,Ce+1,he)});return J.map((he,Q)=>{let De=he.date.toDateString()===q.toDateString(),ge=f.startDate?.toDateString()===he.date.toDateString(),Te=f.endDate?.toDateString()===he.date.toDateString(),ue=ge||Te,Pe=f.startDate&&f.endDate&&he.date>=f.startDate&&he.date<=f.endDate;return jsx("button",{className:C("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!he.isCurrentMonth&&(i?"text-[#4B5563]":"text-gray-300"),he.isCurrentMonth&&(i?"text-white":"text-gray-900"),De&&"ring-2 ring-[#3B82F6]",ge&&"bg-[#3B82F6] text-white",Te&&!ge&&"bg-[#7C3AED] text-white",Pe&&!ue&&(i?"bg-[#7C3AED]/20":"bg-purple-100"),!ue&&(i?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{let Ae=new Date(he.date);if(g==="start"){let Fe=f.endDate&&Ae>f.endDate?Ae:f.endDate;Nt(Ae,Fe),w("end");}else {let Fe=f.startDate&&Ae<f.startDate?Ae:f.startDate;Nt(Fe,Ae),w(null);}},children:he.day},Q)})})()})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{be(),G(!F);},className:C("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",f.priority==="high"||f.priority==="urgent"?"bg-red-500/20 text-red-400":f.priority==="medium"?"bg-yellow-500/20 text-yellow-400":f.priority==="low"?"bg-green-500/20 text-green-400":i?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:f.priority?f.priority==="high"||f.priority==="urgent"?n==="es"?"Urgente":"Urgent":f.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:F&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>G(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:C("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",i?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:n==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:n==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:n==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:n==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:n==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(O=>jsxs("button",{onClick:()=>{Ze("priority",O.id),G(false);},className:C("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",i?"hover:bg-white/5":"hover:bg-gray-50",f.priority===O.id&&(i?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:C("w-2 h-2 rounded-full",O.color)}),jsx("span",{className:i?"text-white":"text-gray-900",children:O.label})]},O.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:C("text-sm",i?"text-white":"text-gray-900"),children:f.startDate&&f.endDate?`${Math.ceil((f.endDate.getTime()-f.startDate.getTime())/(1e3*60*60*24))} ${n==="es"?"d\xEDas":"days"}`:n==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:C("w-4 h-4 rounded-full border-2",i?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[Z?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:f.progress||0,onChange:O=>{let Ce=parseInt(O.target.value),Ke=f.status;Ce===100?Ke="completed":Ce>0?Ke="in-progress":Ke="todo";let Ve={...f,progress:Ce,status:Ke};y(Ve),a.onTaskUpdate?.(Ve);},onBlur:()=>ve(false),className:C("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",i?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#3B82F6] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>ve(true),className:C("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",i?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:C("h-full rounded-full transition-all",f.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${f.progress||0}%`}})}),jsxs("span",{className:C("text-sm font-medium min-w-[40px]",i?"text-white":"text-gray-900"),children:[f.progress||0,"%"]})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Vac\xEDo":"Empty"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Link2,{className:C("w-4 h-4",i?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:C("text-sm w-24",i?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsx("span",{className:C("text-sm",i?"text-[#6B7280]":"text-gray-400"),children:f.dependencies&&f.dependencies.length>0?`${f.dependencies.length} ${n==="es"?"dependencias":"dependencies"}`:n==="es"?"Vac\xEDo":"Empty"})]})]}),jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxs("button",{className:C("flex items-center gap-2 text-sm transition-colors",i?"text-[#9CA3AF] hover:text-white":"text-gray-500 hover:text-gray-900"),children:[jsx(FileText,{className:"w-4 h-4"}),n==="es"?"Agregar descripci\xF3n":"Add description"]}),jsxs("button",{className:C("flex items-center gap-2 text-sm mt-2 transition-colors",i?"text-purple-400 hover:text-purple-300":"text-purple-600 hover:text-purple-700"),children:[jsx(Sparkles,{className:"w-4 h-4"}),n==="es"?"Escribe con IA":"Write with AI"]})]}),jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Campos personalizados":"Custom fields"}),jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Crea un campo en esta lista":"Create a field in this list"]})]}),jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Agregar subtarea":"Add subtask"}),f.subtasks&&f.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:f.subtasks.map(O=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:C("w-4 h-4 rounded border flex items-center justify-center cursor-pointer",O.progress===100?"bg-green-500 border-green-500":i?"border-white/20 hover:border-white/40":"border-gray-300 hover:border-gray-400"),children:O.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("span",{className:C("text-sm",O.progress===100?"line-through text-[#6B7280]":i?"text-white":"text-gray-900"),children:O.name})]},O.id))}),jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),n==="es"?"Add Tarea":"Add Task"]})]}),jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("h3",{className:C("text-sm font-semibold",i?"text-white":"text-gray-900"),children:n==="es"?"Listas de control":"Checklists"}),jsx("button",{className:C("p-1 rounded transition-colors",i?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:jsx(Plus,{className:"w-4 h-4"})})]}),jsxs("button",{className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",i?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(ListChecks,{className:"w-4 h-4"}),n==="es"?"Crear lista de control":"Create checklist"]})]}),jsxs("div",{className:C("mt-6 pt-4 border-t",i?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:C("text-sm font-semibold mb-3",i?"text-white":"text-gray-900"),children:n==="es"?"Adjuntos":"Attachments"}),jsxs("div",{className:C("border-2 border-dashed rounded-lg p-6 text-center transition-colors cursor-pointer",i?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx(Upload,{className:C("w-6 h-6 mx-auto mb-2",i?"text-[#6B7280]":"text-gray-400")}),jsxs("p",{className:C("text-sm",i?"text-[#9CA3AF]":"text-gray-500"),children:[n==="es"?"Suelta tus archivos aqu\xED para ":"Drop your files here to ",jsx("span",{className:C("underline",i?"text-white":"text-gray-700"),children:n==="es"?"subir":"upload"})]})]})]})]})]}),jsxs("div",{className:C("w-[280px] border-l flex flex-col",i?"border-white/10 bg-[#141619]":"border-gray-200 bg-gray-50"),children:[jsx("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:n==="es"?"Actividad":"Activity"})}),jsx("div",{className:"flex-1 p-4 overflow-y-auto",children:jsxs("div",{className:C("text-sm text-center py-8",i?"text-[#6B7280]":"text-gray-400"),children:[jsx(MessageSquare,{className:"w-8 h-8 mx-auto mb-2 opacity-50"}),n==="es"?"Sin actividad reciente":"No recent activity"]})}),jsx("div",{className:C("p-3 border-t",i?"border-white/10":"border-gray-200"),children:jsx("div",{className:C("flex items-center gap-2 px-3 py-2 rounded-lg",i?"bg-white/5":"bg-white border border-gray-200"),children:jsx("input",{type:"text",placeholder:n==="es"?"Escribe un comentario...":"Write a comment...",className:C("flex-1 bg-transparent text-sm outline-none",i?"text-white placeholder-[#6B7280]":"text-gray-900 placeholder-gray-400")})})})]})]})]})}),jsx(AnimatePresence,{children:x&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>b(null),className:"fixed inset-0 bg-black/30 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:C("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",i?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:C("px-4 py-3 border-b flex items-center justify-between",i?"border-white/10":"border-gray-200"),children:[jsx("span",{className:C("font-medium",i?"text-white":"text-gray-900"),children:x.date.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>b(null),className:C("p-1 rounded",i?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}),jsx("div",{className:"p-3 max-h-[320px] overflow-y-auto space-y-2",children:x.events.map(O=>jsxs("button",{onClick:()=>{b(null),y(O.task);},className:C("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",i?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(qd,{task:O.task}),jsx("span",{className:C("text-sm truncate flex-1",i?"text-white":"text-gray-900"),children:O.title}),O.task.priority==="high"||O.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},O.id))})]})]})})]})}var ri={bgPrimary:"#0d1117",bgSecondary:"#161b22",bgHover:"#21262d",bgToday:"#1f6feb20",bgWeekend:"#161b2280",bgOtherMonth:"#0d111750",border:"#30363d",borderLight:"#21262d",textPrimary:"#c9d1d9",textSecondary:"#8b949e",textMuted:"#6e7681",textToday:"#58a6ff",accent:"#58a6ff",accentHover:"#79b8ff",accentLight:"#58a6ff20",statusTodo:"#8b949e",statusInProgress:"#f0883e",statusCompleted:"#3fb950",focusRing:"#58a6ff"},oi={bgPrimary:"#ffffff",bgSecondary:"#f6f8fa",bgHover:"#f3f4f6",bgToday:"#dbeafe",bgWeekend:"#f9fafb",bgOtherMonth:"#f3f4f680",border:"#d0d7de",borderLight:"#e5e7eb",textPrimary:"#24292f",textSecondary:"#57606a",textMuted:"#8b949e",textToday:"#0969da",accent:"#0969da",accentHover:"#0550ae",accentLight:"#dbeafe",statusTodo:"#8b949e",statusInProgress:"#bf8700",statusCompleted:"#1a7f37",focusRing:"#0969da"},ni={bgPrimary:"#1a1a2e",bgSecondary:"#16213e",bgHover:"#1f3460",bgToday:"#6366f120",bgWeekend:"#16213e80",bgOtherMonth:"#1a1a2e50",border:"#2a3f5f",borderLight:"#1f3460",textPrimary:"#e4e6eb",textSecondary:"#a8b2c1",textMuted:"#6b7280",textToday:"#818cf8",accent:"#6366f1",accentHover:"#818cf8",accentLight:"#6366f120",statusTodo:"#9ca3af",statusInProgress:"#fbbf24",statusCompleted:"#34d399",focusRing:"#6366f1"},wn={dark:ri,light:oi,neutral:ni};function Zd(e){return wn[e]||wn.dark}function _f({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:l,className:p}){let[m,n]=useState(false),u=useMemo(()=>t.filter(c=>e.cardIds.includes(c.id)),[t,e.cardIds]),d=useMemo(()=>{let c=u.length,v=new Set(u.flatMap(x=>x.assignedUserIds||[])).size,f=u.map(x=>x.priority).filter(Boolean),y=new Set(u.flatMap(x=>x.labels||[])).size;return {totalCards:c,uniqueAssignees:v,priorities:f,labels:y}},[u]),i=()=>{o?.(e.id);};return jsxs("div",{className:C("card-stack",!e.isExpanded&&"card-stack-collapsed",p),onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:i,children:[jsxs("div",{className:"card-stack-header-left",children:[jsx("button",{className:"card-stack-toggle","aria-label":e.isExpanded?"Collapse":"Expand",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:C("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:d.totalCards}),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"]})]}),m&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:c=>{c.stopPropagation(),l?.(e.id);},"aria-label":"Delete stack",children:jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"3 6 5 6 21 6"}),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&&jsxs("div",{className:"card-stack-summary",children:[jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),jsx("circle",{cx:"12",cy:"7",r:"4"})]}),jsxs("span",{children:[d.uniqueAssignees," assignees"]})]}),d.labels>0&&jsxs("div",{className:"card-stack-summary-item",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[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"}),jsx("line",{x1:"7",y1:"7",x2:"7.01",y2:"7"})]}),jsxs("span",{children:[d.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(c=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(c),children:a(c)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(c),children:[jsx("h4",{children:c.title}),c.description&&jsxs("p",{children:[c.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,c.id);},"aria-label":"Remove from stack",children:jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},c.id))})})]})}var ec={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function yo(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 vo(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 tc(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 ac({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:l,className:p}){let m=useMemo(()=>({...ec,...l}),[l]),[n,u]=useState(new Set),d=useRef(null),i=useMemo(()=>{if(!m.groupByDay)return [{date:null,events:e}];let b=new Map;return e.forEach(g=>{let w=g.timestamp.toISOString().split("T")[0],T=b.get(w);T?T.push(g):b.set(w,[g]);}),Array.from(b.entries()).sort((g,w)=>w[0].localeCompare(g[0])).map(([g,w])=>({date:new Date(g),events:w.sort((T,k)=>k.timestamp.getTime()-T.timestamp.getTime())}))},[e,m.groupByDay]),{uniqueUsers:c,uniqueTypes:v}=useMemo(()=>{let b=new Set,g=new Set;return e.forEach(w=>{b.add(w.userId),g.add(w.type);}),{uniqueUsers:Array.from(b),uniqueTypes:Array.from(g)}},[e]),f=b=>{u(g=>{let w=new Set(g);return w.has(b)?w.delete(b):w.add(b),w});},y=b=>{let w=new Date().getTime()-b.getTime(),T=Math.floor(w/6e4),k=Math.floor(w/36e5),N=Math.floor(w/864e5);return T<1?"just now":T<60?`${T}m ago`:k<24?`${k}h ago`:N<7?`${N}d ago`:b.toLocaleDateString()},x=useMemo(()=>{let b=0;return t.types&&t.types.length>0&&b++,t.users&&t.users.length>0&&b++,t.dateRange&&b++,t.searchTerm&&b++,b},[t]);return useEffect(()=>{if(s&&d.current){let b=d.current.querySelector(`[data-event-id="${s}"]`);b&&b.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:C("history-timeline-empty",p),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:C("history-timeline",m.compact&&"compact",p),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,types:g?[g]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),v.map(b=>jsxs("option",{value:b,children:[vo(b)," ",b.replace("_"," ")]},b))]}),c.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:b=>{let g=b.target.value;a({...t,users:g?[g]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),c.map(b=>jsx("option",{value:b,children:b},b))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:b=>a({...t,searchTerm:b.target.value})})]}),x>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",x,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:i.map(b=>jsxs("div",{className:"history-timeline-group",children:[m.groupByDay&&b.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:b.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[b.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:b.events.map((g,w)=>{let T=n.has(g.id),k=s===g.id,N=tc(g.type);return jsxs("div",{"data-event-id":g.id,className:C("history-timeline-event",T&&"expanded",k&&"selected"),onClick:()=>o?.(g),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:N},children:m.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:vo(g.type)})}),w<b.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:N}})]}),jsxs("div",{className:"history-timeline-event-content",children:[jsxs("div",{className:"history-timeline-event-header",children:[jsxs("div",{className:"history-timeline-event-header-left",children:[m.showAvatars&&g.userAvatar&&jsx("img",{src:g.userAvatar,alt:g.userName||g.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:g.userName||g.userId}),jsx("span",{className:"history-timeline-event-action",children:yo(g)})]})]}),jsx("div",{className:"history-timeline-event-time",children:m.useRelativeTime?y(g.timestamp):g.timestamp.toLocaleString()})]}),Object.keys(g.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:h=>{h.stopPropagation(),f(g.id);},children:[T?"\u25BC":"\u25B6"," Show changes"]}),T&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(g.changes).map(([h,M])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[h,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(M.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(M.to)})]})]},h)),g.metadata&&Object.keys(g.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(g.metadata).map(([h,M])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[h,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(M)})]},h))]})]})]})]},g.id)})})]},b.date?.toISOString()||"all"))})]})}function oc({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:l,onGoToEvent:p,onSpeedChange:m,className:n}){let u=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),i=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:C("history-replay-empty",n),children:[jsx("div",{className:"history-replay-empty-icon",children:"\u23F3"}),jsx("p",{className:"history-replay-empty-text",children:"No history to replay"})]}):e?jsxs("div",{className:C("history-replay",n),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&vo(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&yo(d)}),jsxs("div",{className:"history-replay-event-meta",children:[jsxs("span",{className:"history-replay-event-index",children:["Event ",e.currentIndex+1," of ",e.totalEvents]}),jsx("span",{className:"history-replay-event-time",children:d&&d.timestamp.toLocaleString()})]})]})]}),jsxs("div",{className:"history-replay-progress-container",children:[jsx("input",{type:"range",className:"history-replay-progress-slider",min:"0",max:e.totalEvents-1,value:e.currentIndex,onChange:c=>p(parseInt(c.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${i}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((c,v)=>jsx("div",{className:C("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>p(v),title:yo(c)},c.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:o,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:l,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(c=>jsxs("button",{className:C("history-replay-speed-btn",e.speed===c&&"active"),onClick:()=>m(c),children:[c,"x"]},c))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:d&&d.timestamp.toLocaleDateString()})]}),jsxs("div",{className:"history-replay-card-preview-content",children:[jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Title:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.title})]}),e.cardState.description&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Description:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.description})]}),jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Priority:"}),jsx("span",{className:"history-replay-card-preview-value",children:e.cardState.priority||"None"})]}),e.cardState.labels&&e.cardState.labels.length>0&&jsxs("div",{className:"history-replay-card-preview-field",children:[jsx("span",{className:"history-replay-card-preview-label",children:"Labels:"}),jsx("div",{className:"history-replay-card-preview-labels",children:e.cardState.labels.map(c=>jsx("span",{className:"history-replay-card-preview-label-tag",children:c},c))})]})]})]})]}):jsxs("div",{className:C("history-replay-start",n),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function si(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 ii(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 nc(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 sc(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Xf(e,t,a,r,o,s=100){let l=e.map(m=>({...m,x:m.x??a/2+Math.random()*100-50,y:m.y??r/2+Math.random()*100-50,vx:0,vy:0})),p=new Map(l.map(m=>[m.id,m]));for(let m=0;m<s;m++){let n=1-m/s;l.forEach(u=>{let d=a/2,i=r/2;u.vx+=(d-u.x)*o.centerForce*n,u.vy+=(i-u.y)*o.centerForce*n,l.forEach(c=>{if(u.id===c.id)return;let v=u.x-c.x,f=u.y-c.y,y=Math.sqrt(v*v+f*f)||1,x=o.chargeStrength*n/(y*y);u.vx+=v/y*x,u.vy+=f/y*x;});}),t.forEach(u=>{let d=p.get(typeof u.source=="string"?u.source:u.source.id),i=p.get(typeof u.target=="string"?u.target:u.target.id);if(!d||!i)return;let c=i.x-d.x,v=i.y-d.y,f=Math.sqrt(c*c+v*v)||1,y=(f-o.linkDistance)/f*o.forceStrength*n;d.vx+=c*y,d.vy+=v*y,i.vx-=c*y,i.vy-=v*y;}),l.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(o.nodeSize,Math.min(a-o.nodeSize,u.x)),u.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return l}function ic({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:l,onInteraction:p,className:m}){let n=useRef(null),[u,d]=useState([]),[i,c]=useState(null),[v,f]=useState(null),[y,x]=useState(null),[b,g]=useState(1),[w,T]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let F=Xf(e,t,a.width,a.height,a,150);d(F);},[e,t,a]);let k=useCallback((F,G)=>{a.enableDragging&&(G.stopPropagation(),c(F));},[a.enableDragging]),N=useCallback(F=>{if(!i||!n.current)return;let Z=n.current.getBoundingClientRect(),ve=(F.clientX-Z.left-w.x)/b,ke=(F.clientY-Z.top-w.y)/b;d(Me=>Me.map(Oe=>Oe.id===i?{...Oe,x:ve,y:ke,fx:ve,fy:ke}:Oe));},[i,b,w]),h=useCallback(()=>{c(null);},[]),M=useCallback((F,G)=>{G.stopPropagation(),p?.({type:"node-click",node:F,position:{x:G.clientX,y:G.clientY}});},[p]),D=useCallback((F,G)=>{G.stopPropagation(),p?.({type:"edge-click",edge:F,position:{x:G.clientX,y:G.clientY}});},[p]),$=useCallback(F=>{let G=u.find(Z=>Z.id===F);return G?{x:G.x,y:G.y}:{x:0,y:0}},[u]),W=useCallback(F=>{if(F.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return F.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let G=F.card.priority;return G==="URGENT"?"#ef4444":G==="HIGH"?"#f59e0b":G==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return F.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:C("relationships-graph-empty",m),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:C("relationships-graph",m),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:l.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:l.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(F=>Math.min(F+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(b*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>g(F=>Math.max(F-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{g(1),T({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(F=>F.type))).map(F=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:si(F)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[nc(F)," ",ii(F)]})]},F))}),jsxs("svg",{ref:n,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:N,onMouseUp:h,onMouseLeave:h,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${b})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(F=>{let G=$(typeof F.source=="string"?F.source:F.source.id),Z=$(typeof F.target=="string"?F.target:F.target.id),ve=sc(F.type),ke=y===F.id,Me=F.onCriticalPath;return jsxs("g",{className:C("relationships-graph-edge",ke&&"hovered",Me&&"critical"),onMouseEnter:()=>x(F.id),onMouseLeave:()=>x(null),onClick:Oe=>D(F,Oe),children:[jsx("line",{x1:G.x,y1:G.y,x2:Z.x,y2:Z.y,stroke:si(F.type),strokeWidth:Me?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ke?1:.6,markerEnd:ve?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ke&&jsx("text",{x:(G.x+Z.x)/2,y:(G.y+Z.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:ii(F.type)})]},F.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(F=>{let G=v===F.id,Z=F.onCriticalPath;return jsxs("g",{className:C("relationships-graph-node",G&&"hovered",Z&&"critical"),transform:`translate(${F.x}, ${F.y})`,onMouseDown:ve=>k(F.id,ve),onMouseEnter:()=>f(F.id),onMouseLeave:()=>f(null),onClick:ve=>M(F,ve),children:[jsx("circle",{r:Z?a.nodeSize*1.2:a.nodeSize,fill:W(F),stroke:Z?"#fbbf24":"#ffffff",strokeWidth:Z?3:2,opacity:G?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:F.card.title.length>20?F.card.title.substring(0,20)+"...":F.card.title})]},F.id)})})]}),jsx("defs",{children:jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"10",refX:"9",refY:"3",orient:"auto",markerUnits:"strokeWidth",children:jsx("path",{d:"M0,0 L0,6 L9,3 z",fill:"#6b7280"})})})]})]})}function cc({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,l]=useState(""),[p,m]=useState(false),[n,u]=useState(null),[d,i]=useState(null),c=useRef(null),v=p||o;useEffect(()=>{e&&c.current&&c.current.focus();},[e]),useEffect(()=>{let b=g=>{g.key==="Escape"&&!v&&f();};if(e)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,v]);let f=()=>{v||(l(""),u(null),i(null),t());},y=async()=>{if(!(!s.trim()||v)){m(true),u(null),i(null);try{let b=await r(s.trim());i(b);}catch(b){u(b instanceof Error?b.message:"Failed to generate plan");}finally{m(false);}}},x=()=>{d&&(a(d),f());};return e?jsxs(at,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:f}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:f,disabled:v,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:d?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Plan Generated Successfully!"})]}),d.explanation&&jsx("div",{className:"p-4 rounded-lg bg-blue-500/10 border border-blue-500/30",children:jsx("p",{className:"text-sm text-white/90",children:d.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",d.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:d.columns.map((b,g)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:b.title},g))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",d.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[d.cards.slice(0,10).map((b,g)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:b.title}),b.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:b.description})]}),b.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${b.priority==="URGENT"?"bg-red-500/20 text-red-400":b.priority==="HIGH"?"bg-orange-500/20 text-orange-400":b.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:b.priority})]})},g)),d.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",d.cards.length-10," more tasks..."]})]})]})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description"}),jsx("textarea",{ref:c,value:s,onChange:b=>l(b.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:v}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),n&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:n}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((b,g)=>jsx("button",{onClick:()=>l(b),disabled:v,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:b},g))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:v&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:f,disabled:v,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?jsx("button",{onClick:x,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"}):jsx("button",{onClick:y,disabled:!s.trim()||v,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:v?"Generating...":"Generate Plan"})]})]})]})})]}):null}var li={"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 Zf={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Qf={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 eb(e,t,a){let r=li[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function xo(e){return `$${e.toFixed(4)}`}var di=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=eb(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(o=>o(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(d=>d.timestamp>=t.start&&d.timestamp<=t.end));let r=a.length,o=a.reduce((d,i)=>d+i.cost,0),s=a.reduce((d,i)=>d+i.inputTokens,0),l=a.reduce((d,i)=>d+i.outputTokens,0),p=a.filter(d=>d.success),m=a.reduce((d,i)=>d+i.duration,0),n={},u={};return a.forEach(d=>{n[d.feature]=(n[d.feature]||0)+1,u[d.feature]=(u[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:l,operationsByFeature:n,costsByFeature:u,averageDuration:r>0?m/r:0,successRate:r>0?p.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let o={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,l=new Date;a==="month"?l.setMonth(s.getMonth()-1):l.setDate(s.getDate()-1);let p=this.operations.filter(u=>u.timestamp>=l).length,m=Math.max(0,o-p),n=p/o*100;return {used:p,limit:o,remaining:m,percentUsed:n,isExceeded:p>=o}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Cr=new di;function uc({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Cr.getStats()),[s,l]=useState(Cr.checkLimit(a));if(useEffect(()=>{if(!e)return;let m=setInterval(()=>{o(Cr.getStats()),l(Cr.checkLimit(a));},1e3);return ()=>clearInterval(m)},[e,a]),useEffect(()=>{let m=n=>{n.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[e,t]),!e)return null;let p=Cr.getRecentOperations(5);return jsxs(at,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:t}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:m=>m.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[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:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:xo(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-blue-400 mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([m,n])=>{let u=r.costsByFeature[m]||0,d=r.totalOperations>0?n/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:m.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[n," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:xo(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-blue-500",style:{width:`${d}%`}})})]},m)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),p.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:p.map(m=>jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("p",{className:"text-sm font-medium text-white/90 capitalize",children:m.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(m.timestamp).toLocaleTimeString()," \u2022"," ",m.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[m.inputTokens+m.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:xo(m.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${m.success?"bg-green-400":"bg-red-400"}`})]})]},m.id))})]})]}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("p",{className:"text-xs text-white/50",children:"Costs are estimates. Actual API charges may vary."}),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 bc({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[l,p]=useState(""),[m,n]=useState(""),[u,d]=useState(""),[i,c]=useState(false),[v,f]=useState(null),[y,x]=useState(null),[b,g]=useState(null),w=useRef(null),T=i||o;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let D=$=>{$.key==="Escape"&&!T&&k();};if(e)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,T]);let k=()=>{T||(p(""),n(""),d(""),f(null),x(null),g(null),t());},N=async()=>{if(!(!l.trim()||T)){c(true),f(null),x(null),g(null);try{let D=await r({prompt:l.trim(),projectName:s||"Mi Proyecto",startDate:m||void 0,endDate:u||void 0});x(D.tasks.tasks),g({from_cache:D.from_cache,tokens_used:D.tokens_used,mock_mode:D.mock_mode,similarity:D.similarity,tokens_saved:D.tokens_saved});}catch(D){f(D instanceof Error?D.message:"Failed to generate tasks");}finally{c(false);}}},h=()=>{y&&(a(y),k());};if(!e)return null;let M=b?.similarity?((b.similarity||0)*100).toFixed(0):"0";return jsxs(at,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:k}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children: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:D=>D.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[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:[jsx("rect",{x:"3",y:"4",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"9",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"14",width:"18",height:"2",rx:"1",fill:"currentColor"}),jsx("rect",{x:"3",y:"19",width:"18",height:"2",rx:"1",fill:"currentColor"})]}),"Generate Gantt Tasks with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete task timeline"})]}),jsx("button",{onClick:k,disabled:T,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[b?.mock_mode&&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"}),b?.from_cache?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 (",M,"% similar)"]}):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"}),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:[b?.tokens_used||0," tokens"]}),b?.tokens_saved&&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:[b.tokens_saved," tokens saved"]}),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:[y.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((D,$)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10 hover:bg-white/10 transition-colors",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsxs("span",{className:"text-xs text-white/50",children:["#",$+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:D.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),D.start," \u2192 ",D.end]}),jsxs("span",{children:[D.duration," days"]}),D.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",D.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${D.priority==="high"?"bg-red-500/20 text-red-400":D.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:D.priority})]})},D.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:l,onChange:D=>p(D.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:T}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:m,onChange:D=>n(D.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:T})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:D=>d(D.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:T})]})]}),v&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:v}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),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((D,$)=>jsx("button",{onClick:()=>p(D),disabled:T,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:D},$))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:T&&jsxs("div",{className:"flex items-center gap-2 text-blue-400 text-sm",children:[jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),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"})]}),jsx("span",{children:"Generating with AI..."})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("button",{onClick:k,disabled:T,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"}),y?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 Tasks to Gantt"}):jsx("button",{onClick:N,disabled:!l.trim()||T,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:T?"Generating...":"Generate Tasks"})]})]})]})})]})}function Dn({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(y=>{t&&Ao(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(x,b,g)=>{console.warn(`Retry attempt ${b} after ${g}ms: ${x.message}`);}}).then(x=>{x.success||console.error(`Failed to persist board after ${x.attempts} attempts:`,x.error);});},[t]),s=useCallback(async(y,x,b)=>{r(g=>{let w=g.cards.find(D=>D.id===y);if(!w)return g;let T=w.columnId,k={...w,columnId:x,position:b},N=g.cards.map(D=>D.id===y?k:D),h=g.columns.map(D=>{if(D.id===T)return {...D,cardIds:D.cardIds.filter($=>$!==y)};if(D.id===x){let $=N.filter(W=>W.columnId===x).sort((W,F)=>W.position-F.position);return {...D,cardIds:$.map(W=>W.id)}}return D}),M={...g,cards:N,columns:h};return o(M),M});},[o]),l=useCallback(async(y,x)=>{r(b=>{let g=b.cards.map(T=>T.id===y?{...T,...x}:T),w={...b,cards:g};return o(w),w});},[o]),p=useCallback(async y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x},w=b.columns.map(k=>k.id===y.columnId?{...k,cardIds:[...k.cardIds,x]}:k),T={...b,cards:[...b.cards,g],columns:w};return o(T),T});},[o]),m=useCallback(async y=>{r(x=>{let b=x.cards.find(k=>k.id===y);if(!b)return x;let g=x.cards.filter(k=>k.id!==y),w=x.columns.map(k=>k.id===b.columnId?{...k,cardIds:k.cardIds.filter(N=>N!==y)}:k),T={...x,cards:g,columns:w};return o(T),T});},[o]),n=useCallback(async y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(b=>{let g={...y,id:x,cardIds:[]},w={...b,columns:[...b.columns,g]};return o(w),w});},[o]),u=useCallback(async(y,x)=>{r(b=>{let g=b.columns.map(T=>T.id===y?{...T,...x}:T),w={...b,columns:g};return o(w),w});},[o]),d=useCallback(async y=>{r(x=>{let b=x.cards.filter(T=>T.columnId!==y),g=x.columns.filter(T=>T.id!==y),w={...x,cards:b,columns:g};return o(w),w});},[o]),i=useCallback(y=>{let x=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return p(y),x},[p]),c=useCallback(y=>{let x=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return n(y),x},[n]),v=useCallback(()=>{r(y=>{let x={...y,cards:[],columns:[]};return o(x),x});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:l,onCardCreate:p,onCardDelete:m,onColumnCreate:n,onColumnUpdate:u,onColumnDelete:d},setBoard:r,helpers:{addCard:i,addColumn:c,deleteCard:m,deleteColumn:d,clearBoard:v}}}function yc({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Dn({initialBoard:e,onPersist:a}),l=useMemo(()=>({addCard:(m,n,u={})=>{s.addCard({title:n,columnId:m,position:r.cards.filter(d=>d.columnId===m).length,...u});},addColumn:(m,n)=>{let u=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:m,position:n??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:o,availableUsers:t}),[r,o,t]),board:r,callbacks:o,utils:l}}var ko={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},xc={by:"none",order:"asc"};function kc({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...ko,...e}),[s,l]=useState({...xc,...t}),p=useCallback(f=>{o(y=>({...y,...f}));},[]),m=useCallback(f=>{l(y=>({...y,...f}));},[]),n=useCallback(()=>{o(ko),l(xc);},[]),u=useCallback(()=>{a&&o({...ko,assignees:[a]});},[a]),d=useCallback(()=>{o({...ko,dateFilter:"overdue"});},[]),i=useCallback(()=>{o({...ko,priorities:["HIGH","URGENT"]});},[]),c=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),v=useCallback(f=>{let y=[...f];if(r.search){let x=r.search.toLowerCase();y=y.filter(b=>b.title.toLowerCase().includes(x)||b.description?.toLowerCase().includes(x));}if(r.dateFilter!=="all"){let x=new Date,b=x.getFullYear(),g=String(x.getMonth()+1).padStart(2,"0"),w=String(x.getDate()).padStart(2,"0"),T=`${b}-${g}-${w}`;y=y.filter(k=>{if(!k.endDate&&!k.dueDate)return false;let N=k.endDate||k.dueDate;if(!N)return false;let h;if(typeof N=="string")h=N.split("T")[0]||N;else {let M=N.getUTCFullYear(),D=String(N.getUTCMonth()+1).padStart(2,"0"),$=String(N.getUTCDate()).padStart(2,"0");h=`${M}-${D}-${$}`;}switch(r.dateFilter){case "overdue":return h<T;case "today":return h===T;case "this-week":let M=new Date(T+"T00:00:00"),D=new Date(h+"T00:00:00"),$=new Date(M);return $.setDate($.getDate()+7),D>=M&&D<=$;case "custom":if(r.dateRange){let W=typeof N=="string"?new Date(N):N;return W>=r.dateRange.start&&W<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(x=>x.priority&&r.priorities.includes(x.priority))),r.assignees.length>0&&(y=y.filter(x=>(x.assignedUserIds||(x.assigneeId?[x.assigneeId]:[])).some(g=>r.assignees.includes(g)))),r.labels.length>0&&(y=y.filter(x=>x.labels&&x.labels.some(b=>r.labels.includes(b)))),r.columns.length>0&&(y=y.filter(x=>r.columns.includes(x.columnId))),s.by!=="none"&&y.sort((x,b)=>{let g=0;switch(s.by){case "created":let w=x.createdAt?new Date(x.createdAt).getTime():0,T=b.createdAt?new Date(b.createdAt).getTime():0;g=w-T;break;case "priority":let k={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},N=k[x.priority||"LOW"],h=k[b.priority||"LOW"];g=N-h;break;case "dueDate":let M=x.endDate||x.dueDate,D=b.endDate||b.dueDate;if(!M)return 1;if(!D)return -1;let $=typeof M=="string"?new Date(M).getTime():M.getTime(),W=typeof D=="string"?new Date(D).getTime():D.getTime();g=$-W;break;case "title":g=x.title.localeCompare(b.title);break;case "estimate":let F=x.estimatedTime||0,G=b.estimatedTime||0;g=F-G;break;default:g=0;}return s.order==="asc"?g:-g}),y},[r,s]);return {filters:r,sort:s,setFilters:p,setSort:m,resetFilters:n,filterMyTasks:u,filterOverdue:d,filterHighPriority:i,applyFilters:v,hasActiveFilters:c}}var Cc,Tc;if(typeof window<"u")try{let e=Eo("ai");Cc=e.generateObject,Tc=e.generateText;}catch{}function Dc(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(Cc&&Tc&&e.apiKey),l=useCallback(async d=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),o(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(i){let c=i instanceof Error?i:new Error("Failed to generate plan");throw o(c),c}finally{a(false);}},[s]),p=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Suggesting assignee for:",d.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(i){let c=i instanceof Error?i:new Error("Failed to suggest assignee");throw o(c),c}finally{a(false);}},[s]),m=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(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(i){let c=i instanceof Error?i:new Error("Failed to predict risks");throw o(c),c}finally{a(false);}},[s]),n=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(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(i){let c=i instanceof Error?i:new Error("Failed to generate subtasks");throw o(c),c}finally{a(false);}},[s]),u=useCallback(async d=>{if(!s)throw new Error("AI features not available");a(true),o(null);try{return console.log("Estimating effort for:",d.title),{hours:8,confidence:.75}}catch(i){let c=i instanceof Error?i:new Error("Failed to estimate effort");throw o(c),c}finally{a(false);}},[s]);return {onGeneratePlan:l,onSuggestAssignee:p,onPredictRisks:m,onGenerateSubtasks:n,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function pi(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Nc(e){let{cards:t}=e,[a,r]=pi(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,i)=>{if(!i){r({selectedCardIds:[d],lastSelectedCardId:d});return}let c=i.ctrlKey||i.metaKey,v=i.shiftKey;if(c)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(f=>f!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let f=t.find(x=>x.id===d),y=t.find(x=>x.id===a.lastSelectedCardId);if(f&&y&&f.columnId===y.columnId){let x=t.filter(h=>h.columnId===f.columnId).sort((h,M)=>h.position-M.position),b=x.findIndex(h=>h.id===a.lastSelectedCardId),g=x.findIndex(h=>h.id===d),[w,T]=b<g?[b,g]:[g,b],k=x.slice(w,T+1).map(h=>h.id),N=Array.from(new Set([...a.selectedCardIds,...k]));r({selectedCardIds:N,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),l=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(i=>i!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),p=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),m=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),n=useCallback(d=>{a.selectedCardIds.includes(d)?l(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,l,r]),u=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:l,clearSelection:p,selectAll:m,toggleCard:n,getSelectedCards:u}}var Sc={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function Ec(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...Sc,...a}),[a]),[s,l]=useState([]),p=useCallback((f,y,x,b,g)=>{if(y.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:f,cardIds:y,columnId:x,strategy:b,color:g,isExpanded:true,position:s.filter(T=>T.columnId===x).length,createdAt:new Date};l(T=>[...T,w]);},[o.minCardsPerStack,s]),m=useCallback(f=>{l(y=>y.filter(x=>x.id!==f));},[]),n=useCallback(f=>{l(y=>y.map(x=>x.id===f?{...x,isExpanded:!x.isExpanded}:x));},[]),u=useCallback((f,y)=>{l(x=>x.map(b=>b.id===f&&!b.cardIds.includes(y)?{...b,cardIds:[...b.cardIds,y]}:b));},[]),d=useCallback((f,y)=>{l(x=>x.map(b=>{if(b.id===f){let g=b.cardIds.filter(w=>w!==y);return g.length<o.minCardsPerStack?null:{...b,cardIds:g}}return b}).filter(b=>b!==null));},[o.minCardsPerStack]),i=useCallback(f=>s.filter(y=>y.columnId===f).sort((y,x)=>y.position-x.position),[s]),c=useCallback(async f=>{let y=t.filter(T=>T.columnId===f);if(y.length<o.minCardsPerStack*2)return [];let x=[],b=new Map;y.forEach(T=>{T.labels&&T.labels.length>0&&T.labels.forEach(k=>{b.has(k)||b.set(k,[]),b.get(k).push(T);});}),b.forEach((T,k)=>{T.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F4CC} ${k}`,cardIds:T.map(N=>N.id),columnId:f,strategy:"labels",color:"#3b82f6"},reason:`${T.length} cards with label "${k}"`,confidence:.85});});let g=new Map;y.forEach(T=>{T.assignedUserIds&&T.assignedUserIds.length>0&&T.assignedUserIds.forEach(k=>{g.has(k)||g.set(k,[]),g.get(k).push(T);});}),g.forEach((T,k)=>{T.length>=o.minCardsPerStack&&x.push({stack:{title:`\u{1F464} Assigned to user-${k.slice(-4)}`,cardIds:T.map(N=>N.id),columnId:f,strategy:"assignee",color:"#8b5cf6"},reason:`${T.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(y.forEach(T=>{T.priority&&(w.has(T.priority)||w.set(T.priority,[]),w.get(T.priority).push(T));}),w.forEach((T,k)=>{if(T.length>=o.minCardsPerStack){let N={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[k.toLowerCase()]||"\u26AA";x.push({stack:{title:`${N} ${k} Priority`,cardIds:T.map(h=>h.id),columnId:f,strategy:"priority",color:k==="high"||k==="urgent"?"#ef4444":"#10b981"},reason:`${T.length} cards with ${k} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let T of y){let N=(await r.findSimilar(T,y)).filter(h=>h.similarity>=o.autoStackConfidenceThreshold);if(N.length>=o.minCardsPerStack-1){let h=[T.id,...N.map(D=>D.card.id)],M=N.reduce((D,$)=>D+$.similarity,0)/N.length;x.push({stack:{title:`\u2728 Similar to "${T.title.substring(0,30)}${T.title.length>30?"...":""}"`,cardIds:h,columnId:f,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${N.length+1} similar tasks`,confidence:M});}}return x.filter(T=>T.confidence>=o.autoStackConfidenceThreshold).sort((T,k)=>k.confidence-T.confidence).slice(0,5)},[t,o,r]),v=useCallback(f=>{p(f.stack.title,f.stack.cardIds,f.stack.columnId,f.stack.strategy,f.stack.color);},[p]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let x=await c(y),b=x[0];x.length>0&&b&&b.confidence>=.9&&v(b);});},[]),{stacks:s,createStack:p,deleteStack:m,toggleStack:n,addToStack:u,removeFromStack:d,getStacksForColumn:i,getSuggestions:c,applySuggestion:v,config:o}}var Pc=createContext(null);function Mc({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,l=new Map;t?.columns?.forEach(m=>{let{Column:n}=Eo("@libxai/core");s.set(m.id,new n(m));}),t?.cards?.forEach(m=>{let{Card:n}=Eo("@libxai/core");l.set(m.id,new n(m));});let p=null;if(t?.board){let{Board:m}=Eo("@libxai/core");p=new m(t.board);}r.current=new BoardStore({board:p,columns:s,cards:l});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(Pc.Provider,{value:{store:o},children:e})}function Nn(){let e=useContext(Pc);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Co(){let e=Nn(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,l]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),l(e.getAllCards());}),[e]);let p=useCallback(b=>{e.updateBoard(b);},[e]),m=useCallback(b=>{e.addColumn(b);},[e]),n=useCallback((b,g)=>{e.updateColumn(b,g);},[e]),u=useCallback(b=>{e.deleteColumn(b);},[e]),d=useCallback(b=>e.getColumn(b),[e]),i=useCallback(b=>{e.addCard(b);},[e]),c=useCallback((b,g)=>{e.updateCard(b,g);},[e]),v=useCallback(b=>{e.deleteCard(b);},[e]),f=useCallback((b,g,w)=>{e.moveCard(b,g,w);},[e]),y=useCallback(b=>e.getCard(b),[e]),x=useCallback(b=>e.getCardsByColumn(b),[e]);return {board:t,columns:r,cards:s,updateBoard:p,addColumn:m,updateColumn:n,deleteColumn:u,getColumn:d,addCard:i,updateCard:c,deleteCard:v,moveCard:f,getCard:y,getCardsByColumn:x}}function Ic(e){let{cards:t}=Co();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),o=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!o&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(o=>a.isAssignedTo(o))||e.labels&&e.labels.length>0&&!e.labels.some(o=>a.hasLabel(o))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Lc(e="position",t="asc"){let{cards:a}=Co();return useMemo(()=>[...a].sort((o,s)=>{let l=0;switch(e){case "title":l=o.title.localeCompare(s.title);break;case "priority":{let p={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},m=o.priority?p[o.priority]:0,n=s.priority?p[s.priority]:0;l=m-n;break}case "createdAt":l=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":l=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":l=o.position-s.position;break}return t==="asc"?l:-l}),[a,e,t])}var Sn=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ri.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 a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} 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(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(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,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let o=this.config.get(t);o[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let o=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let l=s[t];if(typeof l=="function")try{let p=await Promise.resolve(l.apply(s,a));p!==void 0&&(o=p,a[0]=p);}catch(p){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,p,{plugin:s.id,hook:t});}}return o}async executeHookParallel(t,a){let r=[];for(let o of this.plugins.values()){if(!this.enabled.has(o.id))continue;let s=o[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(o,a)).catch(l=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,l,{plugin:o.id,hook:t});}));}await Promise.all(r);}},hb=new Sn;function Bc({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:l=false,gap:p=0,getItemKey:m}){let n=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>n.current,estimateSize:()=>a,overscan:s,horizontal:l,gap:p}),d=u.getVirtualItems(),i={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},c=l?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:n,style:i,className:o,children:jsx("div",{style:c,children:d.map(v=>{let f=e[v.index];if(!f)return null;let y=m?m(f,v.index):v.index,x={position:"absolute",top:l?0:v.start,left:l?v.start:0,width:l?v.size:"100%",height:l?"100%":v.size};return jsx("div",{style:x,"data-index":v.index,children:r(f,v.index)},y)})})})}function Rc(e){return useVirtualizer({count:e.items.length,getScrollElement:()=>e.scrollElement,estimateSize:()=>e.estimateSize,overscan:e.overscan??5,horizontal:e.horizontal??false,gap:e.gap??0})}function $c({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:l=3,gap:p=16,getItemKey:m,horizontal:n=true}){let u=useRef(null),d=useVirtualizer({horizontal:n,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:l,gap:p}),i=d.getVirtualItems(),c={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},v={width:`${d.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:c,className:s,children:jsx("div",{style:v,children:i.map(f=>{let y=e[f.index];if(!y)return null;let x=m?m(y,f.index):f.index,b={position:"absolute",top:0,left:f.start,width:f.size,height:"100%"};return jsx("div",{style:b,"data-index":f.index,children:o(y,f.index)},x)})})})}function zc(e){let t=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 Uc(e,t=10){return e>t}var fi={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},bi={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},hi={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},yi={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},vi={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},xi={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},ki={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},wi={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)"},Ci={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)"},Ti={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Di={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}},Ni={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}},En={spacing:fi,borderRadius:bi,fontSize:hi,fontWeight:yi,lineHeight:vi,zIndex:xi,duration:ki,easing:wi,shadows:Ci,opacity:Ti,kanban:Di,gantt:Ni};function Wc(e,t,a){return e[t]??a}function Si(e,t="",a={}){for(let[r,o]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof o=="object"&&o!==null&&!Array.isArray(o)?Si(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function xb(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ei(e="asakaa"){let t=Si(En),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,l=xb(o);a.push(` ${s}: ${l};`);}return `:root {
|
|
324
324
|
${a.join(`
|
|
325
325
|
`)}
|
|
326
|
-
}`}function
|
|
326
|
+
}`}function To(e,t="asakaa"){let a=[],r=Si(e);for(let[o,s]of Object.entries(r)){let l=`--${t}-color-${o}`;a.push(` ${l}: ${s};`);}return `:root {
|
|
327
327
|
${a.join(`
|
|
328
328
|
`)}
|
|
329
|
-
}`}var
|
|
329
|
+
}`}var Pn={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#6b7280",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#2a2a2a"}},Pi={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#2563eb"},priority:{low:"#9ca3af",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#6b7280",weekend:"#f9fafb"}},Mi={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#3b82f6"},priority:{low:"#71717a",medium:"#3b82f6",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#3b82f6",taskBorder:"#2563eb",criticalPath:"#ef4444",milestone:"#3b82f6",dependency:"#71717a",weekend:"#27272a"}};function Ai(e=Pn,t="asakaa"){let a=Ei(t),r=To(e,t);return `${a}
|
|
330
330
|
|
|
331
|
-
${r}`}function
|
|
331
|
+
${r}`}function Gc(){return `/**
|
|
332
332
|
* ASAKAA Design Tokens
|
|
333
333
|
* Auto-generated from design-tokens.ts
|
|
334
334
|
* Do not edit this file directly
|
|
335
335
|
*/
|
|
336
336
|
|
|
337
|
-
${
|
|
337
|
+
${Ai(Pn)}
|
|
338
338
|
|
|
339
339
|
/* Light theme */
|
|
340
340
|
[data-theme="light"] {
|
|
341
|
-
${
|
|
341
|
+
${To(Pi,"asakaa").split(`
|
|
342
342
|
`).slice(1,-1).join(`
|
|
343
343
|
`)}
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
/* Neutral theme */
|
|
347
347
|
[data-theme="neutral"] {
|
|
348
|
-
${
|
|
348
|
+
${To(Mi,"asakaa").split(`
|
|
349
349
|
`).slice(1,-1).join(`
|
|
350
350
|
`)}
|
|
351
351
|
}
|
|
352
|
-
`}var
|
|
353
|
-
export{
|
|
352
|
+
`}var kb=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function Hc({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=$r();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([l,p])=>{let m=l,n=m===r;return jsxs("button",{onClick:()=>o(m),className:`theme-switcher__button ${n?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${p.displayName} theme`,"aria-pressed":n,title:p.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(kb,{theme:m})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:p.displayName})]},m)})})}
|
|
353
|
+
export{uc as AIUsageDashboard,Qf as AI_FEATURES,li as AI_MODELS,jn as AddCardButton,Vn as AddColumnButton,oo as AttachmentUploader,Mc as BoardProvider,Ho as BulkOperationsToolbar,os as BurnDownChart,Jd as CalendarBoard,za as Card,Jn as CardDetailModal,ts as CardDetailModalV2,oc as CardHistoryReplay,ac as CardHistoryTimeline,ic as CardRelationshipsGraph,_f as CardStack,ps as CardTemplateSelector,An as CircuitBreaker,Ir as Column,qo as ColumnManager,qn as CommandPalette,fs as ConfigMenu,Wr as ContextMenu,so as DEFAULT_SHORTCUTS,cs as DEFAULT_TEMPLATES,qr as DateRangePicker,Jr as DependenciesSelector,an as DependencyLine,ns as DistributionCharts,zn as EditableColumnTitle,Lr as ErrorBoundary,us as ExportImportModal,gs as FilterBar,Ad as GANTT_AI_SYSTEM_PROMPT,cn as GanttAIAssistant,Md as GanttBoard,Ur as GanttI18nContext,on as GanttMilestone,Yo as GanttToolbar,bc as GenerateGanttTasksDialog,cc as GeneratePlanModal,ls as GroupBySelector,Za as KanbanBoard,Hn as KanbanToolbar,ao as KanbanViewAdapter,ds as KeyboardShortcutsHelp,Hd as ListView,vt as MenuIcons,Sn as PluginManager,cr as PrioritySelector,Zf as RATE_LIMITS,ss as SwimlaneBoardView,Qn as TagBadge,El as TagList,Br as TagPicker,Qo as TaskBar,dn as TaskFormModal,Zo as TaskGrid,vs as ThemeModal,_l as ThemeProvider,Hc as ThemeSwitcher,sn as Timeline,mr as UserAssignmentSelector,rs as VelocityChart,$c as VirtualGrid,Bc as VirtualList,Cr as aiUsageTracker,bi as borderRadius,Mo as calculatePosition,ri as calendarDarkTheme,Xs as calendarEnTranslations,Js as calendarEsTranslations,oi as calendarLightTheme,ni as calendarNeutralTheme,wn as calendarThemes,hn as calendarTranslations,mn as cardToGanttTask,$d as cardsToGanttTasks,C as cn,kl as createKanbanView,np as createRetryWrapper,bs as darkTheme,Pn as darkTokenTheme,Vo as defaultTheme,En as designTokens,ki as duration,wi as easing,Gc as exportTokensToCSS,_a as findTaskByName,hi as fontSize,yi as fontWeight,xo as formatCost,Ko as ganttEnTranslations,jl as ganttEsTranslations,Od as ganttTaskToCardUpdate,$e as ganttThemes,Ni as ganttTokens,xs as ganttTranslations,ne as ganttUtils,Ei as generateCSSVariables,Ai as generateCompleteCSS,tp as generateInitialPositions,Id as generateTasksContext,To as generateThemeVariables,Zd as getCalendarTheme,ho as getCalendarTranslations,_d as getListViewTheme,js as getListViewTranslations,Vd as getMonthNames,Wc as getToken,Kl as getTranslations,jd as getWeekdayNames,Di as kanbanTokens,hs as lightTheme,Pi as lightTokenTheme,vi as lineHeight,Ks as listViewDarkTheme,_s as listViewEnTranslations,Vs as listViewEsTranslations,Ys as listViewLightTheme,qs as listViewNeutralTheme,bn as listViewThemes,un as listViewTranslations,yn as mergeCalendarTranslations,gn as mergeListViewTranslations,ks as mergeTranslations,ys as neutralTheme,Mi as neutralTokenTheme,Ti as opacity,Bd as parseLocalCommand,Ws as parseNaturalDate,Gs as parseNaturalDuration,Hs as parseProgress,Fd as parseStatus,hb as pluginManager,op as retrySyncOperation,Ao as retryWithBackoff,Ci as shadows,Uc as shouldVirtualizeGrid,fi as spacing,br as themes,Dc as useAI,yc as useBoard,Co as useBoardCore,Nn as useBoardStore,Ec as useCardStacking,Wn as useDragState,Ic as useFilteredCards,kc as useFilters,io as useGanttI18n,Dn as useKanbanState,Wl as useKeyboardShortcuts,Nc as useMultiSelect,pi as useSelectionState,Lc as useSortedCards,$r as useTheme,zc as useVirtualGrid,Rc as useVirtualList,Rd as validateAIResponse,Kn as withErrorBoundary,Lo as wouldCreateCircularDependency,xi as zIndex};//# sourceMappingURL=index.js.map
|
|
354
354
|
//# sourceMappingURL=index.js.map
|