@libxai/board 1.4.21 → 1.4.22
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 +18 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/styles.css +5 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,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 Zu from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,FileText,Timer,Clock,Tag,BarChart,CalendarCheck,Users,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Rows3,Filter,FileImage,FileSpreadsheet,FileJson,FolderKanban,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,Search,Loader2}from'lucide-react';import {Command}from'cmdk';import th from'react-markdown';import ah from'remark-gfm';import rh from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';var
|
|
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=Kd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=Kd(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,v)=>{i[f]=l[v]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.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 Kd(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Yd(e,t){switch(t){case "json":return qg(e);case "csv":return Xg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function qd(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 pi=createContext(null);function Xd(){return useContext(pi)}var Jd=createContext(null);function Zd({children:e,themeName:t}){return jsx(Jd.Provider,{value:{themeName:t},children:e})}function Io(){return useContext(Jd)}function kt({children:e,container:t}){let[a,r]=useState(false),o=Xd(),s=Io();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:u}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var rc={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},of="#BDC3C7",nf=({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 mo({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),u=useRef(null),i=()=>{if(!u.current)return;let f=u.current.getBoundingClientRect(),v=window.innerHeight,k=window.innerWidth,g=160,y=220,h=4,b=f.right-g;b<10&&(b=f.left),b+g>k-10&&(b=k-g-10);let x=v-f.bottom,D=f.top,N;x>=y+h?N=f.bottom+h:D>=y+h?N=f.top-y-h:N=x>=D?f.bottom+h:Math.max(10,f.top-y-h),n({top:N,left:b}),o(true);};useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&!u.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),useEffect(()=>{let f=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let c=f=>{t(f),o(false);},d=e?rc[e]:null,p=d?.color||of;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:u,onClick:()=>r?o(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:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(kt,{children:jsxs("div",{ref:l,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(rc).map(([f,v])=>jsxs("button",{onClick:()=>c(f),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:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsx(nf,{color:v.color}),jsx("span",{className:"font-semibold text-sm",children:v.label}),e===f&&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"})})]},f)),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:()=>c(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: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("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 sf=[{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 on({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),u=useRef(null),i=useRef(null),p=(Io()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),x=window.innerHeight,D=window.innerWidth,N=320,C=380,w=4,R=b.left;R+N>D-10&&(R=D-N-10),R<10&&(R=10);let A=x-b.bottom,T=b.top,H;A>=C+w?H=b.bottom+w:T>=C+w?H=b.top-C-w:H=A>=T?b.bottom+w:Math.max(10,b.top-C-w),l({top:H,left:R}),s(true);};useEffect(()=>{let b=x=>{u.current&&!u.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{let b=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let v=b=>{let x=new Date,D=R=>{let A=R.getFullYear(),T=String(R.getMonth()+1).padStart(2,"0"),H=String(R.getDate()).padStart(2,"0");return `${A}-${T}-${H}`},N=D(x),C=new Date(x);C.setDate(C.getDate()+b);let w=D(C);a(N,w),s(false);},k=()=>{if(!e||!t)return "Set date";let b=C=>{if(C instanceof Date)return C;if(typeof C!="string"||!C.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=C.split("-").map(Number);if(w.length!==3||w.some(H=>isNaN(H)))return null;let R=w[0],A=w[1],T=w[2];return R===void 0||A===void 0||T===void 0?null:new Date(R,A-1,T)},x=b(e),D=b(t);if(!x||!D||isNaN(x.getTime())||isNaN(D.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[x.getMonth()]} ${x.getDate()} \u2013 ${N[D.getMonth()]} ${D.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),b<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${k()}`:"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:k()})]}),o&&jsx(kt,{children:jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"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:p?"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:p?"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:sf.map(b=>jsx("button",{onClick:()=>v(b.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:b.label},b.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"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:b=>a(b.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:b=>a(e,b.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"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:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function go({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,u]=useState(""),[i,c]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),f=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),b=window.innerHeight,x=window.innerWidth,D=300,N=380,C=4,w=h.right-D;w<10&&(w=h.left),w+D>x-10&&(w=x-D-10);let R=b-h.bottom,A=h.top,T;R>=N+C?T=h.bottom+C:A>=N+C?T=h.top-N-C:T=R>=A?h.bottom+C:Math.max(10,h.top-N-C),c({top:T,left:w}),n(true);};useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&!p.current?.contains(b.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=b=>{b.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let b=e.some(x=>x.id===h.id);a(b?e.filter(x=>x.id!==h.id):[...e,h]);},k=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),y=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?n(false):f(),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:[g.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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(kt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.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:l,onChange:h=>u(h.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:k.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"}):k.map(h=>{let b=e.some(x=>x.id===h.id);return jsxs("button",{onClick:()=>v(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.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:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.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:h.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:b?"#3b82f6":"transparent"},children:b?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(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 Yn(e,t,a){let r=new Map;e.forEach(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(u),false};return l(a)}function sn({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,u]=useState(false),[i,c]=useState(""),[d,p]=useState(t.length>0),[f,v]=useState({top:0,left:0}),[k,g]=useState(null),y=useRef(null),h=useRef(null),b=()=>{if(!h.current)return;let w=h.current.getBoundingClientRect(),R=window.innerHeight,A=window.innerWidth,T=300,H=d?380:120,L=4,ne=w.right-T;ne<10&&(ne=w.left),ne+T>A-10&&(ne=A-T-10);let S=R-w.bottom,V=w.top,ie;S>=H+L?ie=w.bottom+L:V>=H+L?ie=w.top-H-L:ie=S>=V?w.bottom+L:Math.max(10,w.top-H-L),v({top:ie,left:ne}),u(true);};useEffect(()=>{if(!l||!h.current)return;let w=h.current.getBoundingClientRect(),R=window.innerHeight,A=window.innerWidth,T=300,H=d?380:120,L=4,ne=w.right-T;ne<10&&(ne=w.left),ne+T>A-10&&(ne=A-T-10);let S=R-w.bottom,V=w.top,ie;S>=H+L?ie=w.bottom+L:V>=H+L?ie=w.top-H-L:ie=S>=V?w.bottom+L:Math.max(10,w.top-H-L),v({top:ie,left:ne});},[d,l]),useEffect(()=>{let w=R=>{y.current&&!y.current.contains(R.target)&&!h.current?.contains(R.target)&&(u(false),c(""));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),useEffect(()=>{let w=R=>{R.key==="Escape"&&(u(false),c(""));};if(l)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);let x=w=>{let R=t.includes(w),A=a.find(T=>T.id===w);if(g(null),R){let T=t.filter(H=>H!==w);r(T),T.length===0&&p(false);}else {if(s&&Yn(a,w,e)){let H=`Cannot add "${A?.title||w}" as dependency - would create circular reference`;g(H),n?.(w,A?.title||w),setTimeout(()=>g(null),3e3);return}r([...t,w]),p(true);}},D=()=>{let w=!d;p(w),w||r([]);},N=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),C=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?u(false):b(),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:C,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:C},children:t.length})]}),l&&jsx(kt,{children:jsxs("div",{ref:y,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[k&&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:k})]}),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:D,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:i,onChange:w=>c(w.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:N.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"}):N.map(w=>{let R=t.includes(w.id);return jsxs("button",{onClick:()=>x(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:A=>{A.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:A=>{A.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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&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:w.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),u(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 Ar=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:u=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:p,transition:f,isDragging:v}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:Vn.Transform.toString(p),transition:f};if(t)return jsx("div",{ref:d,style:k,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=l.filter(x=>e.assignedUserIds?.includes(x.id)),y=e.progress===100,h=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),b={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:b,className:m("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:x=>{x.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:x=>{x.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((x,D)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),D===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},x.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.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:x=>x.stopPropagation(),className:"priority-selector",children:jsx(mo,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(on,{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:(x,D)=>n?.(e.id,{startDate:x,endDate:D})})}),l.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(go,{assignedUsers:g,availableUsers:l,onChange:x=>n?.(e.id,{assignedUserIds:x.map(D=>D.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(sn,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:u,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsx("span",{className:"asakaa-label",children:x},x))}),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)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Ar.displayName="Card";var qn={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"}},pc=({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 gc({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),u=useRef(null),i=useRef(null),c=[...Object.entries(qn).map(([g,y])=>({id:g,label:y.label,color:y.color,icon:y.icon})),...r.filter(g=>!Object.keys(qn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=qn[e];if(g)return {...g,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...qn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,b=180,x=280,D=4,N=g.right-b;N<10&&(N=g.left),N+b>h-10&&(N=h-b-10);let C=y-g.bottom,w=g.top,R;C>=x+D?R=g.bottom+D:w>=x+D?R=g.top-x-D:R=C>=w?g.bottom+D:Math.max(10,g.top-x-D),l({top:R,left:N}),s(true);};useEffect(()=>{let g=y=>{u.current&&!u.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),useEffect(()=>{let g=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},v=d(),k=v.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):p(),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:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:v.label,children:jsx(pc,{icon:v.icon,color:k})}),o&&jsx(kt,{children:jsxs("div",{ref:u,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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:c.map(g=>jsxs("button",{onClick:()=>f(g.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:g.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsx(pc,{icon:g.icon,color:g.color}),jsx("span",{className:"font-semibold",children:g.label}),e===g.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"})})]},g.id))})]})})]})}function fc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[l,u]=useState(false),[i,c]=useState(e),[d,p]=useState({top:0,left:0}),f=useRef(null),v=useRef(null),k=useRef(null);useEffect(()=>{if(s&&v.current){let b=v.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[s]),useEffect(()=>{let b=x=>{f.current&&!f.current.contains(x.target)&&!v.current?.contains(x.target)&&(n(false),u(false));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=x=>{x.key==="Escape"&&(n(false),u(false),c(e));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s,e]),useEffect(()=>{l&&k.current&&(k.current.focus(),k.current.select());},[l]);let g=()=>{u(true),c(e);},y=()=>{let b=i.trim();b&&b!==e&&t(b),u(false),n(false),c(e);},h=b=>{b.key==="Enter"?y():b.key==="Escape"&&(u(false),c(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>n(!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(kt,{children:jsx("div",{ref:f,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:l?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:k,type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:h,onBlur:y,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:g,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(),n(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 Oo=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:u,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:p,onToggleCollapse:f,onColumnRename:v,onColumnDelete:k,isDeletable:g=false,className:y})=>{let{setNodeRef:h,isOver:b}=useDroppable({id:e.id,data:{type:"column",column:e}}),x=useRef(null),D=c??Hd(t.length),N=useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:D});if(a)return jsx("div",{ref:h,className:y,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let T=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:T}:T>=80?{state:"warning",percentage:T}:T>=60?{state:"approaching",percentage:T}:{state:"ok",percentage:T}})(),R=w.state==="exceeded",A=()=>"asakaa-column-count";return jsxs("div",{ref:h,className:m("asakaa-column",b&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",y),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:m(A()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.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"})]}),w.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"})]}),w.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"})}),w.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||k)&&jsx(fc,{columnTitle:e.title,onRename:T=>v?.(e.id,T),onDelete:k?()=>k(e.id):void 0,isDeletable:g}),f&&jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsx(SortableContext,{items:t.map(T=>T.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"})}):D?jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(T=>{let H=t[T.index];return H?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsx(Ar,{card:H,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i})},H.id):null})}):t.map(T=>jsx(Ar,{card:T,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i},T.id))})})]})});Oo.displayName="Column";function yi({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let u=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?u():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:u,onKeyDown:i,className:m("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:m("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Sf(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function kc(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let u=l.name.toLowerCase(),i=u.replace(/\s+/g,""),c=u.split(/\s+/);return !!(i===s||u===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Ef(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Pf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Mf=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function wc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:u="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:f,onRemoveFile:v,maxFileSizeMB:k=10}){let g=l==="dark",[y,h]=useState(false),[b,x]=useState([]),[D,N]=useState(0),[C,w]=useState(null),[R,A]=useState(false),T=useRef(null),H=useRef(null),L=useRef(null),ne=useRef(null),S=useCallback((B,X)=>{let me=Sf(B,X);if(w(me),me){let fe=r.filter(Ge=>Ge.name.toLowerCase().includes(me.query)||Ge.email&&Ge.email.toLowerCase().includes(me.query)).slice(0,5);x(fe),h(fe.length>0),N(0);}else h(false),x([]);},[r]),V=B=>{let X=B.target.value;if(t(X),S(X,B.target.selectionStart||0),T.current){T.current.style.height="24px";let me=T.current.scrollHeight,fe=280,Ge=Math.min(me,fe);T.current.style.height=`${Ge}px`,T.current.style.overflowY=me>fe?"auto":"hidden";}},ie=()=>{T.current&&S(e,T.current.selectionStart||0);},Me=useCallback(B=>{if(!C||!T.current)return;let X=e.slice(0,C.start),me=e.slice(C.end),fe=`@${B.name.replace(/\s+/g,"")} `,Ge=X+fe+me;t(Ge),h(false),w(null),setTimeout(()=>{if(T.current){let be=C.start+fe.length;T.current.selectionStart=be,T.current.selectionEnd=be,T.current.focus();}},0);},[C,e,t]),F=B=>{if(y&&b.length>0)switch(B.key){case "ArrowDown":B.preventDefault(),N(X=>X<b.length-1?X+1:0);break;case "ArrowUp":B.preventDefault(),N(X=>X>0?X-1:b.length-1);break;case "Enter":{B.preventDefault();let X=b[D];X&&Me(X);break}case "Tab":{B.preventDefault();let X=b[D];X&&Me(X);break}case "Escape":B.preventDefault(),h(false);break}else B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),a());};useEffect(()=>{let B=X=>{H.current&&!H.current.contains(X.target)&&T.current&&!T.current.contains(X.target)&&h(false),ne.current&&!ne.current.contains(X.target)&&A(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ye=useCallback(B=>{if(!T.current)return;let X=T.current.selectionStart||e.length,me=e.slice(0,X)+B+e.slice(X);t(me),A(false),setTimeout(()=>{if(T.current){let fe=X+B.length;T.current.selectionStart=fe,T.current.selectionEnd=fe,T.current.focus();}},0);},[e,t]),Q=useCallback(B=>{if(!f||!B.target.files)return;let X=Array.from(B.target.files),me=k*1024*1024,fe=X.filter(Ge=>Ge.size>me?(console.warn(`File ${Ge.name} exceeds max size of ${k}MB`),false):true);fe.length>0&&f(fe),B.target.value="";},[f,k]),te=useCallback(B=>B.type.startsWith("image/")?Image:B.type.includes("pdf")||B.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(y&&H.current){let B=H.current.children[D];B&&B.scrollIntoView({block:"nearest"});}},[D,y]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(B=>{let X$1=te(B.file),me=B.file.type.startsWith("image/");return jsxs("div",{className:m("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[me&&B.preview?jsx("img",{src:B.preview,alt:B.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(X$1,{className:m("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:m("text-xs truncate",g?"text-white":"text-gray-900"),children:B.file.name}),jsx("p",{className:m("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Pf(B.file.size)})]}),v&&jsx("button",{onClick:()=>v(B.id),className:m("p-0.5 rounded-full transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},B.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:m("flex-1 relative min-w-0"),children:[jsxs("div",{className:m("flex items-end gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>A(!R),disabled:s||n,className:m("p-1 rounded transition-colors flex-shrink-0",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:R&&jsx(motion.div,{ref:ne,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Mf.map(B=>jsx("button",{type:"button",onClick:()=>ye(B),className:m("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:B},B))})})})]}),d&&f&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>L.current?.click(),disabled:s||n,className:m("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:u==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:L,type:"file",multiple:true,onChange:Q,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:T,value:e,onChange:V,onSelect:ie,onKeyDown:F,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:m("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",g?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:m("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:y&&b.length>0&&jsx(motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:b.map((B,X)=>jsxs("button",{type:"button",onClick:()=>Me(B),className:m("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",X===D?g?"bg-white/10":"bg-gray-100":g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:B.color||"#8B5CF6"},children:Ef(B.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:m("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:B.name}),B.email&&jsx("p",{className:m("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:B.email})]})]},B.id))})})]})]})]})}function Cc({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,u)=>l.type==="mention"?jsx("span",{className:m("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},u):jsx("span",{children:l.value},u))})}var es=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function jr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,u]=useState(false),[i,c]=useState(""),[d,p]=useState(false),[f,v]=useState(es[10]||"#3B82F6"),[k,g]=useState({top:0,left:0}),y=useRef(null),h=useRef(null),b=useRef(null),x=useRef(null),D=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),N=t.some(T=>T.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let T=h.current.getBoundingClientRect();g({top:T.bottom+6,left:T.left});}},[l]),useEffect(()=>{let T=H=>{let L=H.target,ne=y.current?.contains(L),S=b.current?.contains(L);!ne&&!S&&(u(false),c(""),p(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{l&&x.current&&x.current.focus();},[l]);let C=T=>{let H=e.some(L=>L.id===T.id);a(H?e.filter(L=>L.id!==T.id):[...e,T]);},w=async()=>{if(!(!r||!i.trim())){p(true);try{let T=await r(i.trim(),f);T&&(a([...e,T]),c(""),v(es[Math.floor(Math.random()*es.length)]||"#3B82F6"));}finally{p(false);}}},R=(T,H)=>{H.stopPropagation(),a(e.filter(L=>L.id!==T));},A={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:y,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&u(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:A,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(T=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:b,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:k.top,left:k.left,zIndex:99999,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:x,type:"text",value:i,onChange:T=>c(T.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:T=>{T.key==="Enter"&&i.trim()&&!N&&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(T=>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:`${T.color}20`,color:T.color},onClick:H=>R(T.id,H),children:[T.name,jsx(X,{className:"w-3 h-3"})]},T.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(T=>{let H=e.some(L=>L.id===T.id);return jsxs("button",{type:"button",onClick:()=>C(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:L=>{H||(L.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:L=>{H||(L.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsx("span",{className:"flex-1 text-left",children:T.name}),H&&jsx(Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.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"})}),i.trim()&&!N&&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:es.map(T=>jsx("button",{type:"button",onClick:()=>v(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:f===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),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:f,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 "',i.trim(),'"']})]})]})}),document.body)]})}function xi({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 Nc({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(xi,{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 ho=[{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"}];function Dc(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function zf(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Uf({className:e}){return jsxs("svg",{className:m("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function ki({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=zf(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},u=Dc(e.loggedMinutes),i=e.estimateMinutes?Dc(e.estimateMinutes):null,c=a&&i?`${u} / ${i}`:u;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:m("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(Uf,{className:l[t]}),jsx("span",{children:c})]})}function Ec(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function as(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Gf(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Vf({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function _f({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Pc({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function jf({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function wi({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:u,onDiscardTimer:i,onClose:c,className:d}){let[p,f]=useState(""),[v,k]=useState(t.estimateMinutes?as(t.estimateMinutes):""),[g,y]=useState(""),[h,b]=useState(false),[x,D]=useState(false),N=useRef(null);useEffect(()=>{N.current?.focus();},[]);let C=async()=>{let A=Ec(p);if(!(A<=0||!s)){b(true);try{await s({durationMinutes:A,note:g.trim()||void 0,source:"manual"}),f(""),y("");}finally{b(false);}}},w=async()=>{if(!n)return;let A=v.trim()?Ec(v):null;await n(A),D(false);},R=A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),C()),A.key==="Escape"&&c?.();};return jsxs("div",{className:m("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Pc,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Gf(o)})]}),jsx("button",{onClick:u,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(_f,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Pc,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:m("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Vf,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(jf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:N,type:"text",value:p,onChange:A=>f(A.target.value),onKeyDown:R,placeholder:"8 (=8h), 2h 30m",className:m("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:C,disabled:h||!p.trim(),className:m("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:g,onChange:A=>y(A.target.value),onKeyDown:R,placeholder:"Note (optional)",className:m("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:as(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),x?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:v,onChange:A=>k(A.target.value),onKeyDown:A=>{A.key==="Enter"&&w(),A.key==="Escape"&&D(false);},onBlur:w,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>D(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?as(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:m("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:m("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(A=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:A.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:as(A.durationMinutes)})]},A.id))})]})]})}function Xf(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Jf(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function bo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,u]=useState(Jf(r)),[i,c]=useState(""),[d,p]=useState(false),f=useRef(null);useEffect(()=>{f.current?.focus();},[]);let v=async()=>{p(true);let b=Xf(l);await o(b&&b>0?b:null,i||void 0),p(false);},k=async()=>{p(true),await o(null),p(false);},g=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),v()),b.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"8 (=8h)",quoted:"8 (=8h)",log:"8 (=8h)"};return jsxs("div",{className:m("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:m("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsx("button",{type:"button",onClick:s,className:m("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"mb-3",children:[jsx("input",{ref:f,type:"text",value:l,onChange:b=>u(b.target.value),onKeyDown:g,placeholder:h[e],className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsx("p",{className:m("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 8 (=8h), 1h 30m, 45m, 2:30":"e.g. 8 (=8h), 1h 30m, 45m, 2:30"})]}),e==="log"&&jsx("div",{className:"mb-3",children:jsx("input",{type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:g,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsx("button",{type:"button",onClick:v,disabled:d||!l.trim(),className:m("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:k,disabled:d,className:m("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function Zf(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Qf(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Ni({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Zf(e.health),s=Qf(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,u=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:m("flex items-center gap-2",r),children:[jsx("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:m("h-full w-1/4",o)})}),t&&jsx("span",{className:m("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxs("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:m("h-full transition-all duration-300",o),style:{width:`${u}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:m("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function $o(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function t0(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function a0(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function r0(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function o0({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",u=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:m("text-2xl font-bold",o),children:[r?"+":"",$o(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:m("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:m("font-medium",u),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:m("font-medium",u),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:m("font-medium",u),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:m("font-medium",u),children:$o(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:m("font-medium",u),children:$o(e.totalLoggedMinutes)})]}),jsxs("div",{className:m("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:m("font-medium",u),children:e.totalTasksWithEstimate})]})]})]})]})}function n0({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:m("border-b",s,r&&m("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:m("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:m("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?$o(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:$o(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:m("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,$o(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:m("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:m("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",a0(e.status,a),t0(e.status,a)),children:r0(e.status,t)})})]})}function Di({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",u=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",c=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",f=useMemo(()=>e?[...e.tasks].sort((v,k)=>v.varianceMinutes===null?1:k.varianceMinutes===null?-1:k.varianceMinutes-v.varianceMinutes):[],[e]);return t?jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:m("space-y-6 p-6",l,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:m("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:m("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(o0,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:m("rounded-lg border overflow-hidden",u,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:m("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:m("divide-y",i),children:f.map(v=>jsx(n0,{task:v,locale:a,isDark:n,onClick:s},v.taskId))})]})})}),jsx("div",{className:m("text-xs text-center",d),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function zo(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function v0(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function zc(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function x0(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function Ir({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:u=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:f=[],comments:v=[],onAddComment:k,currentUser:g,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:b=false,timeTrackingSummary:x,timeEntries:D=[],isTimerRunning:N=false,timerElapsedSeconds:C=0,onTimeLog:w,onEstimateUpdate:R,onSoldEffortUpdate:A,onTimerStart:T,onTimerStop:H,onTimerDiscard:L,blurFinancials:ne=false}){let S=s==="dark",V={textTertiary:S?"#6B7280":"#9CA3AF",textSecondary:S?"#9CA3AF":"#6B7280",textPrimary:S?"#FFFFFF":"#111827",borderLight:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:S?"#1A1D25":"#FFFFFF",bgSecondary:S?"#0F1117":"#F9FAFB",hoverBg:S?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ie=e&&"title"in e&&!("name"in e),Me=e,[F,ye]=useState(e?zc(e,l):null),[Q,te]=useState(false),[B,X$1]=useState(false),[me,fe]=useState(false),[Ge,be]=useState(null),[Ve,re]=useState(new Date),[_,q]=useState(false),[ge,De]=useState(false),[qe,Se]=useState(""),[ot,We]=useState(false),[Qe,ae]=useState(false),[I,j]=useState(false),[le,Te]=useState(false),[_e,rt]=useState(""),ct=useRef(null),je=useRef(null),[sa,W]=useState(""),K=useRef(null),[ke,at]=useState(""),[Ne,Ie]=useState(false),[Y,Ke]=useState([]),[$,de]=useState(""),[Be,Ze]=useState(false),et=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=zc(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),ye(P),rt(P.description||""),W(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!_e)return;let P=setTimeout(()=>{let J=je.current;J&&(J.style.height="auto",J.style.height=`${Math.max(100,J.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,_e]),useEffect(()=>()=>{ct.current&&clearTimeout(ct.current),K.current&&clearTimeout(K.current);},[]),useEffect(()=>{t&&et.current&&v.length>0&&setTimeout(()=>{et.current&&(et.current.scrollTop=et.current.scrollHeight);},100);},[t,v.length]);let Ue=useCallback(P=>{ye(P),ie&&o&&Me?o(x0(P,Me)):r&&r(P);},[ie,Me,o,r]),ve=useCallback(()=>{te(false),X$1(false),fe(false),be(null),De(false),Se(""),We(false);},[]),$e=useCallback((P,J)=>{if(!F)return;let He={...F,[P]:J};Ue(He);},[F,Ue]),U=useCallback(()=>{let P=je.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),ce=useCallback(P=>{rt(P),setTimeout(U,0),ct.current&&clearTimeout(ct.current),ct.current=setTimeout(()=>{if(F){let J={...F,description:P};Ue(J);}},800);},[F,Ue,U]),yt=useCallback(P=>{W(P),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{if(F&&P.trim()){let J={...F,name:P.trim()};Ue(J);}},800);},[F,Ue]),z=useCallback(P=>{let J=P.map(He=>{let ze={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:He};return He.type.startsWith("image/")&&(ze.preview=URL.createObjectURL(He)),ze});Ke(He=>[...He,...J]);},[]),ee=useCallback(P=>{Ke(J=>{let He=J.find(ze=>ze.id===P);return He?.preview&&URL.revokeObjectURL(He.preview),J.filter(ze=>ze.id!==P)});},[]),Fe=useCallback(async()=>{if(!(!F||!ke.trim()&&Y.length===0||!k)){Ie(true);try{let P=kc(ke,y),J=[];if(Y.length>0&&h){let He=Y.map(ze=>ze.file);J=await h(He);}await k(F.id,ke.trim(),P.length>0?P:void 0,J.length>0?J:void 0),at(""),Y.forEach(He=>{He.preview&&URL.revokeObjectURL(He.preview);}),Ke([]);}finally{Ie(false);}}},[F,ke,Y,k,y,h]),dt=useCallback(()=>{if(!F||!$.trim())return;let P=F.subtasks||[],J={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:$.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},He=[...P,J],ze={...F,subtasks:He};Ue(ze),de(""),Ze(false);},[F,$,Ue]),Xe=useCallback(P=>{if(!F?.subtasks)return;let J=F.subtasks.map(ze=>ze.id===P?{...ze,progress:ze.progress===100?0:100}:ze),He={...F,subtasks:J};Ue(He);},[F,Ue]),Yt=useCallback(P=>{if(!F?.subtasks)return;let J=F.subtasks.filter(ze=>ze.id!==P),He={...F,subtasks:J};Ue(He);},[F,Ue]),gt=useCallback(P=>{let J=typeof P=="string"?new Date(P):P,ze=new Date().getTime()-J.getTime(),qt=Math.floor(ze/6e4),Pa=Math.floor(ze/36e5),ia=Math.floor(ze/864e5);return qt<1?n==="es"?"Ahora":"Just now":qt<60?n==="es"?`Hace ${qt} min`:`${qt}m ago`:Pa<24?n==="es"?`Hace ${Pa}h`:`${Pa}h ago`:ia<7?n==="es"?`Hace ${ia}d`:`${ia}d ago`:J.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Fa=useCallback(P=>{if(!F)return;let J=F.progress||0;P==="completed"?J=100:P==="in-progress"&&J===0?J=10:P==="todo"&&(J=0);let He={...F,status:P,progress:J};Ue(He),te(false);},[F,Ue]),Vt=useCallback((P,J)=>{if(!F)return;let He={...F,startDate:P,endDate:J};Ue(He);},[F,Ue]),Ea=useCallback(()=>{let P=Ve.getFullYear(),J=Ve.getMonth(),He=new Date(P,J,1),qt=new Date(P,J+1,0).getDate(),Pa=He.getDay(),ia=[],Ra=new Date(P,J,0).getDate();for(let Oa=Pa-1;Oa>=0;Oa--)ia.push({date:new Date(P,J-1,Ra-Oa),isCurrentMonth:false});for(let Oa=1;Oa<=qt;Oa++)ia.push({date:new Date(P,J,Oa),isCurrentMonth:true});let Aa=42-ia.length;for(let Oa=1;Oa<=Aa;Oa++)ia.push({date:new Date(P,J+1,Oa),isCurrentMonth:false});return ia},[Ve]),Hr=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),j(false),!F||!d)return;let J=Array.from(P.dataTransfer.files);if(J.length!==0){Te(true);try{await d(F.id,J);}finally{Te(false);}}},[F,d]),Pe=useCallback(async P=>{if(!F||!d||!P.target.files)return;let J=Array.from(P.target.files);if(J.length!==0){Te(true);try{await d(F.id,J);}finally{Te(false);}P.target.value="";}},[F,d]),Rt=useCallback(P=>{P.preventDefault(),P.stopPropagation(),j(true);},[]),Ot=useCallback(P=>{P.preventDefault(),P.stopPropagation(),j(false);},[]),Fr=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Ba=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!F?null:jsx(AnimatePresence,{children:t&&F&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,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:m("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",S?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:m("px-6 py-3 border-b flex items-center gap-3 h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:m("text-xs px-2 py-0.5 rounded",S?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:m("text-xs font-mono",S?"text-[#6B7280]":"text-gray-400"),children:F.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let P=F.progress===100?0:100,He={...F,progress:P,status:P===100?"completed":"todo"};Ue(He);},className:m("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",F.progress===100?"bg-green-500 border-green-500":S?"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("input",{type:"text",value:sa,onChange:P=>yt(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:m("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",F.progress===100?"line-through text-[#6B7280]":S?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),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:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{ve(),te(!Q);},className:m("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":S?"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:Q&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxs("button",{onClick:()=>Fa(P.id),className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",F.status===P.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:S?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{ve(),fe(!me);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[F.assignees&&F.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[F.assignees.slice(0,3).map((P,J)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},J)),F.assignees.length>3&&jsxs("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:["+",F.assignees.length-3]})]}):jsx("span",{className:m("text-sm",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:m("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:me&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let J=F.assignees?.some(He=>He.name===P.name);return jsxs("button",{onClick:()=>{let He=F.assignees||[],ze;J?ze=He.filter(qt=>qt.name!==P.name):ze=[...He,P],$e("assignees",ze);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",J&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsx("span",{className:m("flex-1",S?"text-white":"text-gray-900"),children:P.name}),J&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:m("px-3 py-4 text-sm text-center",S?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{be(Ge?null:"start"),re(F.startDate||new Date);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"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:m("mx-1",S?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),F.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Ge&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>be(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:m("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:m("w-44 py-2 border-r",S?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,J=new Date(P);J.setDate(P.getDate()+1);let He=new Date(P);He.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let ze=new Date(P);ze.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let qt=new Date(P);qt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let Pa=new Date(P);Pa.setDate(P.getDate()+14);let ia=new Date(P);return ia.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.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:He,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:ze,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:qt,display:qt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Pa,display:Pa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ia,display:ia.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Aa,Oa)=>jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Ge==="start"){let wr=F.endDate&&Aa.date>F.endDate?Aa.date:F.endDate;Vt(Aa.date,wr),be("end");}else {let wr=F.startDate&&Aa.date<F.startDate?Aa.date:F.startDate;Vt(wr,Aa.date),be(null);}},children:[jsx("span",{children:Aa.label}),jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Aa.display})]},Oa))})(),jsx("div",{className:m("border-t mt-2 pt-2",S?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Vt(void 0,void 0),be(null);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"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:m("text-xs mb-3 px-2 py-1 rounded",S?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Ge==="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:m("font-medium",S?"text-white":"text-gray-900"),children:Ve.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>re(new Date),className:m("p-1 rounded text-sm transition-colors",S?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>re(new Date(Ve.getFullYear(),Ve.getMonth()-1)),className:m("p-1 rounded",S?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>re(new Date(Ve.getFullYear(),Ve.getMonth()+1)),className:m("p-1 rounded",S?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),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(P=>jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",S?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ea().map((P,J)=>{let He=P.date.toDateString()===new Date().toDateString(),ze=F.startDate?.toDateString()===P.date.toDateString(),qt=F.endDate?.toDateString()===P.date.toDateString(),Pa=ze||qt,ia=F.startDate&&F.endDate&&P.date>=F.startDate&&P.date<=F.endDate;return jsx("button",{onClick:()=>{let Ra=new Date(P.date);if(Ge==="start"){let Aa=F.endDate&&Ra>F.endDate?Ra:F.endDate;Vt(Ra,Aa),be("end");}else {let Aa=F.startDate&&Ra<F.startDate?Ra:F.startDate;Vt(Aa,Ra),be(null);}},className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(S?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(S?"text-white":"text-gray-900"),He&&"ring-2 ring-[#3B82F6]",ze&&"bg-[#3B82F6] text-white",qt&&!ze&&"bg-[#7C3AED] text-white",ia&&!Pa&&(S?"bg-[#7C3AED]/20":"bg-purple-100"),!Pa&&(S?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},J)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{ve(),X$1(!B);},className:m("text-xs px-2 py-1 rounded font-medium 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":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:F.priority?F.priority==="high"||F.priority==="urgent"?n==="es"?"Alta":"High":F.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:B&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>X$1(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",S?"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(P=>jsxs("button",{onClick:()=>{$e("priority",P.id),X$1(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",F.priority===P.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:S?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:m("text-sm",S?"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:m("w-4 h-4 rounded-full border-2",S?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[_?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:F.progress||0,onChange:P=>{let J=parseInt(P.target.value),He=F.status;J===100?He="completed":J>0?He="in-progress":He="todo";let ze={...F,progress:J,status:He};Ue(ze);},onBlur:()=>q(false),className:m("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",S?"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:()=>q(true),className:m("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",S?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:m("h-full rounded-full transition-all",F.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${F.progress||0}%`}})}),jsxs("span",{className:m("text-sm font-medium min-w-[40px]",S?"text-white":"text-gray-900"),children:[F.progress||0,"%"]})]})]}),b&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:F.status==="completed"||F.progress===100?jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?zo(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsx("button",{type:"button",onClick:()=>ae("estimate"),className:m("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:zo(x.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>ae("estimate"),className:m("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Qe==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(bo,{mode:"estimate",locale:n,isDark:S,currentValue:x?.estimateMinutes||null,onSave:async P=>{await R?.(F.id,P),ae(false);},onClose:()=>ae(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:ne?jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",S?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):F.status==="completed"||F.progress===100?jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:F.quotedMinutes?zo(F.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):F.quotedMinutes?jsx("button",{type:"button",onClick:()=>ae("quoted"),className:m("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:zo(F.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>ae("quoted"),className:m("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Qe==="quoted"&&!ne&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(bo,{mode:"quoted",locale:n,isDark:S,currentValue:F.quotedMinutes||null,onSave:async P=>{A?(await A(F.id,P),ye(J=>J?{...J,quotedMinutes:P}:null)):$e("quotedMinutes",P),ae(false);},onClose:()=>ae(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[F.status==="completed"||F.progress===100?jsx("div",{className:m("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",S?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):N?jsxs("button",{type:"button",onClick:()=>H?.(F.id),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),v0(C||0)]}):jsx("button",{type:"button",onClick:()=>T?.(F.id),className:m("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",S?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),F.status==="completed"||F.progress===100?jsxs("div",{className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>ae("log"),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",S?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),x&&x.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:m("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":S?"text-white":"text-gray-900"),children:[zo(x.loggedMinutes),x.estimateMinutes&&jsxs("span",{className:m("font-normal",S?"text-[#6B7280]":"text-gray-400"),children:[" / ",zo(x.estimateMinutes)]})]}),x.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:m("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:Qe==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(bo,{mode:"log",locale:n,isDark:S,currentValue:null,onSave:async(P,J)=>{P&&await w?.(F.id,{durationMinutes:P,note:J,source:"manual"}),ae(false);},onClose:()=>ae(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(jr,{selectedTags:F.tags||[],availableTags:u,onChange:P=>{$e("tags",P);},onCreateTag:i,theme:V})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:m("w-4 h-4 mt-1.5",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0 mt-1",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[F.dependencies&&F.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:F.dependencies.map(P=>{let J=f.find(He=>He.id===P);return jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",S?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[J?.name||P.slice(0,8),jsx("button",{onClick:()=>{let He=(F.dependencies||[]).filter(ze=>ze!==P);$e("dependencies",He);},className:m("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{ve(),De(!ge);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:ge&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{De(false),Se("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:m("p-2 border-b",S?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:qe,onChange:P=>Se(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:m("w-full px-3 py-2 rounded-md text-sm outline-none",S?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:f.length>0?f.filter(P=>P.id!==F.id).filter(P=>qe===""||P.name.toLowerCase().includes(qe.toLowerCase())).map(P=>{let J=F.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let He=F.dependencies||[],ze;J?ze=He.filter(qt=>qt!==P.id):ze=[...He,P.id],$e("dependencies",ze);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",J&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",J?"bg-blue-500 border-blue-500":S?"border-white/30":"border-gray-300"),children:J&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:m("block truncate",S?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:m("px-3 py-4 text-sm text-center",S?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{ve(),We(!ot);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:F.color||"#6366F1"}}),jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:ho.find(P=>P.value===F.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:m("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ot&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>We(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:ho.map(P=>{let J=F.color===P.value;return jsx("button",{onClick:()=>{$e("color",P.value),We(false);},className:m("w-7 h-7 rounded-full flex items-center justify-center transition-all",J&&"ring-2 ring-offset-2",S?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:J?P.value:void 0},title:P.name,children:J&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:F.isMilestone||false,onChange:P=>$e("isMilestone",P.target.checked),className:m("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",F.isMilestone?"bg-purple-500 border-purple-500":S?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:je,value:_e,onChange:P=>ce(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:m("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",S?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",F.subtasks&&F.subtasks.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",F.subtasks.filter(P=>P.progress===100).length,"/",F.subtasks.length,")"]})]})}),F.subtasks&&F.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...F.subtasks].sort((P,J)=>(P.position??0)-(J.position??0)).map(P=>jsxs("div",{className:m("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",S?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Xe(P.id),className:m("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":S?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:m("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":S?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>Yt(P.id),className:m("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",S?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},P.id))}),Be?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:$,onChange:P=>de(P.target.value),onKeyDown:P=>{P.key==="Enter"&&$.trim()?dt():P.key==="Escape"&&(Ze(false),de(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:m("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",S?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:dt,disabled:!$.trim(),className:m("px-3 py-2 rounded-lg text-sm font-medium transition-colors",$.trim()?"bg-blue-500 hover:bg-blue-600 text-white":S?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{Ze(false),de("");},className:m("p-2 rounded-lg transition-colors",S?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Ze(true),className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",S?"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"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:m("text-sm font-semibold mb-3",S?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let J=Ba(P.type),He=P.type.startsWith("image/");return jsxs("div",{className:m("flex items-center gap-3 p-2 rounded-lg group transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[He&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:m("w-10 h-10 rounded flex items-center justify-center",S?"bg-white/10":"bg-gray-200"),children:jsx(J,{className:m("w-5 h-5",S?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:m("text-sm font-medium truncate block hover:underline",S?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Fr(P.size)})]}),p&&jsx("button",{onClick:()=>p(P.id),className:m("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",S?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxs("div",{onDragOver:Rt,onDragLeave:Ot,onDrop:Hr,className:m("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",I?S?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":S?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",le&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Pe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||le}),le?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:m("w-6 h-6 mx-auto mb-2",I?"text-blue-500":S?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:I?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:m("text-xs mt-1",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:m("w-96 border-l flex flex-col",S?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",v.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",v.length,")"]})]}),jsx("button",{onClick:a,className:m("p-1.5 rounded transition-colors",S?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
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,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,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 Zu from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,CheckSquare,ChevronDown,Calendar,Hash,Type,FileText,Timer,Clock,Tag,BarChart,CalendarCheck,Users,Flag,CircleDot,Moon,Sun,Palette,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Rows3,Filter,FileImage,FileSpreadsheet,FileJson,FolderKanban,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,AlertCircle,Milestone,List,Search,Loader2}from'lucide-react';import {Command}from'cmdk';import th from'react-markdown';import ah from'remark-gfm';import rh from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';var Vn=(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 _n=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 [_n.Translate.toString(e),_n.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function m(...e){return twMerge(clsx(e))}function jn(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 Ug(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function mi(e,t){return e.length===0?1e3:t===0?jn(null,e[0].position):t>=e.length?jn(e[e.length-1].position,null):jn(e[t-1].position,e[t].position)}function Wd(e,t=100){return e>t}var Hg=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 Wg(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 Kn(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:o=2,maxDelay:s=1e4,shouldRetry:n=Hg,onRetry:l}=t,u,i=0;for(let c=1;c<=a;c++){i=c;try{return {data:await e(),attempts:i,success:!0}}catch(d){if(u=d,c===a||!n(u,c))return {error:u,attempts:i,success:false};let f=Wg(c,r,o,s);if(l)try{l(u,c,f);}catch(v){console.error("Error in retry callback:",v);}await new Promise(v=>setTimeout(v,f));}}return {error:u||new Error("Unknown error"),attempts:i,success:false}}function Gg(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 Vg(e,t={}){return async(...a)=>Kn(()=>e(...a),t)}var pi=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 Gd=(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))(Gd||{}),mo=class mo{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:o,component:s,...n}=t,l=`[${a}] [${r}] [${s}]`,u=Object.keys(n).length>0;switch(r){case "DEBUG":console.debug(l,o,u?n:"");break;case "INFO":console.info(l,o,u?n:"");break;case "WARN":console.warn(l,o,u?n:"");break;case "ERROR":console.error(l,o,u?n:""),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",...mo.globalOptions};}static configure(t){mo.globalOptions={...mo.globalOptions,...t};}child(t){return new mo({...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 qn((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new qn(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let o={timestamp:new Date().toISOString(),level:Gd[t],message:a,component:this.options.componentName,...r};this.options.onLog(o);}};mo.globalOptions={};var gi=mo,qn=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}},Vd=new gi;function jg(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 Kg(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 n=e.columns.find(l=>l.id===s.columnId);return [s.id,fi(s.title),fi(s.description||""),fi(n?.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 qg(e,t,a){let r=t;if(!r){let n=document.querySelector(".asakaa-board");n&&(r=n.parentElement||n);}if(r)try{let n=await Zu(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=n.toDataURL("image/png"),u=297,i=210,c=n.width/n.height,d=u-20,p=d/c;p>i-20&&(p=i-20,d=p*c);let f=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});f.setFontSize(16),f.setTextColor(255,255,255),f.setFillColor(10,10,10),f.rect(0,0,u,15,"F"),f.text(e.title||"Kanban Board",10,10);let v=(u-d)/2;return f.addImage(l,"PNG",v,20,d,p),f}catch(n){console.error("Error capturing board:",n);}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(n=>{let l=e.cards.filter(u=>u.columnId===n.id);s>250&&(o.addPage(),s=20),o.setFontSize(16),o.setFont("helvetica","bold"),o.text(n.title,20,s),s+=8,l.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):l.forEach(u=>{if(s>260&&(o.addPage(),s=20),o.setFontSize(12),o.setFont("helvetica","bold"),o.text(u.title,25,s),s+=6,u.description){o.setFontSize(9),o.setFont("helvetica","normal");let c=o.splitTextToSize(u.description,160);o.text(c,25,s),s+=c.length*5;}let i=[];if(u.priority&&i.push(`Priority: ${u.priority}`),u.labels&&u.labels.length>0&&i.push(`Labels: ${u.labels.join(", ")}`),u.assignedUserIds&&u.assignedUserIds.length>0&&i.push(`Assigned: ${u.assignedUserIds.length} user(s)`),u.startDate||u.endDate){let c=[];u.startDate&&c.push(`Start: ${u.startDate}`),u.endDate&&c.push(`End: ${u.endDate}`),i.push(c.join(" \u2192 "));}i.length>0&&(o.setFontSize(8),o.setTextColor(100,100,100),o.text(i.join(" \u2022 "),25,s),o.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),o}function fi(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function jd(e,t,a,r){switch(t){case "json":return jg(e,r);case "csv":return Kg(e);case "pdf":return await qg(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Kd(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let c=`${r}.pdf`;e.save(c);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]}`,n={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:n[t]}),u=URL.createObjectURL(l),i=document.createElement("a");i.href=u,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(u);}function Yg(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 Xg(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=qd(t[0]),r=[],o=new Map,s=[];for(let n=1;n<t.length;n++)try{let l=qd(t[n]||"");if(l.length>a.length){s.push(`Line ${n+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${n+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((f,v)=>{i[f]=l[v]||"";});let c=i.Column||"Unnamed";o.has(c)||o.set(c,{id:`col-${o.size+1}`,title:c,position:o.size+1,cardIds:[]});let d=o.get(c),p={id:i["Card ID"]||`card-${n}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:d.id,position:d.cardIds.length+1,priority:i.Priority||void 0,labels:i.Labels?i.Labels.split(";").filter(Boolean):void 0,assignedUserIds:i["Assigned Users"]?i["Assigned Users"].split(";").filter(Boolean):void 0,startDate:i["Start Date"]?i["Start Date"]:void 0,endDate:i["End Date"]?i["End Date"]:void 0,createdAt:i["Created At"]?i["Created At"]:void 0,updatedAt:i["Updated At"]?i["Updated At"]:void 0};r.push(p),d.cardIds.push(p.id);}catch(l){s.push(`Line ${n+1}: ${l instanceof Error?l.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 qd(e){let t=[],a="",r=false;for(let o=0;o<e.length;o++){let s=e[o],n=e[o+1];s==='"'&&r&&n==='"'?(a+='"',o++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Yd(e,t){switch(t){case "json":return Yg(e);case "csv":return Xg(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Xd(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 hi=createContext(null);function Jd(){return useContext(hi)}var Zd=createContext(null);function Qd({children:e,themeName:t}){return jsx(Zd.Provider,{value:{themeName:t},children:e})}function Bo(){return useContext(Zd)}function wt({children:e,container:t}){let[a,r]=useState(false),o=Jd(),s=Bo();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let n=t||(typeof document<"u"?document.body:null);if(!n)return null;if(o){let{theme:l,themeName:u}=o,i={"--asakaa-color-background-primary":l.bgPrimary,"--asakaa-color-background-secondary":l.bgSecondary,"--asakaa-color-background-card":l.bgGrid,"--asakaa-color-background-hover":l.hoverBg,"--asakaa-color-text-primary":l.textPrimary,"--asakaa-color-text-secondary":l.textSecondary,"--asakaa-color-text-tertiary":l.textTertiary,"--asakaa-color-text-inverse":l.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":l.border,"--asakaa-color-border-hover":l.borderLight,"--asakaa-color-border-subtle":l.borderLight,"--asakaa-color-interactive-primary":l.accent,"--asakaa-color-interactive-primaryHover":l.accentHover,"--asakaa-color-interactive-primaryBorder":`${l.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${l.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${l.accent}33`,"--asakaa-color-status-success":l.statusCompleted,"--asakaa-color-status-warning":l.milestone,"--asakaa-color-status-error":l.criticalPath,"--asakaa-color-danger":l.criticalPath,"--asakaa-color-danger-border":`${l.criticalPath}4D`,"--asakaa-color-danger-background":`${l.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${l.criticalPath}26`};return createPortal(jsx("div",{"data-theme":u,"data-gantt-portal":"true",style:i,children:e}),n)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),n):createPortal(e,n)}var oc={URGENT:{label:"Urgent",color:"#E74C3C"},HIGH:{label:"High",color:"#E67E22"},MEDIUM:{label:"Normal",color:"#F1C40F"},LOW:{label:"Low",color:"#2ECC71"}},of="#BDC3C7",nf=({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 po({priority:e,onChange:t,className:a}){let[r,o]=useState(false),[s,n]=useState({top:0,left:0}),l=useRef(null),u=useRef(null),i=()=>{if(!u.current)return;let f=u.current.getBoundingClientRect(),v=window.innerHeight,k=window.innerWidth,g=160,y=220,h=4,b=f.right-g;b<10&&(b=f.left),b+g>k-10&&(b=k-g-10);let x=v-f.bottom,D=f.top,N;x>=y+h?N=f.bottom+h:D>=y+h?N=f.top-y-h:N=x>=D?f.bottom+h:Math.max(10,f.top-y-h),n({top:N,left:b}),o(true);};useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&!u.current?.contains(v.target)&&o(false);};if(r)return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[r]),useEffect(()=>{let f=v=>{v.key==="Escape"&&o(false);};if(r)return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[r]);let c=f=>{t(f),o(false);},d=e?oc[e]:null,p=d?.color||of;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:u,onClick:()=>r?o(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:e?`${p}10`:"transparent",boxShadow:e?`0 0 0 2px ${p}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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:p,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(wt,{children:jsxs("div",{ref:l,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(oc).map(([f,v])=>jsxs("button",{onClick:()=>c(f),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:k=>{k.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:k=>{k.currentTarget.style.background="transparent";},children:[jsx(nf,{color:v.color}),jsx("span",{className:"font-semibold text-sm",children:v.label}),e===f&&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"})})]},f)),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:()=>c(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: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("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 sf=[{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 nn({startDate:e,endDate:t,onChange:a,className:r}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),u=useRef(null),i=useRef(null),p=(Bo()?.themeName||"dark")==="dark",f=()=>{if(!i.current)return;let b=i.current.getBoundingClientRect(),x=window.innerHeight,D=window.innerWidth,N=320,C=380,w=4,R=b.left;R+N>D-10&&(R=D-N-10),R<10&&(R=10);let F=x-b.bottom,T=b.top,H;F>=C+w?H=b.bottom+w:T>=C+w?H=b.top-C-w:H=F>=T?b.bottom+w:Math.max(10,b.top-C-w),l({top:H,left:R}),s(true);};useEffect(()=>{let b=x=>{u.current&&!u.current.contains(x.target)&&!i.current?.contains(x.target)&&s(false);};if(o)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{let b=x=>{x.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[o]);let v=b=>{let x=new Date,D=R=>{let F=R.getFullYear(),T=String(R.getMonth()+1).padStart(2,"0"),H=String(R.getDate()).padStart(2,"0");return `${F}-${T}-${H}`},N=D(x),C=new Date(x);C.setDate(C.getDate()+b);let w=D(C);a(N,w),s(false);},k=()=>{if(!e||!t)return "Set date";let b=C=>{if(C instanceof Date)return C;if(typeof C!="string"||!C.match(/^\d{4}-\d{2}-\d{2}$/))return null;let w=C.split("-").map(Number);if(w.length!==3||w.some(H=>isNaN(H)))return null;let R=w[0],F=w[1],T=w[2];return R===void 0||F===void 0||T===void 0?null:new Date(R,F-1,T)},x=b(e),D=b(t);if(!x||!D||isNaN(x.getTime())||isNaN(D.getTime()))return "Set date";let N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${N[x.getMonth()]} ${x.getDate()} \u2013 ${N[D.getMonth()]} ${D.getDate()}`},g=e&&t,h=(()=>{if(!t)return false;let b=typeof t=="string"?new Date(t):t,x=new Date;return x.setHours(0,0,0,0),b<x})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>o?s(false):f(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:g?`${k()}`:"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:k()})]}),o&&jsx(wt,{children:jsxs("div",{ref:u,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${n.top}px`,left:`${n.left}px`,background:p?"#1A1D25":"#FFFFFF",border:`1px solid ${p?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:p?"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:p?"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:p?"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:sf.map(b=>jsx("button",{onClick:()=>v(b.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:x=>{x.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",x.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:b.label},b.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:p?"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:b=>a(b.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:b=>a(e,b.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:p?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:p?"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:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:o=3}){let[s,n]=useState(false),[l,u]=useState(""),[i,c]=useState({top:0,left:0}),d=useRef(null),p=useRef(null),f=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),b=window.innerHeight,x=window.innerWidth,D=300,N=380,C=4,w=h.right-D;w<10&&(w=h.left),w+D>x-10&&(w=x-D-10);let R=b-h.bottom,F=h.top,T;R>=N+C?T=h.bottom+C:F>=N+C?T=h.top-N-C:T=R>=F?h.bottom+C:Math.max(10,h.top-N-C),c({top:T,left:w}),n(true);};useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&!p.current?.contains(b.target)&&(n(false),u(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=b=>{b.key==="Escape"&&(n(false),u(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let v=h=>{let b=e.some(x=>x.id===h.id);a(b?e.filter(x=>x.id!==h.id):[...e,h]);},k=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),g=e.slice(0,o),y=e.length-o;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?n(false):f(),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:[g.map(h=>jsx("div",{className:"asakaa-avatar",title:h.name,children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"asakaa-avatar-img"}):h.initials},h.id)),y>0&&jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):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(wt,{children:jsxs("div",{ref:d,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${i.top}px`,left:`${i.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:l,onChange:h=>u(h.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:k.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"}):k.map(h=>{let b=e.some(x=>x.id===h.id);return jsxs("button",{onClick:()=>v(h),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:x=>{x.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:h.color,color:"#fff"},children:h.avatar?jsx("img",{src:h.avatar,alt:h.name,className:"w-full h-full rounded-full object-cover"}):h.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:h.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:b?"#3b82f6":"transparent"},children:b?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),n(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 Yn(e,t,a){let r=new Map;e.forEach(u=>{if(u.dependencies&&Array.isArray(u.dependencies)){let i=u.dependencies.map(c=>{if(typeof c=="string")return c;let d=c;return d.taskId||d.targetId||""}).filter(Boolean);r.set(u.id,i);}});let o=r.get(a)||[];r.set(a,[...o,t]);let s=new Set,n=new Set,l=u=>{if(!s.has(u)){s.add(u),n.add(u);let i=r.get(u)||[];for(let c of i){if(!s.has(c)&&l(c))return true;if(n.has(c))return true}}return n.delete(u),false};return l(a)}function ln({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:o,validateCircular:s=true,onCircularDependencyError:n}){let[l,u]=useState(false),[i,c]=useState(""),[d,p]=useState(t.length>0),[f,v]=useState({top:0,left:0}),[k,g]=useState(null),y=useRef(null),h=useRef(null),b=()=>{if(!h.current)return;let w=h.current.getBoundingClientRect(),R=window.innerHeight,F=window.innerWidth,T=300,H=d?380:120,A=4,se=w.right-T;se<10&&(se=w.left),se+T>F-10&&(se=F-T-10);let S=R-w.bottom,j=w.top,ie;S>=H+A?ie=w.bottom+A:j>=H+A?ie=w.top-H-A:ie=S>=j?w.bottom+A:Math.max(10,w.top-H-A),v({top:ie,left:se}),u(true);};useEffect(()=>{if(!l||!h.current)return;let w=h.current.getBoundingClientRect(),R=window.innerHeight,F=window.innerWidth,T=300,H=d?380:120,A=4,se=w.right-T;se<10&&(se=w.left),se+T>F-10&&(se=F-T-10);let S=R-w.bottom,j=w.top,ie;S>=H+A?ie=w.bottom+A:j>=H+A?ie=w.top-H-A:ie=S>=j?w.bottom+A:Math.max(10,w.top-H-A),v({top:ie,left:se});},[d,l]),useEffect(()=>{let w=R=>{y.current&&!y.current.contains(R.target)&&!h.current?.contains(R.target)&&(u(false),c(""));};if(l)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[l]),useEffect(()=>{let w=R=>{R.key==="Escape"&&(u(false),c(""));};if(l)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[l]);let x=w=>{let R=t.includes(w),F=a.find(T=>T.id===w);if(g(null),R){let T=t.filter(H=>H!==w);r(T),T.length===0&&p(false);}else {if(s&&Yn(a,w,e)){let H=`Cannot add "${F?.title||w}" as dependency - would create circular reference`;g(H),n?.(w,F?.title||w),setTimeout(()=>g(null),3e3);return}r([...t,w]),p(true);}},D=()=>{let w=!d;p(w),w||r([]);},N=a.filter(w=>w.id!==e).filter(w=>w.title.toLowerCase().includes(i.toLowerCase())||w.id.toLowerCase().includes(i.toLowerCase())),C=t.length>0?"#3B82F6":"#BDC3C7";return jsxs("div",{className:`relative ${o||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?u(false):b(),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:C,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:C},children:t.length})]}),l&&jsx(wt,{children:jsxs("div",{ref:y,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${f.top}px`,left:`${f.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:[k&&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:k})]}),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:D,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:i,onChange:w=>c(w.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:N.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"}):N.map(w=>{let R=t.includes(w.id);return jsxs("button",{onClick:()=>x(w.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:F=>{F.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:F=>{F.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:R?"#3b82f6":"transparent",borderColor:R?"#3b82f6":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:R&&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:w.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:w.id})]})]},w.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),u(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 Lr=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:o,className:s,onUpdate:n,availableUsers:l=[],allCards:u=[]})=>{let{attributes:i,listeners:c,setNodeRef:d,transform:p,transition:f,isDragging:v}=useSortable({id:e.id,disabled:o,data:{type:"card",card:e}}),k={transform:_n.Transform.toString(p),transition:f};if(t)return jsx("div",{ref:d,style:k,...i,...c,onClick:()=>a?.(e),children:t(e)});let g=l.filter(x=>e.assignedUserIds?.includes(x.id)),y=e.progress===100,h=(e.attachments||[]).filter(x=>x.type.startsWith("image/")),b={...k,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:d,style:b,className:m("asakaa-card",v&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...c,onClick:x=>{x.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:x=>{x.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:x=>{x.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((x,D)=>jsxs("div",{className:"relative",children:[jsx("img",{src:x.url,alt:x.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:N=>{N.currentTarget.style.display="none";}}),D===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},x.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:y?"line-through":"none",opacity:y?.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:x=>x.stopPropagation(),className:"priority-selector",children:jsx(po,{priority:e.priority,onChange:x=>n?.(e.id,{priority:x})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"date-picker",children:jsx(nn,{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:(x,D)=>n?.(e.id,{startDate:x,endDate:D})})}),l.length>0&&jsx("div",{onClick:x=>x.stopPropagation(),className:"user-selector",children:jsx(fo,{assignedUsers:g,availableUsers:l,onChange:x=>n?.(e.id,{assignedUserIds:x.map(D=>D.id)})})}),jsx("div",{onClick:x=>x.stopPropagation(),className:"dependencies-selector",children:jsx(ln,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(x=>typeof x=="string"?x:x.taskId):[],availableTasks:u,onChange:x=>n?.(e.id,{dependencies:x})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(x=>jsx("span",{className:"asakaa-label",children:x},x))}),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)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));Lr.displayName="Card";var Xn={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"}},gc=({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 fc({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[o,s]=useState(false),[n,l]=useState({top:0,left:0}),u=useRef(null),i=useRef(null),c=[...Object.entries(Xn).map(([g,y])=>({id:g,label:y.label,color:y.color,icon:y.icon})),...r.filter(g=>!Object.keys(Xn).includes(g.id)).map(g=>({id:g.id,label:g.title,color:g.color||"#8B5CF6",icon:"circle-dot"}))],d=()=>{let g=Xn[e];if(g)return {...g,id:e};let y=r.find(h=>h.id===e);return y?{id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}:{...Xn.todo,id:"todo"}},p=()=>{if(!i.current)return;let g=i.current.getBoundingClientRect(),y=window.innerHeight,h=window.innerWidth,b=180,x=280,D=4,N=g.right-b;N<10&&(N=g.left),N+b>h-10&&(N=h-b-10);let C=y-g.bottom,w=g.top,R;C>=x+D?R=g.bottom+D:w>=x+D?R=g.top-x-D:R=C>=w?g.bottom+D:Math.max(10,g.top-x-D),l({top:R,left:N}),s(true);};useEffect(()=>{let g=y=>{u.current&&!u.current.contains(y.target)&&!i.current?.contains(y.target)&&s(false);};if(o)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[o]),useEffect(()=>{let g=y=>{y.key==="Escape"&&s(false);};if(o)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]);let f=g=>{t(g),s(false);},v=d(),k=v.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>o?s(false):p(),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:`${k}10`,boxShadow:`0 0 0 2px ${k}30 inset`},title:v.label,children:jsx(gc,{icon:v.icon,color:k})}),o&&jsx(wt,{children:jsxs("div",{ref:u,className:"status-selector-menu",style:{position:"fixed",top:`${n.top}px`,left:`${n.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:c.map(g=>jsxs("button",{onClick:()=>f(g.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:g.color,background:"transparent"},onMouseEnter:y=>{y.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:y=>{y.currentTarget.style.background="transparent";},children:[jsx(gc,{icon:g.icon,color:g.color}),jsx("span",{className:"font-semibold",children:g.label}),e===g.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"})})]},g.id))})]})})]})}function hc({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:o}){let[s,n]=useState(false),[l,u]=useState(false),[i,c]=useState(e),[d,p]=useState({top:0,left:0}),f=useRef(null),v=useRef(null),k=useRef(null);useEffect(()=>{if(s&&v.current){let b=v.current.getBoundingClientRect();p({top:b.bottom+window.scrollY+8,left:b.left+window.scrollX});}},[s]),useEffect(()=>{let b=x=>{f.current&&!f.current.contains(x.target)&&!v.current?.contains(x.target)&&(n(false),u(false));};if(s)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[s]),useEffect(()=>{let b=x=>{x.key==="Escape"&&(n(false),u(false),c(e));};if(s)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[s,e]),useEffect(()=>{l&&k.current&&(k.current.focus(),k.current.select());},[l]);let g=()=>{u(true),c(e);},y=()=>{let b=i.trim();b&&b!==e&&t(b),u(false),n(false),c(e);},h=b=>{b.key==="Enter"?y():b.key==="Escape"&&(u(false),c(e));};return jsxs("div",{className:`relative ${o||""}`,children:[jsx("button",{ref:v,onClick:()=>n(!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(wt,{children:jsx("div",{ref:f,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:l?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:k,type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:h,onBlur:y,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:g,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(),n(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 $o=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:o,renderEmptyState:s,onCardClick:n,onCardUpdate:l,availableUsers:u,allCards:i,enableVirtualization:c,cardHeight:d=120,isCollapsed:p,onToggleCollapse:f,onColumnRename:v,onColumnDelete:k,isDeletable:g=false,className:y})=>{let{setNodeRef:h,isOver:b}=useDroppable({id:e.id,data:{type:"column",column:e}}),x=useRef(null),D=c??Wd(t.length),N=useVirtualizer({count:t.length,getScrollElement:()=>x.current,estimateSize:()=>d,enabled:D});if(a)return jsx("div",{ref:h,className:y,children:a(e,t)});let w=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let T=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:T}:T>=80?{state:"warning",percentage:T}:T>=60?{state:"approaching",percentage:T}:{state:"ok",percentage:T}})(),R=w.state==="exceeded",F=()=>"asakaa-column-count";return jsxs("div",{ref:h,className:m("asakaa-column",b&&"ring-2 ring-asakaa-accent-blue",R&&"ring-2 ring-asakaa-accent-red",y),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:m(F()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&w.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${w.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[w.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"})]}),w.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"})]}),w.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"})}),w.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||k)&&jsx(hc,{columnTitle:e.title,onRename:T=>v?.(e.id,T),onDelete:k?()=>k(e.id):void 0,isDeletable:g}),f&&jsx("button",{onClick:f,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),!p&&jsx("div",{ref:x,className:"asakaa-column-cards",style:{maxHeight:D?"600px":void 0},children:jsx(SortableContext,{items:t.map(T=>T.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"})}):D?jsx("div",{style:{height:`${N.getTotalSize()}px`,position:"relative"},children:N.getVirtualItems().map(T=>{let H=t[T.index];return H?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${T.start}px)`},children:jsx(Lr,{card:H,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i})},H.id):null})}):t.map(T=>jsx(Lr,{card:T,render:r,onClick:n,onUpdate:l,availableUsers:u,allCards:i},T.id))})})]})});$o.displayName="Column";function ki({title:e,onSave:t,className:a}){let[r,o]=useState(false),[s,n]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let u=()=>{let c=s.trim();c&&c!==e?t(c):n(e),o(false);},i=c=>{c.key==="Enter"?u():c.key==="Escape"&&(n(e),o(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:c=>n(c.target.value),onBlur:u,onKeyDown:i,className:m("asakaa-column-title bg-transparent border-b-2 border-blue-500","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:m("asakaa-column-title cursor-pointer",a),onClick:()=>o(true),title:"Click to edit",children:e})}function Sf(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let o=a[r-1];if(r>0&&o&&!/\s/.test(o))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function wc(e,t){let a=[],r=/@(\S+)/g,o;for(;(o=r.exec(e))!==null;){let s=o[1]?.toLowerCase()??"";if(!s)continue;let n=t.find(l=>{let u=l.name.toLowerCase(),i=u.replace(/\s+/g,""),c=u.split(/\s+/);return !!(i===s||u===s||c.some(d=>d===s))});n&&!a.includes(n.id)&&a.push(n.id);}return a}function Ef(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Pf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Mf=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Cc({value:e,onChange:t,onSubmit:a,users:r,placeholder:o,disabled:s=false,isSubmitting:n=false,theme:l="dark",locale:u="es",currentUser:i,enableEmoji:c=true,enableAttachments:d=true,pendingFiles:p=[],onFilesSelect:f,onRemoveFile:v,maxFileSizeMB:k=10}){let g=l==="dark",[y,h]=useState(false),[b,x]=useState([]),[D,N]=useState(0),[C,w]=useState(null),[R,F]=useState(false),T=useRef(null),H=useRef(null),A=useRef(null),se=useRef(null),S=useCallback((B,te)=>{let xe=Sf(B,te);if(w(xe),xe){let fe=r.filter(He=>He.name.toLowerCase().includes(xe.query)||He.email&&He.email.toLowerCase().includes(xe.query)).slice(0,5);x(fe),h(fe.length>0),N(0);}else h(false),x([]);},[r]),j=B=>{let te=B.target.value;if(t(te),S(te,B.target.selectionStart||0),T.current){T.current.style.height="24px";let xe=T.current.scrollHeight,fe=280,He=Math.min(xe,fe);T.current.style.height=`${He}px`,T.current.style.overflowY=xe>fe?"auto":"hidden";}},ie=()=>{T.current&&S(e,T.current.selectionStart||0);},Ae=useCallback(B=>{if(!C||!T.current)return;let te=e.slice(0,C.start),xe=e.slice(C.end),fe=`@${B.name.replace(/\s+/g,"")} `,He=te+fe+xe;t(He),h(false),w(null),setTimeout(()=>{if(T.current){let ve=C.start+fe.length;T.current.selectionStart=ve,T.current.selectionEnd=ve,T.current.focus();}},0);},[C,e,t]),L=B=>{if(y&&b.length>0)switch(B.key){case "ArrowDown":B.preventDefault(),N(te=>te<b.length-1?te+1:0);break;case "ArrowUp":B.preventDefault(),N(te=>te>0?te-1:b.length-1);break;case "Enter":{B.preventDefault();let te=b[D];te&&Ae(te);break}case "Tab":{B.preventDefault();let te=b[D];te&&Ae(te);break}case "Escape":B.preventDefault(),h(false);break}else B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),a());};useEffect(()=>{let B=te=>{H.current&&!H.current.contains(te.target)&&T.current&&!T.current.contains(te.target)&&h(false),se.current&&!se.current.contains(te.target)&&F(false);};return document.addEventListener("mousedown",B),()=>document.removeEventListener("mousedown",B)},[]);let ge=useCallback(B=>{if(!T.current)return;let te=T.current.selectionStart||e.length,xe=e.slice(0,te)+B+e.slice(te);t(xe),F(false),setTimeout(()=>{if(T.current){let fe=te+B.length;T.current.selectionStart=fe,T.current.selectionEnd=fe,T.current.focus();}},0);},[e,t]),ee=useCallback(B=>{if(!f||!B.target.files)return;let te=Array.from(B.target.files),xe=k*1024*1024,fe=te.filter(He=>He.size>xe?(console.warn(`File ${He.name} exceeds max size of ${k}MB`),false):true);fe.length>0&&f(fe),B.target.value="";},[f,k]),Ke=useCallback(B=>B.type.startsWith("image/")?Image:B.type.includes("pdf")||B.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(y&&H.current){let B=H.current.children[D];B&&B.scrollIntoView({block:"nearest"});}},[D,y]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(B=>{let te=Ke(B.file),xe=B.file.type.startsWith("image/");return jsxs("div",{className:m("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",g?"bg-white/10":"bg-gray-100"),children:[xe&&B.preview?jsx("img",{src:B.preview,alt:B.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(te,{className:m("w-4 h-4",g?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:m("text-xs truncate",g?"text-white":"text-gray-900"),children:B.file.name}),jsx("p",{className:m("text-xs",g?"text-[#6B7280]":"text-gray-400"),children:Pf(B.file.size)})]}),v&&jsx("button",{onClick:()=>v(B.id),className:m("p-0.5 rounded-full transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},B.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[i&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:i.color||"#8B5CF6"},children:i.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:m("flex-1 relative min-w-0"),children:[jsxs("div",{className:m("flex items-end gap-1 px-2 py-2 rounded-lg",g?"bg-white/5":"bg-white border border-gray-200"),children:[c&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>F(!R),disabled:s||n,className:m("p-1 rounded transition-colors flex-shrink-0",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:R&&jsx(motion.div,{ref:se,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Mf.map(B=>jsx("button",{type:"button",onClick:()=>ge(B),className:m("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",g?"hover:bg-white/10":"hover:bg-gray-100"),children:B},B))})})})]}),d&&f&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>A.current?.click(),disabled:s||n,className:m("p-1.5 rounded transition-colors",g?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||n)&&"opacity-50"),title:u==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:A,type:"file",multiple:true,onChange:ee,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:T,value:e,onChange:j,onSelect:ie,onKeyDown:L,placeholder:o||(u==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||n,rows:1,className:m("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",g?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||n)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:n||!e.trim()&&p.length===0||s,className:m("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-blue-500 text-white hover:bg-blue-600":g?"text-[#6B7280]":"text-gray-400",n&&"opacity-50 cursor-not-allowed"),children:n?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:y&&b.length>0&&jsx(motion.div,{ref:H,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:m("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",g?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:b.map((B,te)=>jsxs("button",{type:"button",onClick:()=>Ae(B),className:m("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",te===D?g?"bg-white/10":"bg-gray-100":g?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:B.color||"#8B5CF6"},children:Ef(B.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:m("text-sm font-medium truncate",g?"text-white":"text-gray-900"),children:B.name}),B.email&&jsx("p",{className:m("text-xs truncate",g?"text-[#6B7280]":"text-gray-500"),children:B.email})]})]},B.id))})})]})]})]})}function Tc({content:e,theme:t="dark"}){let a=t==="dark",r=[],o=/@(\S+)/g,s=0,n;for(;(n=o.exec(e))!==null;)n.index>s&&r.push({type:"text",value:e.slice(s,n.index)}),r.push({type:"mention",value:n[0]}),s=n.index+n[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((l,u)=>l.type==="mention"?jsx("span",{className:m("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:l.value},u):jsx("span",{children:l.value},u))})}var ts=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Kr({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:o,disabled:s=false,compact:n=true}){let[l,u]=useState(false),[i,c]=useState(""),[d,p]=useState(false),[f,v]=useState(ts[10]||"#3B82F6"),[k,g]=useState({top:0,left:0}),y=useRef(null),h=useRef(null),b=useRef(null),x=useRef(null),D=t.filter(T=>T.name.toLowerCase().includes(i.toLowerCase())),N=t.some(T=>T.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let T=h.current.getBoundingClientRect();g({top:T.bottom+6,left:T.left});}},[l]),useEffect(()=>{let T=H=>{let A=H.target,se=y.current?.contains(A),S=b.current?.contains(A);!se&&!S&&(u(false),c(""),p(false));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{l&&x.current&&x.current.focus();},[l]);let C=T=>{let H=e.some(A=>A.id===T.id);a(H?e.filter(A=>A.id!==T.id):[...e,T]);},w=async()=>{if(!(!r||!i.trim())){p(true);try{let T=await r(i.trim(),f);T&&(a([...e,T]),c(""),v(ts[Math.floor(Math.random()*ts.length)]||"#3B82F6"));}finally{p(false);}}},R=(T,H)=>{H.stopPropagation(),a(e.filter(A=>A.id!==T));},F={backgroundColor:`${o.textTertiary}15`,border:`1px solid ${o.borderLight}`,color:o.textSecondary};return jsxs("div",{ref:y,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&u(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:F,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(T=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${T.color}20`,color:T.color},children:T.name},T.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:o.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:o.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:b,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:k.top,left:k.left,zIndex:99999,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:x,type:"text",value:i,onChange:T=>c(T.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:T=>{T.key==="Enter"&&i.trim()&&!N&&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(T=>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:`${T.color}20`,color:T.color},onClick:H=>R(T.id,H),children:[T.name,jsx(X,{className:"w-3 h-3"})]},T.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:D.length>0?D.map(T=>{let H=e.some(A=>A.id===T.id);return jsxs("button",{type:"button",onClick:()=>C(T),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:H?`${T.color}15`:"transparent",color:o.textPrimary},onMouseEnter:A=>{H||(A.currentTarget.style.backgroundColor=o.hoverBg);},onMouseLeave:A=>{H||(A.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:T.color}}),jsx("span",{className:"flex-1 text-left",children:T.name}),H&&jsx(Check,{className:"w-4 h-4",style:{color:T.color}})]},T.id)}):i.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"})}),i.trim()&&!N&&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:ts.map(T=>jsx("button",{type:"button",onClick:()=>v(T),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:T,outline:f===T?`2px solid ${T}`:"none",outlineOffset:"2px"}},T))}),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:f,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 "',i.trim(),'"']})]})]})}),document.body)]})}function Ci({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 Dc({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(Ci,{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 bo=[{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"}];function Sc(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function zf(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Uf({className:e}){return jsxs("svg",{className:m("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Ti({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:o}){let s=zf(e.health),n={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},l={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},u=Sc(e.loggedMinutes),i=e.estimateMinutes?Sc(e.estimateMinutes):null,c=a&&i?`${u} / ${i}`:u;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:m("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,n[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",o),onClick:r,type:r?"button":void 0,children:[jsx(Uf,{className:l[t]}),jsx("span",{children:c})]})}function Pc(e){let t=e.trim().toLowerCase();if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?0:Math.round(o*60)}function rs(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Gf(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Vf({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function _f({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function Mc({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function jf({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Ni({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:o=0,onLogTime:s,onUpdateEstimate:n,onStartTimer:l,onStopTimer:u,onDiscardTimer:i,onClose:c,className:d}){let[p,f]=useState(""),[v,k]=useState(t.estimateMinutes?rs(t.estimateMinutes):""),[g,y]=useState(""),[h,b]=useState(false),[x,D]=useState(false),N=useRef(null);useEffect(()=>{N.current?.focus();},[]);let C=async()=>{let F=Pc(p);if(!(F<=0||!s)){b(true);try{await s({durationMinutes:F,note:g.trim()||void 0,source:"manual"}),f(""),y("");}finally{b(false);}}},w=async()=>{if(!n)return;let F=v.trim()?Pc(v):null;await n(F),D(false);},R=F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),C()),F.key==="Escape"&&c?.();};return jsxs("div",{className:m("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",d),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:c,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(Mc,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Gf(o)})]}),jsx("button",{onClick:u,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(_f,{className:"w-4 h-4"})}),jsx("button",{onClick:i,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(Mc,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:m("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Vf,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(jf,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:N,type:"text",value:p,onChange:F=>f(F.target.value),onKeyDown:R,placeholder:"8 (=8h), 2h 30m",className:m("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsx("button",{onClick:C,disabled:h||!p.trim(),className:m("px-3 py-1.5 rounded-lg text-sm font-medium","bg-blue-500 hover:bg-blue-600 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:g,onChange:F=>y(F.target.value),onKeyDown:R,placeholder:"Note (optional)",className:m("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:rs(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),x?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:v,onChange:F=>k(F.target.value),onKeyDown:F=>{F.key==="Enter"&&w(),F.key==="Escape"&&D(false);},onBlur:w,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-blue-500 bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>D(true),className:"font-medium text-gray-900 dark:text-white hover:text-blue-500",children:t.estimateMinutes?rs(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:m("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:m("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(F=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:F.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:rs(F.durationMinutes)})]},F.id))})]})]})}function Xf(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;if(t.includes(":")){let[s,n]=t.split(":").map(Number);return (s||0)*60+(n||0)}let a=t.match(/(\d+(?:\.\d+)?)\s*h/),r=t.match(/(\d+)\s*m/);if(a||r){let s=a?.[1]?parseFloat(a[1]):0,n=r?.[1]?parseInt(r[1],10):0;return Math.round(s*60)+n}let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Jf(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function yo({mode:e,locale:t,isDark:a,currentValue:r,onSave:o,onClose:s,className:n}){let[l,u]=useState(Jf(r)),[i,c]=useState(""),[d,p]=useState(false),f=useRef(null);useEffect(()=>{f.current?.focus();},[]);let v=async()=>{p(true);let b=Xf(l);await o(b&&b>0?b:null,i||void 0),p(false);},k=async()=>{p(true),await o(null),p(false);},g=b=>{b.key==="Enter"&&!b.shiftKey&&(b.preventDefault(),v()),b.key==="Escape"&&s();},y={estimate:t==="es"?"Duraci\xF3n estimada":"Estimated duration",quoted:t==="es"?"Tiempo ofertado":"Quoted time",log:t==="es"?"Registrar tiempo":"Log time"},h={estimate:"8 (=8h)",quoted:"8 (=8h)",log:"8 (=8h)"};return jsxs("div",{className:m("w-64 p-3 rounded-lg shadow-xl border",a?"bg-[#1F2937] border-[#374151]":"bg-white border-gray-200",n),onClick:b=>b.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:m("text-sm font-medium",a?"text-white":"text-gray-900"),children:y[e]}),jsx("button",{type:"button",onClick:s,className:m("p-1 rounded transition-colors",a?"hover:bg-white/10 text-gray-400":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsxs("div",{className:"mb-3",children:[jsx("input",{ref:f,type:"text",value:l,onChange:b=>u(b.target.value),onKeyDown:g,placeholder:h[e],className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")}),jsx("p",{className:m("text-xs mt-1",a?"text-gray-500":"text-gray-400"),children:t==="es"?"Ej: 8 (=8h), 1h 30m, 45m, 2:30":"e.g. 8 (=8h), 1h 30m, 45m, 2:30"})]}),e==="log"&&jsx("div",{className:"mb-3",children:jsx("input",{type:"text",value:i,onChange:b=>c(b.target.value),onKeyDown:g,placeholder:t==="es"?"Comentario (opcional)":"Comment (optional)",className:m("w-full px-3 py-2 text-sm rounded-lg border transition-all","focus:outline-none focus:ring-2 focus:ring-blue-500/50",a?"bg-[#374151] border-[#4B5563] text-white placeholder:text-gray-500":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})}),jsx("button",{type:"button",onClick:v,disabled:d||!l.trim(),className:m("w-full py-2 px-3 text-sm font-medium rounded-lg transition-colors","bg-blue-600 hover:bg-blue-700 text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:d?t==="es"?"Guardando...":"Saving...":t==="es"?"Guardar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:k,disabled:d,className:m("w-full mt-2 py-1.5 px-3 text-xs font-medium rounded-lg transition-colors",a?"text-gray-400 hover:text-red-400 hover:bg-red-500/10":"text-gray-500 hover:text-red-600 hover:bg-red-50"),children:t==="es"?"Quitar valor":"Clear value"})]})}function Zf(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Qf(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Ei({summary:e,showLabel:t=false,size:a="md",className:r}){let o=Zf(e.health),s=Qf(e.health),n={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,u=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:m("flex items-center gap-2",r),children:[jsx("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",n[a]),children:jsx("div",{className:m("h-full w-1/4",o)})}),t&&jsx("span",{className:m("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:m("flex items-center gap-2",r),children:[jsxs("div",{className:m("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",n[a]),children:[jsx("div",{className:m("h-full transition-all duration-300",o),style:{width:`${u}%`}}),i&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:m("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function zo(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function t0(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-blue-400":"text-blue-600";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function a0(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-blue-900/30 border-blue-700/50":"bg-blue-50 border-blue-200";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function r0(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function o0({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,o=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",n=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",u=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:m("text-2xl font-bold",o),children:[r?"+":"",zo(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:m("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:m("font-medium",u),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-blue-400":"text-blue-600",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:m("font-medium",u),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:m("font-medium",u),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:m("p-4 rounded-lg border",s,n),children:[jsx("div",{className:m("text-sm font-medium mb-2",l),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:m("font-medium",u),children:zo(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:m("font-medium",u),children:zo(e.totalLoggedMinutes)})]}),jsxs("div",{className:m("flex justify-between pt-1 border-t",n),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:m("font-medium",u),children:e.totalTasksWithEstimate})]})]})]})]})}function n0({task:e,locale:t,isDark:a,onClick:r}){let o=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",n=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:m("border-b",s,r&&m("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:m("font-medium",n),children:e.taskName}),e.projectName&&jsx("div",{className:m("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?zo(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:zo(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:m("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[o,zo(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:m("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[o,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:m("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",a0(e.status,a),t0(e.status,a)),children:r0(e.status,t)})})]})}function Pi({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:o,onTaskClick:s}){let n=r==="dark",l=n?"bg-[#0F1117]":"bg-gray-50",u=n?"bg-[#1A1D25]":"bg-white",i=n?"border-white/5":"border-gray-200",c=n?"text-[#E5E7EB]":"text-gray-900",d=n?"text-[#9CA3AF]":"text-gray-500",p=n?"bg-[#0F1117]/50":"bg-gray-50",f=useMemo(()=>e?[...e.tasks].sort((v,k)=>v.varianceMinutes===null?1:k.varianceMinutes===null?-1:k.varianceMinutes-v.varianceMinutes):[],[e]);return t?jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:m("p-8 text-center",d,o),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:m("space-y-6 p-6",l,o),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:m("text-2xl font-bold",c),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:m("text-sm mt-1",d),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(o0,{summary:e.summary,locale:a,isDark:n}),jsx("div",{className:m("rounded-lg border overflow-hidden",u,i),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:p,children:jsxs("tr",{children:[jsx("th",{className:m("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:"%"}),jsx("th",{className:m("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",d),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:m("divide-y",i),children:f.map(v=>jsx(n0,{task:v,locale:a,isDark:n,onClick:s},v.taskId))})]})})}),jsx("div",{className:m("text-xs text-center",d),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Uo(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function v0(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function Uc(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(o=>{let s=t.find(n=>n.id===o);return s||null}).filter(o=>o!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(o=>typeof o=="string"?o:o.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(o=>({id:o.id,name:o.title,progress:o.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function x0(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function Br({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:o,theme:s="dark",locale:n="es",availableUsers:l=[],availableTags:u=[],onCreateTag:i,attachments:c=[],onUploadAttachments:d,onDeleteAttachment:p,availableTasks:f=[],comments:v=[],onAddComment:k,currentUser:g,mentionableUsers:y=[],onUploadCommentAttachments:h,enableTimeTracking:b=false,timeTrackingSummary:x,timeEntries:D=[],isTimerRunning:N=false,timerElapsedSeconds:C=0,onTimeLog:w,onEstimateUpdate:R,onSoldEffortUpdate:F,onTimerStart:T,onTimerStop:H,onTimerDiscard:A,blurFinancials:se=false}){let S=s==="dark",j={textTertiary:S?"#6B7280":"#9CA3AF",textSecondary:S?"#9CA3AF":"#6B7280",textPrimary:S?"#FFFFFF":"#111827",borderLight:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:S?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:S?"#1A1D25":"#FFFFFF",bgSecondary:S?"#0F1117":"#F9FAFB",hoverBg:S?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},ie=e&&"title"in e&&!("name"in e),Ae=e,[L,ge]=useState(e?Uc(e,l):null),[ee,Ke]=useState(false),[B,te]=useState(false),[xe,fe]=useState(false),[He,ve]=useState(null),[_e,re]=useState(new Date),[V,Y]=useState(false),[me,Te]=useState(false),[Xe,z]=useState(""),[Ne,Pe]=useState(false),[Fe,J]=useState(false),[I,K]=useState(false),[le,De]=useState(false),[je,ot]=useState(""),ct=useRef(null),qe=useRef(null),[sa,G]=useState(""),q=useRef(null),[ke,rt]=useState(""),[Se,Re]=useState(false),[X$1,Ye]=useState([]),[$,de]=useState(""),[Oe,et]=useState(false),tt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let P=Uc(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:P?.id,taskName:P?.name,soldEffortMinutes:P?.soldEffortMinutes,quotedMinutes:P?.quotedMinutes,effortMinutes:P?.effortMinutes,timeLoggedMinutes:P?.timeLoggedMinutes}),ge(P),ot(P.description||""),G(P.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!je)return;let P=setTimeout(()=>{let Z=qe.current;Z&&(Z.style.height="auto",Z.style.height=`${Math.max(100,Z.scrollHeight)}px`);},50);return ()=>clearTimeout(P)},[t,je]),useEffect(()=>()=>{ct.current&&clearTimeout(ct.current),q.current&&clearTimeout(q.current);},[]),useEffect(()=>{t&&tt.current&&v.length>0&&setTimeout(()=>{tt.current&&(tt.current.scrollTop=tt.current.scrollHeight);},100);},[t,v.length]);let Ge=useCallback(P=>{ge(P),ie&&o&&Ae?o(x0(P,Ae)):r&&r(P);},[ie,Ae,o,r]),be=useCallback(()=>{Ke(false),te(false),fe(false),ve(null),Te(false),z(""),Pe(false);},[]),Ue=useCallback((P,Z)=>{if(!L)return;let Ve={...L,[P]:Z};Ge(Ve);},[L,Ge]),W=useCallback(()=>{let P=qe.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},[]),ce=useCallback(P=>{ot(P),setTimeout(W,0),ct.current&&clearTimeout(ct.current),ct.current=setTimeout(()=>{if(L){let Z={...L,description:P};Ge(Z);}},800);},[L,Ge,W]),vt=useCallback(P=>{G(P),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{if(L&&P.trim()){let Z={...L,name:P.trim()};Ge(Z);}},800);},[L,Ge]),U=useCallback(P=>{let Z=P.map(Ve=>{let We={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Ve};return Ve.type.startsWith("image/")&&(We.preview=URL.createObjectURL(Ve)),We});Ye(Ve=>[...Ve,...Z]);},[]),ae=useCallback(P=>{Ye(Z=>{let Ve=Z.find(We=>We.id===P);return Ve?.preview&&URL.revokeObjectURL(Ve.preview),Z.filter(We=>We.id!==P)});},[]),Le=useCallback(async()=>{if(!(!L||!ke.trim()&&X$1.length===0||!k)){Re(true);try{let P=wc(ke,y),Z=[];if(X$1.length>0&&h){let Ve=X$1.map(We=>We.file);Z=await h(Ve);}await k(L.id,ke.trim(),P.length>0?P:void 0,Z.length>0?Z:void 0),rt(""),X$1.forEach(Ve=>{Ve.preview&&URL.revokeObjectURL(Ve.preview);}),Ye([]);}finally{Re(false);}}},[L,ke,X$1,k,y,h]),dt=useCallback(()=>{if(!L||!$.trim())return;let P=L.subtasks||[],Z={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:$.trim(),progress:0,startDate:new Date,endDate:new Date,position:P.length},Ve=[...P,Z],We={...L,subtasks:Ve};Ge(We),de(""),et(false);},[L,$,Ge]),Ze=useCallback(P=>{if(!L?.subtasks)return;let Z=L.subtasks.map(We=>We.id===P?{...We,progress:We.progress===100?0:100}:We),Ve={...L,subtasks:Z};Ge(Ve);},[L,Ge]),qt=useCallback(P=>{if(!L?.subtasks)return;let Z=L.subtasks.filter(We=>We.id!==P),Ve={...L,subtasks:Z};Ge(Ve);},[L,Ge]),ft=useCallback(P=>{let Z=typeof P=="string"?new Date(P):P,We=new Date().getTime()-Z.getTime(),Yt=Math.floor(We/6e4),Pa=Math.floor(We/36e5),ia=Math.floor(We/864e5);return Yt<1?n==="es"?"Ahora":"Just now":Yt<60?n==="es"?`Hace ${Yt} min`:`${Yt}m ago`:Pa<24?n==="es"?`Hace ${Pa}h`:`${Pa}h ago`:ia<7?n==="es"?`Hace ${ia}d`:`${ia}d ago`:Z.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[n]),Fa=useCallback(P=>{if(!L)return;let Z=L.progress||0;P==="completed"?Z=100:P==="in-progress"&&Z===0?Z=10:P==="todo"&&(Z=0);let Ve={...L,status:P,progress:Z};Ge(Ve),Ke(false);},[L,Ge]),Vt=useCallback((P,Z)=>{if(!L)return;let Ve={...L,startDate:P,endDate:Z};Ge(Ve);},[L,Ge]),Ea=useCallback(()=>{let P=_e.getFullYear(),Z=_e.getMonth(),Ve=new Date(P,Z,1),Yt=new Date(P,Z+1,0).getDate(),Pa=Ve.getDay(),ia=[],Oa=new Date(P,Z,0).getDate();for(let $a=Pa-1;$a>=0;$a--)ia.push({date:new Date(P,Z-1,Oa-$a),isCurrentMonth:false});for(let $a=1;$a<=Yt;$a++)ia.push({date:new Date(P,Z,$a),isCurrentMonth:true});let Aa=42-ia.length;for(let $a=1;$a<=Aa;$a++)ia.push({date:new Date(P,Z+1,$a),isCurrentMonth:false});return ia},[_e]),Wr=useCallback(async P=>{if(P.preventDefault(),P.stopPropagation(),K(false),!L||!d)return;let Z=Array.from(P.dataTransfer.files);if(Z.length!==0){De(true);try{await d(L.id,Z);}finally{De(false);}}},[L,d]),Me=useCallback(async P=>{if(!L||!d||!P.target.files)return;let Z=Array.from(P.target.files);if(Z.length!==0){De(true);try{await d(L.id,Z);}finally{De(false);}P.target.value="";}},[L,d]),Rt=useCallback(P=>{P.preventDefault(),P.stopPropagation(),K(true);},[]),Ot=useCallback(P=>{P.preventDefault(),P.stopPropagation(),K(false);},[]),Ar=useCallback(P=>P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`,[]),Ra=useCallback(P=>P.startsWith("image/")?Image:P.includes("pdf")||P.includes("document")?FileText:File,[]);return !t||!L?null:jsx(AnimatePresence,{children:t&&L&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,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:m("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",S?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:m("px-6 py-3 border-b flex items-center gap-3 h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:m("text-xs px-2 py-0.5 rounded",S?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[n==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:m("text-xs font-mono",S?"text-[#6B7280]":"text-gray-400"),children:L.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let P=L.progress===100?0:100,Ve={...L,progress:P,status:P===100?"completed":"todo"};Ge(Ve);},className:m("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",L.progress===100?"bg-green-500 border-green-500":S?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:L.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:sa,onChange:P=>vt(P.target.value),placeholder:n==="es"?"Nombre de la tarea...":"Task name...",className:m("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",L.progress===100?"line-through text-[#6B7280]":S?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),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:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{be(),Ke(!ee);},className:m("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",L.progress===100||L.status==="completed"?"bg-green-500/20 text-green-400":L.progress&&L.progress>0||L.status==="in-progress"?"bg-blue-500/20 text-blue-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:L.progress===100||L.status==="completed"?n==="es"?"COMPLETADO":"DONE":L.progress&&L.progress>0||L.status==="in-progress"?n==="es"?"EN PROGRESO":"IN PROGRESS":n==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ke(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:n==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:n==="es"?"En progreso":"In Progress",color:"bg-blue-500"},{id:"completed",label:n==="es"?"Completado":"Done",color:"bg-green-500"}].map(P=>jsxs("button",{onClick:()=>Fa(P.id),className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",L.status===P.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:S?"text-white":"text-gray-900",children:P.label})]},P.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{be(),fe(!xe);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[L.assignees&&L.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[L.assignees.slice(0,3).map((P,Z)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:P.color||"#8B5CF6"},title:P.name,children:P.initials||P.name.slice(0,2).toUpperCase()},Z)),L.assignees.length>3&&jsxs("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:["+",L.assignees.length-3]})]}):jsx("span",{className:m("text-sm",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:m("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(P=>{let Z=L.assignees?.some(Ve=>Ve.name===P.name);return jsxs("button",{onClick:()=>{let Ve=L.assignees||[],We;Z?We=Ve.filter(Yt=>Yt.name!==P.name):We=[...Ve,P],Ue("assignees",We);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",Z&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:P.color||"#8B5CF6"},children:P.initials||P.name.slice(0,2).toUpperCase()}),jsx("span",{className:m("flex-1",S?"text-white":"text-gray-900"),children:P.name}),Z&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},P.name)}):jsx("div",{className:m("px-3 py-4 text-sm text-center",S?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{ve(He?null:"start"),re(L.startDate||new Date);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[L.startDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Inicio":"Start"),jsx("span",{className:m("mx-1",S?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),L.endDate?.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(n==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:He&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ve(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:m("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:m("w-44 py-2 border-r",S?"border-white/10":"border-gray-200"),children:[(()=>{let P=new Date,Z=new Date(P);Z.setDate(P.getDate()+1);let Ve=new Date(P);Ve.setDate(P.getDate()+((6-P.getDay()+7)%7||7));let We=new Date(P);We.setDate(P.getDate()+((1-P.getDay()+7)%7||7));let Yt=new Date(P);Yt.setDate(P.getDate()+(6-P.getDay()+7)%7+7);let Pa=new Date(P);Pa.setDate(P.getDate()+14);let ia=new Date(P);return ia.setDate(P.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:P,display:P.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:Z,display:Z.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:We,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Yt,display:Yt.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:Pa,display:Pa.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:ia,display:ia.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Aa,$a)=>jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(He==="start"){let wr=L.endDate&&Aa.date>L.endDate?Aa.date:L.endDate;Vt(Aa.date,wr),ve("end");}else {let wr=L.startDate&&Aa.date<L.startDate?Aa.date:L.startDate;Vt(wr,Aa.date),ve(null);}},children:[jsx("span",{children:Aa.label}),jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Aa.display})]},$a))})(),jsx("div",{className:m("border-t mt-2 pt-2",S?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Vt(void 0,void 0),ve(null);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",S?"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:m("text-xs mb-3 px-2 py-1 rounded",S?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:He==="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:m("font-medium",S?"text-white":"text-gray-900"),children:_e.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>re(new Date),className:m("p-1 rounded text-sm transition-colors",S?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>re(new Date(_e.getFullYear(),_e.getMonth()-1)),className:m("p-1 rounded",S?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>re(new Date(_e.getFullYear(),_e.getMonth()+1)),className:m("p-1 rounded",S?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),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(P=>jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",S?"text-[#6B7280]":"text-gray-400"),children:P},P))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:Ea().map((P,Z)=>{let Ve=P.date.toDateString()===new Date().toDateString(),We=L.startDate?.toDateString()===P.date.toDateString(),Yt=L.endDate?.toDateString()===P.date.toDateString(),Pa=We||Yt,ia=L.startDate&&L.endDate&&P.date>=L.startDate&&P.date<=L.endDate;return jsx("button",{onClick:()=>{let Oa=new Date(P.date);if(He==="start"){let Aa=L.endDate&&Oa>L.endDate?Oa:L.endDate;Vt(Oa,Aa),ve("end");}else {let Aa=L.startDate&&Oa<L.startDate?Oa:L.startDate;Vt(Aa,Oa),ve(null);}},className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!P.isCurrentMonth&&(S?"text-[#4B5563]":"text-gray-300"),P.isCurrentMonth&&(S?"text-white":"text-gray-900"),Ve&&"ring-2 ring-[#3B82F6]",We&&"bg-[#3B82F6] text-white",Yt&&!We&&"bg-[#7C3AED] text-white",ia&&!Pa&&(S?"bg-[#7C3AED]/20":"bg-purple-100"),!Pa&&(S?"hover:bg-white/10":"hover:bg-gray-100")),children:P.date.getDate()},Z)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{be(),te(!B);},className:m("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",L.priority==="high"||L.priority==="urgent"?"bg-red-500/20 text-red-400":L.priority==="medium"?"bg-yellow-500/20 text-yellow-400":L.priority==="low"?"bg-green-500/20 text-green-400":S?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:L.priority?L.priority==="high"||L.priority==="urgent"?n==="es"?"Alta":"High":L.priority==="medium"?n==="es"?"Media":"Medium":n==="es"?"Baja":"Low":n==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:B&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>te(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",S?"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(P=>jsxs("button",{onClick:()=>{Ue("priority",P.id),te(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",L.priority===P.id&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",P.color)}),jsx("span",{className:S?"text-white":"text-gray-900",children:P.label})]},P.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:L.startDate&&L.endDate?`${Math.ceil((L.endDate.getTime()-L.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:m("w-4 h-4 rounded-full border-2",S?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[V?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:L.progress||0,onChange:P=>{let Z=parseInt(P.target.value),Ve=L.status;Z===100?Ve="completed":Z>0?Ve="in-progress":Ve="todo";let We={...L,progress:Z,status:Ve};Ge(We);},onBlur:()=>Y(false),className:m("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",S?"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:()=>Y(true),className:m("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",S?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:m("h-full rounded-full transition-all",L.progress===100?"bg-green-500":"bg-[#3B82F6]"),style:{width:`${L.progress||0}%`}})}),jsxs("span",{className:m("text-sm font-medium min-w-[40px]",S?"text-white":"text-gray-900"),children:[L.progress||0,"%"]})]})]}),b&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:L.status==="completed"||L.progress===100?jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:x?.estimateMinutes?Uo(x.estimateMinutes):n==="es"?"Vac\xEDo":"Empty"}):x?.estimateMinutes?jsx("button",{type:"button",onClick:()=>J("estimate"),className:m("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Uo(x.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>J("estimate"),className:m("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Fe==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(yo,{mode:"estimate",locale:n,isDark:S,currentValue:x?.estimateMinutes||null,onSave:async P=>{await R?.(L.id,P),J(false);},onClose:()=>J(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:se?jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",S?"text-[#94A3B8]":"text-gray-500"),title:n==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):L.status==="completed"||L.progress===100?jsx("span",{className:m("text-sm px-2 py-0.5 cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:L.quotedMinutes?Uo(L.quotedMinutes):n==="es"?"Vac\xEDo":"Empty"}):L.quotedMinutes?jsx("button",{type:"button",onClick:()=>J("quoted"),className:m("text-sm px-2 py-0.5 rounded",S?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Uo(L.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>J("quoted"),className:m("text-sm",S?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:n==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Fe==="quoted"&&!se&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(yo,{mode:"quoted",locale:n,isDark:S,currentValue:L.quotedMinutes||null,onSave:async P=>{F?(await F(L.id,P),ge(Z=>Z?{...Z,quotedMinutes:P}:null)):Ue("quotedMinutes",P),J(false);},onClose:()=>J(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[L.status==="completed"||L.progress===100?jsx("div",{className:m("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",S?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):N?jsxs("button",{type:"button",onClick:()=>H?.(L.id),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),v0(C||0)]}):jsx("button",{type:"button",onClick:()=>T?.(L.id),className:m("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",S?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:n==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),L.status==="completed"||L.progress===100?jsxs("div",{className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",S?"text-gray-600":"text-gray-300"),title:n==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>J("log"),className:m("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",S?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),n==="es"?"Agregar tiempo":"Add time"]}),x&&x.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:m("text-sm font-medium",x.health==="over-budget"?"text-red-500":x.health==="at-risk"?"text-yellow-500":S?"text-white":"text-gray-900"),children:[Uo(x.loggedMinutes),x.estimateMinutes&&jsxs("span",{className:m("font-normal",S?"text-[#6B7280]":"text-gray-400"),children:[" / ",Uo(x.estimateMinutes)]})]}),x.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:m("h-full rounded-full transition-all",x.health==="over-budget"?"bg-red-500":x.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,x.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:Fe==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(yo,{mode:"log",locale:n,isDark:S,currentValue:null,onSave:async(P,Z)=>{P&&await w?.(L.id,{durationMinutes:P,note:Z,source:"manual"}),J(false);},onClose:()=>J(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Etiquetas":"Tags"}),jsx(Kr,{selectedTags:L.tags||[],availableTags:u,onChange:P=>{Ue("tags",P);},onCreateTag:i,theme:j})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:m("w-4 h-4 mt-1.5",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0 mt-1",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[L.dependencies&&L.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:L.dependencies.map(P=>{let Z=f.find(Ve=>Ve.id===P);return jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",S?"bg-blue-500/20 text-blue-400":"bg-blue-100 text-blue-700"),children:[Z?.name||P.slice(0,8),jsx("button",{onClick:()=>{let Ve=(L.dependencies||[]).filter(We=>We!==P);Ue("dependencies",Ve);},className:m("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},P)})}),jsxs("button",{onClick:()=>{be(),Te(!me);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:me&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Te(false),z("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:m("p-2 border-b",S?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Xe,onChange:P=>z(P.target.value),placeholder:n==="es"?"Buscar tarea...":"Search task...",className:m("w-full px-3 py-2 rounded-md text-sm outline-none",S?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:f.length>0?f.filter(P=>P.id!==L.id).filter(P=>Xe===""||P.name.toLowerCase().includes(Xe.toLowerCase())).map(P=>{let Z=L.dependencies?.includes(P.id);return jsxs("button",{onClick:()=>{let Ve=L.dependencies||[],We;Z?We=Ve.filter(Yt=>Yt!==P.id):We=[...Ve,P.id],Ue("dependencies",We);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",S?"hover:bg-white/5":"hover:bg-gray-50",Z&&(S?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",Z?"bg-blue-500 border-blue-500":S?"border-white/30":"border-gray-300"),children:Z&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:m("block truncate",S?"text-white":"text-gray-900"),children:P.name}),jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:P.id.slice(0,8)})]})]},P.id)}):jsx("div",{className:m("px-3 py-4 text-sm text-center",S?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{be(),Pe(!Ne);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:L.color||"#6366F1"}}),jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:bo.find(P=>P.value===L.color)?.name||(n==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:m("w-3 h-3",S?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Ne&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",S?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:bo.map(P=>{let Z=L.color===P.value;return jsx("button",{onClick:()=>{Ue("color",P.value),Pe(false);},className:m("w-7 h-7 rounded-full flex items-center justify-center transition-all",Z&&"ring-2 ring-offset-2",S?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:P.value,outlineColor:Z?P.value:void 0},title:P.name,children:Z&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},P.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm w-28 truncate flex-shrink-0",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:L.isMilestone||false,onChange:P=>Ue("isMilestone",P.target.checked),className:m("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",L.isMilestone?"bg-purple-500 border-purple-500":S?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:m("text-sm",S?"text-white":"text-gray-900"),children:n==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:m("w-4 h-4",S?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:n==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:qe,value:je,onChange:P=>ce(P.target.value),placeholder:n==="es"?"Agregar descripci\xF3n...":"Add description...",className:m("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",S?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Subtareas":"Subtasks",L.subtasks&&L.subtasks.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",L.subtasks.filter(P=>P.progress===100).length,"/",L.subtasks.length,")"]})]})}),L.subtasks&&L.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...L.subtasks].sort((P,Z)=>(P.position??0)-(Z.position??0)).map(P=>jsxs("div",{className:m("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",S?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Ze(P.id),className:m("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",P.progress===100?"bg-green-500 border-green-500":S?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:P.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:m("text-sm flex-1",P.progress===100?"line-through text-[#6B7280]":S?"text-white":"text-gray-900"),children:P.name}),jsx("button",{onClick:()=>qt(P.id),className:m("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",S?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},P.id))}),Oe?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:$,onChange:P=>de(P.target.value),onKeyDown:P=>{P.key==="Enter"&&$.trim()?dt():P.key==="Escape"&&(et(false),de(""));},placeholder:n==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:m("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",S?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-blue-500/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-blue-500")}),jsx("button",{onClick:dt,disabled:!$.trim(),className:m("px-3 py-2 rounded-lg text-sm font-medium transition-colors",$.trim()?"bg-blue-500 hover:bg-blue-600 text-white":S?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:n==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{et(false),de("");},className:m("p-2 rounded-lg transition-colors",S?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>et(true),className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",S?"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"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:m("mt-6 pt-4 border-t",S?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:m("text-sm font-semibold mb-3",S?"text-white":"text-gray-900"),children:[n==="es"?"Adjuntos":"Attachments",c.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",c.length,")"]})]}),c.length>0&&jsx("div",{className:"space-y-2 mb-4",children:c.map(P=>{let Z=Ra(P.type),Ve=P.type.startsWith("image/");return jsxs("div",{className:m("flex items-center gap-3 p-2 rounded-lg group transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Ve&&P.thumbnailUrl?jsx("img",{src:P.thumbnailUrl,alt:P.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:m("w-10 h-10 rounded flex items-center justify-center",S?"bg-white/10":"bg-gray-200"),children:jsx(Z,{className:m("w-5 h-5",S?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:m("text-sm font-medium truncate block hover:underline",S?"text-white":"text-gray-900"),children:P.name}),jsx("p",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:Ar(P.size)})]}),p&&jsx("button",{onClick:()=>p(P.id),className:m("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",S?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:n==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},P.id)})}),jsxs("div",{onDragOver:Rt,onDragLeave:Ot,onDrop:Wr,className:m("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",I?S?"border-blue-500 bg-blue-500/10":"border-blue-400 bg-blue-50":S?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",le&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:Me,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!d||le}),le?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),jsx("p",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:n==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:m("w-6 h-6 mx-auto mb-2",I?"text-blue-500":S?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-500"),children:I?n==="es"?"Suelta los archivos aqu\xED":"Drop files here":n==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!d&&jsx("p",{className:m("text-xs mt-1",S?"text-[#6B7280]":"text-gray-400"),children:n==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:m("w-96 border-l flex flex-col",S?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between h-[49px]",S?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:m("text-sm font-semibold",S?"text-white":"text-gray-900"),children:[n==="es"?"Actividad":"Activity",v.length>0&&jsxs("span",{className:m("ml-2 text-xs font-normal",S?"text-[#6B7280]":"text-gray-400"),children:["(",v.length,")"]})]}),jsx("button",{onClick:a,className:m("p-1.5 rounded transition-colors",S?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -15,8 +15,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${S?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:et,className:m("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",S?"scrollbar-slim":"scrollbar-slim-light"),children:v.length>0?jsx("div",{className:"space-y-4",children:[...v].sort((P,J)=>{let He=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,ze=typeof J.createdAt=="string"?new Date(J.createdAt):J.createdAt;return He.getTime()-ze.getTime()}).map(P=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:m("text-sm font-medium",S?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:gt(P.createdAt)})]}),jsx("div",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Cc,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(J=>{let He=J.type.startsWith("image/");return jsxs("a",{href:J.url,target:"_blank",rel:"noopener noreferrer",className:m("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[He?jsx(Image,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:m("text-xs truncate max-w-[100px]",S?"text-white":"text-gray-900"),children:J.name})]},J.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:m("w-10 h-10 mb-3",S?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:m("text-sm",S?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:m("py-4 pl-4 pr-2 border-t",S?"border-white/10":"border-gray-200"),children:jsx(wc,{value:ke,onChange:at,onSubmit:Fe,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:Ne,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:Y,onFilesSelect:z,onRemoveFile:ee})})]})]})]})})}function Ei(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Yr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:u,error:i,children:c,availableTags:d=[],onCreateTag:p,attachmentsByCard:f,onUploadAttachments:v,onDeleteAttachment:k,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onTaskOpen:x,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:C,timeEntries:w,timerState:R,onLogTime:A,onUpdateEstimate:T,onUpdateSoldEffort:H,onStartTimer:L,onStopTimer:ne,onDiscardTimer:S,blurFinancials:V=false}){let[ie,Me]=Ei(),[F,ye]=useState(null),[Q,te]=useState(false),B=useRef(null),X=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),me=o?.theme||"dark",fe=me==="dark"||me==="neutral",Ge=fe?"dark":"",be=useCallback((ae,I)=>{t.onCardUpdate?.(ae,I);},[t]),Ve=useCallback((ae,I)=>{t.onColumnUpdate?.(ae,{title:I});},[t]),re=useCallback(ae=>{t.onColumnDelete?.(ae);},[t]),_=["todo","in-progress","completed"],q=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),ge=useMemo(()=>{let ae=new Map;return e.columns.forEach(I=>{let j=I.cardIds.map(le=>e.cards.find(Te=>Te.id===le)).filter(le=>le!==void 0).sort((le,Te)=>le.position-Te.position);ae.set(I.id,j);}),ae},[e.cards,e.columns]);useEffect(()=>{let ae=B.current;if(!ae)return;let I=_e=>{let rt=_e.target,ct=_e.button===1,je=rt===ae||rt.classList.contains("asakaa-column")&&!rt.closest(".asakaa-card");(ct||_e.button===0&&je&&!ie.isDragging)&&(_e.preventDefault(),te(true),X.current={x:_e.clientX,y:_e.clientY,scrollLeft:ae.scrollLeft,scrollTop:ae.scrollTop},ae.style.cursor="grabbing",ae.style.userSelect="none");},j=_e=>{if(!Q)return;let rt=_e.clientX-X.current.x,ct=_e.clientY-X.current.y;ae.scrollLeft=X.current.scrollLeft-rt,ae.scrollTop=X.current.scrollTop-ct;},le=()=>{Q&&(te(false),ae.style.cursor="",ae.style.userSelect="");},Te=()=>{Q&&(te(false),ae.style.cursor="",ae.style.userSelect="");};return ae.addEventListener("mousedown",I),document.addEventListener("mousemove",j),document.addEventListener("mouseup",le),ae.addEventListener("mouseleave",Te),()=>{ae.removeEventListener("mousedown",I),document.removeEventListener("mousemove",j),document.removeEventListener("mouseup",le),ae.removeEventListener("mouseleave",Te);}},[Q,ie.isDragging]);let De=useMemo(()=>e.cards.map(ae=>({id:ae.id,name:ae.title,startDate:ae.startDate?new Date(ae.startDate):void 0,endDate:ae.endDate?new Date(ae.endDate):void 0,progress:ae.progress||0,status:ae.columnId,priority:ae.priority?.toLowerCase(),dependencies:Array.isArray(ae.dependencies)?ae.dependencies.map(I=>typeof I=="string"?I:I.taskId):[]})),[e.cards]),qe=useCallback(ae=>{let{active:I}=ae,j=e.cards.find(le=>le.id===I.id);j&&Me({isDragging:true,draggedCardId:j.id,sourceColumnId:j.columnId,targetColumnId:j.columnId});},[e.cards,Me]),Se=useCallback(ae=>{let{active:I,over:j}=ae;if(!j||!e.cards.find(_e=>_e.id===I.id))return;let Te=null;j.data.current?.type==="column"?Te=j.id:j.data.current?.type==="card"&&(Te=e.cards.find(rt=>rt.id===j.id)?.columnId||null),Te&&Te!==ie.targetColumnId&&Me({...ie,targetColumnId:Te});},[e.cards,ie,Me]),ot=useCallback(async ae=>{let{active:I,over:j}=ae;if(Me({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!j)return;let le=e.cards.find(ct=>ct.id===I.id);if(!le)return;let Te,_e;if(j.data.current?.type==="column"){Te=j.id;let ct=ge.get(Te)||[];_e=di(ct,0);}else {let ct=e.cards.find(W=>W.id===j.id);if(!ct)return;Te=ct.columnId;let je=ge.get(Te)||[],sa=je.findIndex(W=>W.id===j.id);_e=di(je,sa);}let rt=e.columns.find(ct=>ct.id===Te);if(rt&&rt.wipLimit&&rt.wipLimitType==="hard"){let ct=ge.get(Te)||[];if(le.columnId!==Te&&ct.length>=rt.wipLimit){t.onWipLimitExceeded?.(rt,le);return}}(le.columnId!==Te||le.position!==_e)&&await t.onCardMove?.(le.id,Te,_e);},[e.cards,e.columns,ge,t,Me]),We=useCallback(ae=>{ye(ae),a?.(ae),x?.(ae.id);},[a,x]),Qe=useCallback(ae=>{t.onCardUpdate?.(ae.id,ae),ye(ae);},[t]);return u?jsx("div",{className:m("asakaa-board",Ge,n),style:l,children:jsx(A0,{columnCount:3})}):i?jsx("div",{className:m("asakaa-board",Ge,n),style:l,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 i=="string"?i:i.message})]})})}):jsxs(Zd,{themeName:me,children:[jsxs(DndContext,{sensors:q,collisionDetection:closestCorners,onDragStart:qe,onDragOver:Se,onDragEnd:ot,children:[jsxs("div",{ref:B,className:m("asakaa-board",Ge,n),style:{...l,cursor:Q?"grabbing":void 0},"data-theme":me,children:[e.columns.sort((ae,I)=>ae.position-I.position).map(ae=>{let I=ge.get(ae.id)||[],j=!_.includes(ae.id);return jsx(Oo,{column:ae,cards:I,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:We,onCardUpdate:be,onColumnRename:Ve,onColumnDelete:re,isDeletable:j,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},ae.id)}),c]}),jsx(DragOverlay,{children:ie.draggedCardId?jsx(Ar,{card:e.cards.find(ae=>ae.id===ie.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(Ir,{task:F,isOpen:!!F,onClose:()=>ye(null),onCardUpdate:Qe,theme:fe?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:F?f?.get(F.id)||[]:[],onUploadAttachments:v,onDeleteAttachment:k,availableTasks:De,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:C,timeEntries:w,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:A,onEstimateUpdate:T,onSoldEffortUpdate:H,onTimerStart:L,onTimerStop:ne,onTimerDiscard:S,blurFinancials:V})]})}function A0({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 O0={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)"},$0={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)"},z0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},U0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function H0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),n(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!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((i,c)=>i.position-c.position).map((i,c)=>jsxs(motion.button,{onClick:()=>u(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.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:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function W0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,u]=useState(null),i=useRef(null);if(useEffect(()=>{let f=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[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(f=>f.handler),p=async(f,v)=>{if(v){u(f);try{await v();}catch(k){console.error(`Export ${f} failed:`,k);}finally{u(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!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((f,v)=>jsxs(motion.button,{onClick:()=>p(f.id,f.handler),disabled:l!==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:l===f.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function G0({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 Mi({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:u,translations:i}){let c=r==="dark"?O0:$0,d={...o==="es"?z0:U0,...i},p=n||l||u;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[jsx(W0,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:u}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsx(H0,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsx(G0,{onClick:()=>t(),label:a||d.newTask}))]})})}function Ai({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[l,u]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),u(""),n(false));},[l,e]),c=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(u(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:m("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:p=>u(p.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.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:()=>{u(""),n(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:m("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(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 Li({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:u="es"}){let[i,c]=useState(false),[d,p]=useState(false),[f,v]=useState(""),[k,g]=useState([]),[y,h]=useState(""),[b,x]=useState(""),[D,N]=useState(""),[C,w]=useState(false),[R,A]=useState(false),[T,H]=useState(false),L=useRef(null),ne=useRef(null),S={placeholder:o||(u==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(u==="es"?"Agregar Tarea":"Add Task"),save:u==="es"?"Guardar":"Save",addAssignee:u==="es"?"Agregar asignado":"Add assignee",addDates:u==="es"?"Agregar fechas":"Add dates",addPriority:u==="es"?"Agregar prioridad":"Add priority",startDate:u==="es"?"Inicio":"Start",endDate:u==="es"?"Fin":"End",low:u==="es"?"Baja":"Low",medium:u==="es"?"Media":"Medium",high:u==="es"?"Alta":"High",urgent:u==="es"?"Urgente":"Urgent"},V=useCallback(()=>{v(""),g([]),h(""),x(""),N(""),w(false),A(false),H(false),c(false);},[]);useEffect(()=>{i&&L.current&&L.current.focus();},[i]),useEffect(()=>{if(!i)return;let Q=te=>{ne.current&&!ne.current.contains(te.target)&&(f.trim()||V());};return document.addEventListener("mousedown",Q),()=>document.removeEventListener("mousedown",Q)},[i,f,V]);let ie=useCallback(async()=>{let Q=f.trim();if(!(!Q||d)){p(true);try{await t({name:Q,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:y?new Date(y):void 0,endDate:b?new Date(b):void 0,priority:D||void 0}),v(""),g([]),h(""),x(""),N(""),w(!1),A(!1),H(!1),L.current?.focus();}catch(te){console.error("Error creating card:",te);}finally{p(false);}}},[f,e,k,y,b,D,t,d]),Me=useCallback(Q=>{Q.key==="Enter"&&!Q.shiftKey?(Q.preventDefault(),ie()):Q.key==="Escape"&&V();},[ie,V]),F=useCallback(Q=>{g(te=>te.includes(Q)?te.filter(B=>B!==Q):[...te,Q]);},[]),ye=l==="dark";return i?jsxs("div",{ref:ne,className:m("rounded-lg overflow-hidden shadow-lg",ye?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:L,type:"text",value:f,onChange:Q=>v(Q.target.value),onKeyDown:Me,placeholder:S.placeholder,disabled:d,className:m("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",ye?"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:()=>w(!C),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||k.length>0?"bg-emerald-500/20 text-emerald-400":ye?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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"})]}),k.length>0&&jsx("span",{className:"ml-0.5",children:k.length})]}),jsx("button",{onClick:()=>A(!R),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||y||b?"bg-blue-500/20 text-blue-400":ye?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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:()=>H(!T),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":ye?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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:ie,disabled:!f.trim()||d,className:m("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"}):S.save})]})]}),C&&a.length>0&&jsx("div",{className:m("px-3 pb-3 pt-0","border-t",ye?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(Q=>jsxs("button",{onClick:()=>F(Q.id),className:m("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(Q.id)?"bg-emerald-500 text-white":ye?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[Q.avatar?jsx("img",{src:Q.avatar,alt:Q.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:m("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(Q.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:Q.name.charAt(0).toUpperCase()}),jsx("span",{children:Q.name.split(" ")[0]})]},Q.id))})}),R&&jsx("div",{className:m("px-3 pb-3 pt-0","border-t",ye?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",ye?"text-gray-500":"text-gray-400"),children:S.startDate}),jsx("input",{type:"date",value:y,onChange:Q=>h(Q.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",ye?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",ye?"text-gray-500":"text-gray-400"),children:S.endDate}),jsx("input",{type:"date",value:b,onChange:Q=>x(Q.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",ye?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsx("div",{className:m("px-3 pb-3 pt-0","border-t",ye?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(Q=>jsx("button",{onClick:()=>N(D===Q?"":Q),className:m("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===Q?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[Q]} text-white`:ye?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:S[Q]},Q))})})]}):jsxs("button",{onClick:()=>c(true),disabled:n,className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",ye?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"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:S.buttonLabel})]})}var fn=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(Yr,{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(`
|
|
19
|
-
`)}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(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Qc(e={}){return new fn(e)}var Ho=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(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=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:n?`Error in ${n}`:"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 Ii(e,t){let a=r=>jsx(Ho,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ri({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:u,shortcut:i="k",className:c=""}){let[d,p]=useState(false),[f,v]=useState(""),[k,g]=useState("home"),[y,h]=useState(""),[b,x]=useState("");useEffect(()=>{let w=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),p(A=>!A)),R.key==="Escape"&&(p(false),g("home"),v(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),useEffect(()=>{d||(g("home"),v(""),h(""),x(""));},[d]);let D=useCallback(()=>{p(false);},[]),N=useCallback(w=>{let[R,A]=w.split(":");switch(R){case "create-card":g("create-card");break;case "create-card-in":h(A||"");break;case "navigate":A?(a?.(A),D()):g("navigate");break;case "search":r?.(f),D();break;case "priority":g("priority");break;case "set-priority":b&&A&&(o?.(b,A),D());break;case "assign":g("assign");break;case "assign-user":b&&A&&(s?.(b,A),D());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":l?.(),D();break;case "ai-usage":u?.(),D();break;case "back":g("home");break;}},[f,b,t,a,r,o,s,n,l,u,D]),C=useCallback(()=>{y&&f.trim()&&(t?.(y,f.trim()),D());},[y,f,t,D]);return d?jsx(kt,{children:jsx("div",{className:"command-palette-overlay",onClick:D,children:jsx("div",{className:`command-palette ${c}`,onClick:w=>w.stopPropagation(),children:jsxs(Command,{value:f,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:k==="create-card"&&y?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&k==="create-card"&&y&&C();}}),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."}),k==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:N,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:N,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:N,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:N,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(w=>jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(R=>jsx("span",{className:"command-palette-item-label",children:R},R))})]},w.id))})]}),k==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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(w=>jsxs(Command.Item,{value:`create-card-in:${w.id}`,onSelect:N,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:w.title}),jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),k==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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(w=>{let R=e.columns.find(A=>A.id===w.columnId);return jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:w.title}),jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(A=>jsx("span",{className:"command-palette-item-label",children:A},A))})]},w.id)})})]}),k==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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:N,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:N,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:N,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 au(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:tt,className:m("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",S?"scrollbar-slim":"scrollbar-slim-light"),children:v.length>0?jsx("div",{className:"space-y-4",children:[...v].sort((P,Z)=>{let Ve=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt,We=typeof Z.createdAt=="string"?new Date(Z.createdAt):Z.createdAt;return Ve.getTime()-We.getTime()}).map(P=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:P.user?.color||"#8B5CF6"},children:P.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:m("text-sm font-medium",S?"text-white":"text-gray-900"),children:P.user?.name||(n==="es"?"Usuario":"User")}),jsx("span",{className:m("text-xs",S?"text-[#6B7280]":"text-gray-400"),children:ft(P.createdAt)})]}),jsx("div",{className:m("text-sm",S?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Tc,{content:P.content,theme:s})}),P.attachments&&P.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:P.attachments.map(Z=>{let Ve=Z.type.startsWith("image/");return jsxs("a",{href:Z.url,target:"_blank",rel:"noopener noreferrer",className:m("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",S?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Ve?jsx(Image,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:m("w-4 h-4",S?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:m("text-xs truncate max-w-[100px]",S?"text-white":"text-gray-900"),children:Z.name})]},Z.id)})})]})]},P.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:m("w-10 h-10 mb-3",S?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:m("text-sm",S?"text-[#6B7280]":"text-gray-500"),children:n==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:m("py-4 pl-4 pr-2 border-t",S?"border-white/10":"border-gray-200"),children:jsx(Cc,{value:ke,onChange:rt,onSubmit:Le,users:y,placeholder:n==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!k,isSubmitting:Se,theme:s,locale:n,currentUser:g,enableEmoji:true,enableAttachments:!!h,pendingFiles:X$1,onFilesSelect:U,onRemoveFile:ae})})]})]})]})})}function Fi(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function Yr({board:e,callbacks:t,onCardClick:a,renderProps:r,config:o,availableUsers:s=[],className:n,style:l,isLoading:u,error:i,children:c,availableTags:d=[],onCreateTag:p,attachmentsByCard:f,onUploadAttachments:v,onDeleteAttachment:k,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onTaskOpen:x,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:C,timeEntries:w,timerState:R,onLogTime:F,onUpdateEstimate:T,onUpdateSoldEffort:H,onStartTimer:A,onStopTimer:se,onDiscardTimer:S,blurFinancials:j=false}){let[ie,Ae]=Fi(),[L,ge]=useState(null),[ee,Ke]=useState(false),B=useRef(null),te=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),xe=o?.theme||"dark",fe=xe==="dark"||xe==="neutral",He=fe?"dark":"",ve=useCallback((J,I)=>{t.onCardUpdate?.(J,I);},[t]),_e=useCallback((J,I)=>{t.onColumnUpdate?.(J,{title:I});},[t]),re=useCallback(J=>{t.onColumnDelete?.(J);},[t]),V=["todo","in-progress","completed"],Y=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),me=useMemo(()=>{let J=new Map;return e.columns.forEach(I=>{let K=I.cardIds.map(le=>e.cards.find(De=>De.id===le)).filter(le=>le!==void 0).sort((le,De)=>le.position-De.position);J.set(I.id,K);}),J},[e.cards,e.columns]);useEffect(()=>{let J=B.current;if(!J)return;let I=je=>{let ot=je.target,ct=je.button===1,qe=ot===J||ot.classList.contains("asakaa-column")&&!ot.closest(".asakaa-card");(ct||je.button===0&&qe&&!ie.isDragging)&&(je.preventDefault(),Ke(true),te.current={x:je.clientX,y:je.clientY,scrollLeft:J.scrollLeft,scrollTop:J.scrollTop},J.style.cursor="grabbing",J.style.userSelect="none");},K=je=>{if(!ee)return;let ot=je.clientX-te.current.x,ct=je.clientY-te.current.y;J.scrollLeft=te.current.scrollLeft-ot,J.scrollTop=te.current.scrollTop-ct;},le=()=>{ee&&(Ke(false),J.style.cursor="",J.style.userSelect="");},De=()=>{ee&&(Ke(false),J.style.cursor="",J.style.userSelect="");};return J.addEventListener("mousedown",I),document.addEventListener("mousemove",K),document.addEventListener("mouseup",le),J.addEventListener("mouseleave",De),()=>{J.removeEventListener("mousedown",I),document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",le),J.removeEventListener("mouseleave",De);}},[ee,ie.isDragging]);let Te=useMemo(()=>e.cards.map(J=>({id:J.id,name:J.title,startDate:J.startDate?new Date(J.startDate):void 0,endDate:J.endDate?new Date(J.endDate):void 0,progress:J.progress||0,status:J.columnId,priority:J.priority?.toLowerCase(),dependencies:Array.isArray(J.dependencies)?J.dependencies.map(I=>typeof I=="string"?I:I.taskId):[]})),[e.cards]),Xe=useCallback(J=>{let{active:I}=J,K=e.cards.find(le=>le.id===I.id);K&&Ae({isDragging:true,draggedCardId:K.id,sourceColumnId:K.columnId,targetColumnId:K.columnId});},[e.cards,Ae]),z=useCallback(J=>{let{active:I,over:K}=J;if(!K||!e.cards.find(je=>je.id===I.id))return;let De=null;K.data.current?.type==="column"?De=K.id:K.data.current?.type==="card"&&(De=e.cards.find(ot=>ot.id===K.id)?.columnId||null),De&&De!==ie.targetColumnId&&Ae({...ie,targetColumnId:De});},[e.cards,ie,Ae]),Ne=useCallback(async J=>{let{active:I,over:K}=J;if(Ae({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!K)return;let le=e.cards.find(ct=>ct.id===I.id);if(!le)return;let De,je;if(K.data.current?.type==="column"){De=K.id;let ct=me.get(De)||[];je=mi(ct,0);}else {let ct=e.cards.find(G=>G.id===K.id);if(!ct)return;De=ct.columnId;let qe=me.get(De)||[],sa=qe.findIndex(G=>G.id===K.id);je=mi(qe,sa);}let ot=e.columns.find(ct=>ct.id===De);if(ot&&ot.wipLimit&&ot.wipLimitType==="hard"){let ct=me.get(De)||[];if(le.columnId!==De&&ct.length>=ot.wipLimit){t.onWipLimitExceeded?.(ot,le);return}}(le.columnId!==De||le.position!==je)&&await t.onCardMove?.(le.id,De,je);},[e.cards,e.columns,me,t,Ae]),Pe=useCallback(J=>{ge(J),a?.(J),x?.(J.id);},[a,x]),Fe=useCallback(J=>{t.onCardUpdate?.(J.id,J),ge(J);},[t]);return u?jsx("div",{className:m("asakaa-board",He,n),style:l,children:jsx(A0,{columnCount:3})}):i?jsx("div",{className:m("asakaa-board",He,n),style:l,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 i=="string"?i:i.message})]})})}):jsxs(Qd,{themeName:xe,children:[jsxs(DndContext,{sensors:Y,collisionDetection:closestCorners,onDragStart:Xe,onDragOver:z,onDragEnd:Ne,children:[jsxs("div",{ref:B,className:m("asakaa-board",He,n),style:{...l,cursor:ee?"grabbing":void 0},"data-theme":xe,children:[e.columns.sort((J,I)=>J.position-I.position).map(J=>{let I=me.get(J.id)||[],K=!V.includes(J.id);return jsx($o,{column:J,cards:I,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,onCardClick:Pe,onCardUpdate:ve,onColumnRename:_e,onColumnDelete:re,isDeletable:K,availableUsers:s,allCards:e.cards,enableVirtualization:o?.enableVirtualization,cardHeight:o?.cardHeight},J.id)}),c]}),jsx(DragOverlay,{children:ie.draggedCardId?jsx(Lr,{card:e.cards.find(J=>J.id===ie.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),jsx(Br,{task:L,isOpen:!!L,onClose:()=>ge(null),onCardUpdate:Fe,theme:fe?"dark":"light",locale:o?.locale==="es"?"es":"en",availableUsers:s,availableTags:d,onCreateTag:p,attachments:L?f?.get(L.id)||[]:[],onUploadAttachments:v,onDeleteAttachment:k,availableTasks:Te,comments:g,onAddComment:y,currentUser:h,mentionableUsers:b,onUploadCommentAttachments:D,enableTimeTracking:N,timeTrackingSummary:C,timeEntries:w,isTimerRunning:R?.isRunning,timerElapsedSeconds:R?.elapsedSeconds,onTimeLog:F,onEstimateUpdate:T,onSoldEffortUpdate:H,onTimerStart:A,onTimerStop:se,onTimerDiscard:S,blurFinancials:j})]})}function A0({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 O0={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)"},$0={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)"},z0={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},U0={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function H0({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:o}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let i=c=>{l.current&&!l.current.contains(c.target)&&n(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let u=i=>{t(i),n(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!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((i,c)=>i.position-c.position).map((i,c)=>jsxs(motion.button,{onClick:()=>u(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:c<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:c*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:i.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:i.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[i.cardIds.length," ",i.cardIds.length===1?"tarea":"tareas"]})]})]},i.id))]})})})]})}function W0({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:o}){let[s,n]=useState(false),[l,u]=useState(null),i=useRef(null);if(useEffect(()=>{let f=v=>{i.current&&!i.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[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(f=>f.handler),p=async(f,v)=>{if(v){u(f);try{await v();}catch(k){console.error(`Export ${f} failed:`,k);}finally{u(null),n(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>n(!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((f,v)=>jsxs(motion.button,{onClick:()=>p(f.id,f.handler),disabled:l!==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:l===f.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):f.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:f.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:f.description})]})]},f.id))})})})]})}function G0({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 Li({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:o="es",useColumnSelector:s=false,onExportCSV:n,onExportJSON:l,onExportExcel:u,translations:i}){let c=r==="dark"?O0:$0,d={...o==="es"?z0:U0,...i},p=n||l||u;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:c.bgGrid,borderColor:c.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[jsx(W0,{theme:c,t:d,onExportCSV:n,onExportJSON:l,onExportExcel:u}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:c.borderLight}})]}),t&&(s?jsx(H0,{columns:e,onSelect:t,theme:c,t:d,createTaskLabel:a}):jsx(G0,{onClick:()=>t(),label:a||d.newTask}))]})})}function Bi({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:o=false}){let[s,n]=useState(false),[l,u]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),u(""),n(false));},[l,e]),c=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(u(""),n(false));},[i]),d=useCallback(()=>{setTimeout(()=>{l.trim()||n(false);},150);},[l]);return s?jsx("div",{className:m("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:p=>u(p.target.value),onKeyDown:c,onBlur:d,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:i,disabled:!l.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:()=>{u(""),n(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:m("asakaa-add-column",t),children:jsxs("button",{onClick:()=>n(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 Ri({columnId:e,onAddCard:t,availableUsers:a=[],className:r,placeholder:o,buttonLabel:s,disabled:n=false,theme:l="dark",locale:u="es"}){let[i,c]=useState(false),[d,p]=useState(false),[f,v]=useState(""),[k,g]=useState([]),[y,h]=useState(""),[b,x]=useState(""),[D,N]=useState(""),[C,w]=useState(false),[R,F]=useState(false),[T,H]=useState(false),A=useRef(null),se=useRef(null),S={placeholder:o||(u==="es"?"Nombre de la tarea...":"Task Name..."),buttonLabel:s||(u==="es"?"Agregar Tarea":"Add Task"),save:u==="es"?"Guardar":"Save",addAssignee:u==="es"?"Agregar asignado":"Add assignee",addDates:u==="es"?"Agregar fechas":"Add dates",addPriority:u==="es"?"Agregar prioridad":"Add priority",startDate:u==="es"?"Inicio":"Start",endDate:u==="es"?"Fin":"End",low:u==="es"?"Baja":"Low",medium:u==="es"?"Media":"Medium",high:u==="es"?"Alta":"High",urgent:u==="es"?"Urgente":"Urgent"},j=useCallback(()=>{v(""),g([]),h(""),x(""),N(""),w(false),F(false),H(false),c(false);},[]);useEffect(()=>{i&&A.current&&A.current.focus();},[i]),useEffect(()=>{if(!i)return;let ee=Ke=>{se.current&&!se.current.contains(Ke.target)&&(f.trim()||j());};return document.addEventListener("mousedown",ee),()=>document.removeEventListener("mousedown",ee)},[i,f,j]);let ie=useCallback(async()=>{let ee=f.trim();if(!(!ee||d)){p(true);try{await t({name:ee,columnId:e,assigneeIds:k.length>0?k:void 0,startDate:y?new Date(y):void 0,endDate:b?new Date(b):void 0,priority:D||void 0}),v(""),g([]),h(""),x(""),N(""),w(!1),F(!1),H(!1),A.current?.focus();}catch(Ke){console.error("Error creating card:",Ke);}finally{p(false);}}},[f,e,k,y,b,D,t,d]),Ae=useCallback(ee=>{ee.key==="Enter"&&!ee.shiftKey?(ee.preventDefault(),ie()):ee.key==="Escape"&&j();},[ie,j]),L=useCallback(ee=>{g(Ke=>Ke.includes(ee)?Ke.filter(B=>B!==ee):[...Ke,ee]);},[]),ge=l==="dark";return i?jsxs("div",{ref:se,className:m("rounded-lg overflow-hidden shadow-lg",ge?"bg-[#1e1e2e]":"bg-white",r),style:{border:"2px solid #10b981"},children:[jsxs("div",{className:"p-3",children:[jsx("input",{ref:A,type:"text",value:f,onChange:ee=>v(ee.target.value),onKeyDown:Ae,placeholder:S.placeholder,disabled:d,className:m("w-full px-0 py-1 text-sm font-medium border-0 bg-transparent focus:outline-none focus:ring-0",ge?"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:()=>w(!C),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",C||k.length>0?"bg-emerald-500/20 text-emerald-400":ge?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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"})]}),k.length>0&&jsx("span",{className:"ml-0.5",children:k.length})]}),jsx("button",{onClick:()=>F(!R),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",R||y||b?"bg-blue-500/20 text-blue-400":ge?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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:()=>H(!T),className:m("flex items-center gap-1 px-2 py-1.5 rounded-md text-xs transition-colors",T||D?D==="urgent"?"bg-red-500/20 text-red-400":D==="high"?"bg-orange-500/20 text-orange-400":D==="medium"?"bg-yellow-500/20 text-yellow-400":D==="low"?"bg-green-500/20 text-green-400":"bg-orange-500/20 text-orange-400":ge?"text-gray-400 hover:bg-[#2a2a3e] hover:text-gray-300":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),type:"button",title:S.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:ie,disabled:!f.trim()||d,className:m("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"}):S.save})]})]}),C&&a.length>0&&jsx("div",{className:m("px-3 pb-3 pt-0","border-t",ge?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex flex-wrap gap-1.5 pt-3",children:a.map(ee=>jsxs("button",{onClick:()=>L(ee.id),className:m("flex items-center gap-1.5 px-2 py-1 rounded-full text-xs transition-all",k.includes(ee.id)?"bg-emerald-500 text-white":ge?"bg-[#2a2a3e] text-gray-300 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-700 hover:bg-gray-200"),type:"button",children:[ee.avatar?jsx("img",{src:ee.avatar,alt:ee.name,className:"w-4 h-4 rounded-full"}):jsx("div",{className:m("w-4 h-4 rounded-full flex items-center justify-center text-[10px] font-medium",k.includes(ee.id)?"bg-emerald-600 text-white":"bg-emerald-500 text-white"),children:ee.name.charAt(0).toUpperCase()}),jsx("span",{children:ee.name.split(" ")[0]})]},ee.id))})}),R&&jsx("div",{className:m("px-3 pb-3 pt-0","border-t",ge?"border-[#3a3a4e]":"border-gray-200"),children:jsxs("div",{className:"grid grid-cols-2 gap-2 pt-3",children:[jsxs("div",{children:[jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",ge?"text-gray-500":"text-gray-400"),children:S.startDate}),jsx("input",{type:"date",value:y,onChange:ee=>h(ee.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",ge?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]}),jsxs("div",{children:[jsx("label",{className:m("block text-[10px] uppercase tracking-wide mb-1",ge?"text-gray-500":"text-gray-400"),children:S.endDate}),jsx("input",{type:"date",value:b,onChange:ee=>x(ee.target.value),className:m("w-full px-2 py-1.5 rounded text-xs border",ge?"bg-[#2a2a3e] border-[#3a3a4e] text-gray-200":"bg-gray-50 border-gray-200 text-gray-800")})]})]})}),T&&jsx("div",{className:m("px-3 pb-3 pt-0","border-t",ge?"border-[#3a3a4e]":"border-gray-200"),children:jsx("div",{className:"flex gap-1.5 pt-3",children:["low","medium","high","urgent"].map(ee=>jsx("button",{onClick:()=>N(D===ee?"":ee),className:m("flex-1 px-2 py-1.5 rounded text-xs font-medium transition-all",D===ee?`${{low:"bg-green-500",medium:"bg-yellow-500",high:"bg-orange-500",urgent:"bg-red-500"}[ee]} text-white`:ge?"bg-[#2a2a3e] text-gray-400 hover:bg-[#3a3a4e]":"bg-gray-100 text-gray-600 hover:bg-gray-200"),type:"button",children:S[ee]},ee))})})]}):jsxs("button",{onClick:()=>c(true),disabled:n,className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg transition-all duration-200","text-emerald-500 hover:text-emerald-400",ge?"hover:bg-[#2a2a3e]":"hover:bg-gray-100",n&&"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:S.buttonLabel})]})}var hn=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(Yr,{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(`
|
|
19
|
+
`)}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(n=>{n?o(n):s(new Error("Failed to create PNG blob"));},"image/png");})}};function eu(e={}){return new hn(e)}var Wo=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(n){console.error("Error in error handler:",n);}}render(){let{hasError:a,error:r}=this.state,{children:o,fallback:s,componentName:n}=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:n?`Error in ${n}`:"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 Oi(e,t){let a=r=>jsx(Wo,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function zi({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:o,onAssignUser:s,onGeneratePlan:n,onPredictRisks:l,onOpenAIUsage:u,shortcut:i="k",className:c=""}){let[d,p]=useState(false),[f,v]=useState(""),[k,g]=useState("home"),[y,h]=useState(""),[b,x]=useState("");useEffect(()=>{let w=R=>{(R.metaKey||R.ctrlKey)&&R.key===i&&(R.preventDefault(),p(F=>!F)),R.key==="Escape"&&(p(false),g("home"),v(""));};return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[i]),useEffect(()=>{d||(g("home"),v(""),h(""),x(""));},[d]);let D=useCallback(()=>{p(false);},[]),N=useCallback(w=>{let[R,F]=w.split(":");switch(R){case "create-card":g("create-card");break;case "create-card-in":h(F||"");break;case "navigate":F?(a?.(F),D()):g("navigate");break;case "search":r?.(f),D();break;case "priority":g("priority");break;case "set-priority":b&&F&&(o?.(b,F),D());break;case "assign":g("assign");break;case "assign-user":b&&F&&(s?.(b,F),D());break;case "ai":g("ai");break;case "ai-generate-plan":n?.(),D();break;case "ai-predict-risks":l?.(),D();break;case "ai-usage":u?.(),D();break;case "back":g("home");break;}},[f,b,t,a,r,o,s,n,l,u,D]),C=useCallback(()=>{y&&f.trim()&&(t?.(y,f.trim()),D());},[y,f,t,D]);return d?jsx(wt,{children:jsx("div",{className:"command-palette-overlay",onClick:D,children:jsx("div",{className:`command-palette ${c}`,onClick:w=>w.stopPropagation(),children:jsxs(Command,{value:f,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:k==="create-card"&&y?"Type card title and press Enter...":k==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:w=>{w.key==="Enter"&&k==="create-card"&&y&&C();}}),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."}),k==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:N,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:N,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:N,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:N,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(w=>jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:w.title}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(R=>jsx("span",{className:"command-palette-item-label",children:R},R))})]},w.id))})]}),k==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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(w=>jsxs(Command.Item,{value:`create-card-in:${w.id}`,onSelect:N,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:w.title}),jsxs("div",{className:"command-palette-item-count",children:[w.cardIds.length," cards"]})]},w.id))})]}),k==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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(w=>{let R=e.columns.find(F=>F.id===w.columnId);return jsxs(Command.Item,{value:`navigate:${w.id}`,onSelect:N,className:"command-palette-item",keywords:[w.title,w.description||"",...w.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:w.priority==="URGENT"?"#EF4444":w.priority==="HIGH"?"#F59E0B":w.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:w.title}),jsx("div",{className:"command-palette-item-meta",children:R?.title})]}),w.labels&&w.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:w.labels.slice(0,2).map(F=>jsx("span",{className:"command-palette-item-label",children:F},F))})]},w.id)})})]}),k==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:N,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:N,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:N,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:N,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 ru(e,t,a,r,o){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let n=document.createElement("div");n.id="attachment-lightbox-native",n.className="attachment-lightbox",n.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=v=>{v.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(d),n.appendChild(p),n.appendChild(f);}n.appendChild(l),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function q0(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 X0(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 $i(e){return e.startsWith("image/")}function Er({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[u,i]=useState(false),[c,d]=useState(null),p=useRef(null),f=useRef(e);f.current=e;let v=useCallback((w,R)=>{R.preventDefault(),R.stopPropagation();let A=f.current.filter(L=>$i(L.type)),T=A.findIndex(L=>L.id===w.id),H=L=>{let ne=f.current.filter(V=>$i(V.type)),S=ne[L];S&&au(S.url,S.name,ne,L,H);};au(w.url,w.name,A,T,H);},[]),k=useCallback(w=>{let R=[],A=[];return e.length+w.length>s?(A.push(`Maximum ${s} files allowed`),{valid:R,errors:A}):(w.forEach(T=>{if(T.size/1048576>r){A.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(L=>T.type.match(L))){A.push(`${T.name} has invalid file type`);return}R.push(T);}),{valid:R,errors:A})},[e.length,s,r,o]),g=useCallback(async w=>{let{valid:R,errors:A}=k(w);if(A.length>0){d(A.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(T){d(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[k,t]),y=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(true);},[]),h=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);},[]),b=useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);let R=Array.from(w.dataTransfer.files);g(R);},[g]),D=useCallback(w=>{let R=w.target.files?Array.from(w.target.files):[];g(R),p.current&&(p.current.value="");},[g]),N=useCallback(()=>{p.current?.click();},[]),C=useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:b,onDrop:x,onClick:N,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:u?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:n?"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"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(w=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:$i(w.type)&&w.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>v(w,R),title:"Click to view full size",children:[jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:X0(w.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:q0(w.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>C(w.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"})})})]},w.id))})]})}function zi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:u=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:f,onSuggestAssignee:v,onGenerateSubtasks:k,onEstimateEffort:g,currentUserId:y="user-1"}){let[h,b]=useState("details"),[x,D]=useState(false),[N,C]=useState({}),[w,R]=useState(""),[A,T]=useState(false),[H,L]=useState({});if(!t||!e)return null;let ne=useCallback(()=>{D(false),C({}),b("details"),R(""),L({}),a();},[a]),S=useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),C({}),D(false));},[e.id,N,r]),V=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),ne());},[e.id,o,ne]),ie=useCallback(()=>{c&&w.trim()&&(c(e.id,w.trim()),R(""));},[e.id,w,c]),Me=useCallback(async()=>{if(v){T(true);try{let B=await v(e);L(X=>({...X,assignees:B}));}catch(B){console.error("Failed to suggest assignee:",B);}finally{T(false);}}},[e,v]),F=useCallback(async()=>{if(k){T(true);try{let B=await k(e);L(X=>({...X,subtasks:B}));}catch(B){console.error("Failed to generate subtasks:",B);}finally{T(false);}}},[e,k]),ye=useCallback(async()=>{if(g){T(true);try{let B=await g(e);L(X=>({...X,effort:B}));}catch(B){console.error("Failed to estimate effort:",B);}finally{T(false);}}},[e,g]),Q={...e,...N},te=s.filter(B=>Q.assignedUserIds?.includes(B.id));return jsx(kt,{children:jsx("div",{className:"card-detail-overlay",onClick:ne,children:jsxs("div",{className:"card-detail-modal",onClick:B=>B.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:Q.priority==="URGENT"?"#EF4444":Q.priority==="HIGH"?"#F59E0B":Q.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsx("input",{type:"text",value:N.title??Q.title,onChange:B=>C({...N,title:B.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:Q.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{D(false),C({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>D(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:V,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:ne,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:()=>b("details"),className:`card-detail-tab ${h==="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:()=>b("comments"),className:`card-detail-tab ${h==="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",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="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",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="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",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="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:[h==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:N.description??Q.description??"",onChange:B=>C({...N,description:B.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:Q.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:N.assignedUserIds??Q.assignedUserIds??[],onChange:B=>{let X=Array.from(B.target.selectedOptions,me=>me.value);C({...N,assignedUserIds:X});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(B=>jsx("option",{value:B.id,children:B.name},B.id))}):jsx("div",{className:"card-detail-users",children:te.length>0?te.map(B=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:B.color},children:B.initials}),jsx("span",{children:B.name})]},B.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:N.priority??Q.priority??"",onChange:B=>C({...N,priority:B.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:Q.priority==="URGENT"?"#EF4444":Q.priority==="HIGH"?"#F59E0B":Q.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:Q.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:Q.labels&&Q.labels.length>0?Q.labels.map(B=>jsx("span",{className:"card-detail-label-tag",children:B},B)):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"}),x?jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:Q.startDate?new Date(Q.startDate).toISOString().split("T")[0]:"",onChange:B=>C({...N,startDate:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:Q.startDate?new Date(Q.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:Q.endDate?new Date(Q.endDate).toISOString().split("T")[0]:"",onChange:B=>C({...N,endDate:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:Q.endDate?new Date(Q.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??Q.estimatedTime??"",onChange:B=>C({...N,estimatedTime:B.target.value?parseFloat(B.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:Q.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:Q.dependencies&&Q.dependencies.length>0?Q.dependencies.map(B=>{let X=typeof B=="string"?B:B.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",X.slice(-4)]},X)}):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:Q.createdAt?new Date(Q.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:w,onChange:B=>R(B.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ie,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(B=>{let X=s.find(me=>me.id===B.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:[X&&jsx("div",{className:"card-detail-user-avatar",style:{background:X.color},children:X.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:X?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(B.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(B.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:B.content})]},B.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"})]})})]}),h==="activity"&&jsx("div",{className:"card-detail-activity",children:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(B=>{let X=s.find(me=>me.id===B.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[B.type.includes("CREATED")&&"\u2795",B.type.includes("UPDATED")&&"\u270F\uFE0F",B.type.includes("MOVED")&&"\u27A1\uFE0F",B.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",B.type.includes("COMMENT")&&"\u{1F4AC}",B.type.includes("ASSIGNED")&&"\u{1F464}",B.type.includes("PRIORITY")&&"\u{1F3AF}",B.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",B.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:X?.name||"Unknown"})," ",B.type.replace(/_/g," ").toLowerCase(),B.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:B.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(B.timestamp).toLocaleString()})]})]},B.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"})]})}),h==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Er,{cardId:e.id,attachments:i,onUpload:p?B=>p(e.id,B):void 0,onDelete:f,currentUserId:y,maxSizeMB:10,maxFiles:20})}),h==="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:A||!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:F,disabled:A||!k,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:ye,disabled:A||!g,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"]})]}),H.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((B,X)=>{let me=s.find(fe=>fe.id===B.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[me&&jsx("div",{className:"card-detail-user-avatar",style:{background:me.color},children:me.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:me?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:B.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(B.confidence*100).toFixed(0),"%"]})]})]},X)})]}),H.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((B,X)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:B.title}),B.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:B.description}),B.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",B.estimatedTime,"h"]})]},X))]}),H.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:[H.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),u.map(B=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${B.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:B.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:B.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:B.description}),B.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",B.suggestedAction]})]},B.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&u.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 bn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,u]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,f=window.innerWidth,v=4,k=d.left;k+o>f-10&&(k=f-o-10),k<10&&(k=10);let g=p-d.bottom,y=d.top,h;return g>=s+v?h=d.bottom+v:y>=s+v?h=d.top-s-v:g>=y?h=d.bottom+v:h=Math.max(10,d.top-s-v),{top:h,left:k}},[e,o,s]);return useEffect(()=>{t&&u(c());},[t,c]),useEffect(()=>{if(!t)return;let d=f=>{let v=f.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(kt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.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 st={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:"#9CA3AF",dependencyHover:"#60A5FA",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 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:"#6B7280",dependencyHover:"#3B82F6",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#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:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var oh=["LOW","MEDIUM","HIGH","URGENT"],nh=["todo","in-progress","review","done"];function Wi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:u,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:f,availableColumns:v=[],availableLabels:k=[],availableTags:g=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:b,theme:x,onSubtasksChange:D,attachments:N=[],onUploadAttachments:C,onDeleteAttachment:w}){let R=Io(),A=x||R?.themeName||"dark",[T,H]=useState(e),[L,ne]=useState(false),[S,V]=useState(()=>[...e?.subtasks||[]].sort((ee,Fe)=>(ee.position??0)-(Fe.position??0))),[ie,Me]=useState(false),[F,ye]=useState(""),[Q,te]=useState(""),[B,X]=useState("all"),[me,fe]=useState(false),[Ge,be]=useState(false),[Ve,re]=useState(false),[_,q]=useState(false),[ge,De]=useState(false),[qe,Se]=useState(false),ot=useRef(null),We=useRef(null),Qe=useRef(null),ae=useRef(null),I=useRef(null),j=useRef(null),le=useRef(null),Te=useRef(null),_e=useRef(null),rt=useRef(null),ct=useRef(null),je=useRef(null);useEffect(()=>{if(e&&!T){H({...e});let z=[...e.subtasks||[]].sort((ee,Fe)=>(ee.position??0)-(Fe.position??0));V(z);}else if(e&&T&&e.id!==T.id){H({...e});let z=[...e.subtasks||[]].sort((ee,Fe)=>(ee.position??0)-(Fe.position??0));V(z);}},[e,T]),useEffect(()=>{let z=ee=>{let Fe=ee.target;ae.current&&!ae.current.contains(Fe)&&fe(false),I.current&&!I.current.contains(Fe)&&be(false),j.current&&!j.current.contains(Fe)&&re(false),le.current&&!le.current.contains(Fe)&&q(false);};if(me||Ge||Ve||_)return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[me,Ge,Ve,_]),useEffect(()=>{if(!t)return;let z=ee=>{let Fe=ee.target,dt=Fe.tagName==="INPUT"||Fe.tagName==="TEXTAREA"||Fe.isContentEditable;if(ee.key==="Escape"){ee.preventDefault(),me||Ge||Ve||_||ge||qe?(fe(false),be(false),re(false),q(false),De(false),Se(false)):dt||a();return}if(dt&&ee.key!=="Escape")return;let Xe=ee.metaKey||ee.ctrlKey;switch(ee.key.toLowerCase()){case "s":ee.preventDefault(),fe(true);break;case "a":ee.preventDefault(),re(true);break;case "p":ee.preventDefault(),be(true);break;case "l":ee.preventDefault(),q(true);break;case "d":Xe||(ee.preventDefault(),De(true),setTimeout(()=>Te.current?.focus(),0));break;case "e":Xe||(ee.preventDefault(),Se(true));break;case "i":ee.preventDefault(),ne(true),setTimeout(()=>We.current?.focus(),0);break;case "t":ee.preventDefault(),Me(true);break;case "c":ee.preventDefault(),Qe.current?.focus();break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[t,a,me,Ge,Ve,_,ge,qe]);let sa=useCallback(z=>{let ee=z.currentTarget.textContent?.trim()||"";if(T&&ee!==T.title){let Fe={...T,title:ee};H(Fe),r?.(T.id,{title:ee});}},[T,r]),W=useCallback(z=>{z.key==="Enter"&&(z.preventDefault(),z.currentTarget.blur()),z.key==="Escape"&&(z.preventDefault(),z.currentTarget.textContent=T?.title||"",z.currentTarget.blur());},[T]),K=useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),ne(false);},[T,e,r]),ke=useCallback(z=>{if(T){let ee={...T,columnId:z};H(ee),r?.(T.id,{columnId:z}),fe(false);}},[T,r]),at=useCallback(z=>{if(T){let ee={...T,priority:z};H(ee),r?.(T.id,{priority:z}),be(false);}},[T,r]),Ne=useCallback(z=>{if(T){let ee=T.assignedUserIds||[],Fe=ee.includes(z)?ee.filter(Xe=>Xe!==z):[...ee,z],dt={...T,assignedUserIds:Fe};H(dt),r?.(T.id,{assignedUserIds:Fe});}},[T,r]),Ie=useCallback(z=>{if(T){let ee=T.labels||[],Fe=ee.includes(z)?ee.filter(Xe=>Xe!==z):[...ee,z],dt={...T,labels:Fe};H(dt),r?.(T.id,{labels:Fe});}},[T,r]),Y=useCallback(z=>{if(T){let ee={...T,tags:z};H(ee),r?.(T.id,{tags:z});}},[T,r]),Ke=useCallback(z=>{if(T){let ee=z.target.value,Fe={...T,endDate:ee};H(Fe),r?.(T.id,{endDate:ee}),De(false);}},[T,r]),$=useCallback(z=>{if(T){let ee={...T,estimatedTime:parseFloat(z)||0};H(ee),r?.(T.id,{estimatedTime:parseFloat(z)||0});}},[T,r]),de=useCallback(()=>{if(F.trim()&&T){let z={id:`subtask-${Date.now()}`,title:F.trim(),completed:false,position:S.length,createdAt:new Date},ee=[...S,z];V(ee),ye(""),Me(false),D?.(T.id,ee);}},[F,S,T,D]),Be=useCallback(z=>{let ee=S.map(Fe=>Fe.id===z?{...Fe,completed:!Fe.completed,updatedAt:new Date}:Fe);V(ee),T&&D?.(T.id,ee);},[S,T,D]),Ze=useCallback(z=>{let ee=S.filter(Fe=>Fe.id!==z);V(ee),T&&D?.(T.id,ee);},[S,T,D]),et=useCallback(()=>{Q.trim()&&T&&u&&(u(T.id,Q.trim()),te(""));},[Q,T,u]),Ue=useCallback(z=>{(z.metaKey||z.ctrlKey)&&z.key==="Enter"&&(z.preventDefault(),et());},[et]),ve=z=>jsx(th,{remarkPlugins:[ah],rehypePlugins:[rh],components:{a:({node:ee,...Fe})=>jsx("a",{...Fe,target:"_blank",rel:"noopener noreferrer"})},children:z}),$e=l.filter(z=>B==="comments"?z.type.includes("COMMENT"):B==="history"?!z.type.includes("COMMENT"):true);if(!t||!e)return null;let U=T||e,ce=s.filter(z=>U.assignedUserIds?.includes(z.id)),yt=S.filter(z=>z.completed).length;return jsx(kt,{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:z=>z.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":A,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:ot,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:sa,onKeyDown:W,children:U.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:ae,children:[jsxs("button",{ref:_e,className:"modal-v2-field",onClick:()=>fe(!me),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:U.columnId||"No status"})]}),jsx(bn,{triggerRef:_e,isOpen:me,onClose:()=>fe(false),width:250,estimatedHeight:200,children:(v.length>0?v:nh.map(z=>({id:z,title:z}))).map(z=>jsx("button",{className:`modal-v2-popover-item ${U.columnId===z.id?"active":""}`,onClick:()=>ke(z.id),children:z.title},z.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:j,children:[jsxs("button",{ref:rt,className:"modal-v2-field",onClick:()=>re(!Ve),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:ce.length>0?jsx("div",{className:"modal-v2-avatars",children:ce.map(z=>jsx("div",{className:"modal-v2-avatar",style:{background:z.color},title:z.name,children:z.initials},z.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(bn,{triggerRef:rt,isOpen:Ve,onClose:()=>re(false),width:280,estimatedHeight:300,children:s.map(z=>jsxs("button",{className:`modal-v2-popover-item ${U.assignedUserIds?.includes(z.id)?"active":""}`,onClick:()=>Ne(z.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:z.color},children:z.initials}),z.name,U.assignedUserIds?.includes(z.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"})})]},z.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:I,children:[jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>be(!Ge),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:U.priority||"None"})]}),jsxs(bn,{triggerRef:ct,isOpen:Ge,onClose:()=>be(false),width:180,estimatedHeight:220,children:[oh.map(z=>jsx("button",{className:`modal-v2-popover-item priority-${z.toLowerCase()} ${U.priority===z?"active":""}`,onClick:()=>at(z),children:z},z)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>at(""),children:"None"})]})]}),g.length>0||y?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(jr,{selectedTags:U.tags||[],availableTags:g,onChange:Y,onCreateTag:y,theme:st[A]||st.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:le,children:[jsxs("button",{ref:je,className:"modal-v2-field",onClick:()=>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:U.labels&&U.labels.length>0?jsx("span",{children:U.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(bn,{triggerRef:je,isOpen:_,onClose:()=>q(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(z=>jsxs("button",{className:`modal-v2-popover-item ${U.labels?.includes(z)?"active":""}`,onClick:()=>Ie(z),children:[z,U.labels?.includes(z)&&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"})})]},z))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{De(!ge),setTimeout(()=>Te.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:U.endDate?new Date(U.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:Te,type:"date",value:typeof U.endDate=="string"?U.endDate.split("T")[0]:U.endDate?(()=>{let z=new Date(U.endDate),ee=z.getUTCFullYear(),Fe=String(z.getUTCMonth()+1).padStart(2,"0"),dt=String(z.getUTCDate()).padStart(2,"0");return `${ee}-${Fe}-${dt}`})():"",onChange:Ke,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Se(!qe),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:U.estimatedTime?`${U.estimatedTime}h`:"Not set"})]}),qe&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:U.estimatedTime||"",onChange:z=>$(z.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Se(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"})]}),L?jsx("textarea",{className:"modal-v2-textarea",value:U.description||"",onChange:z=>{if(T){let ee={...T,description:z.target.value};H(ee);}},onBlur:K,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>ne(true),children:U.description?jsx("div",{className:"modal-v2-markdown",children:ve(U.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"}),S.length>0&&jsxs("span",{className:"modal-v2-count",children:[yt,"/",S.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Me(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:[S.map(z=>jsxs("div",{className:`modal-v2-subtask ${z.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Be(z.id),children:z.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:z.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>Ze(z.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"})]})})]},z.id)),ie&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:F,onChange:z=>ye(z.target.value),onKeyDown:z=>{z.key==="Enter"&&de(),z.key==="Escape"&&(Me(false),ye(""));},onBlur:de,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(C||N.length>0)&&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.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("h2",{children:"Attachments"}),N.length>0&&jsx("span",{className:"modal-v2-count",children:N.length})]}),jsx(Er,{cardId:U.id,attachments:N,onUpload:C?z=>C(U.id,z):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),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:()=>X("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${B==="comments"?"active":""}`,onClick:()=>X("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${B==="history"?"active":""}`,onClick:()=>X("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Qe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Q,onChange:z=>te(z.target.value),onKeyDown:Ue,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:et,disabled:!Q.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[$e.map(z=>{let ee=s.find(dt=>dt.id===z.userId);if(z.type.includes("COMMENT")){let dt=n.find(Xe=>Xe.id===z.metadata?.commentId);return dt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ee&&jsx("div",{className:"modal-v2-avatar",style:{background:ee.color},children:ee.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:ee?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:dt.content})]})]},z.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[z.type.includes("CREATED")&&"\u2795",z.type.includes("UPDATED")&&"\u270F\uFE0F",z.type.includes("MOVED")&&"\u27A1\uFE0F",z.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.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:ee?.name||"Unknown"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:z.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.id)}),$e.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function gh({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 Vi({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,u)=>l+u.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(gh,{})}),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((n,l)=>n+l.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((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.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((n,l)=>n+(l.planned||0),0)})]})]})]})}function Ch({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 _i({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=l;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(Ch,{})}),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:i?"#10B981":"#EF4444",fill:i?"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:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#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:u>=50?"#10B981":"#F59E0B"},children:[u.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ah={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},uu=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Lh({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:u,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function mu({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 ji({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||Ah[u.name]||uu[e.indexOf(u)%uu.length]})),l=n.map(u=>u.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:n,cx:"50%",cy:"50%",labelLine:false,label:o?Lh:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(mu,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${u} (${c.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,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(mu,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((u,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var ps=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[u,i]=useState(false),[c,d]=useState(false),[p,f]=useState(false);if(e.length===0)return null;let v=e.map(x=>x.id),k=x=>{r.onBulkUpdate?.(v,{priority:x}),l(false);},g=x=>{r.onBulkMove?.(v,x),i(false),a();},y=x=>{r.onBulkUpdate?.(v,{assignedUserIds:x}),d(false);},h=x=>{let D=new Set;e.forEach(C=>{C.labels?.forEach(w=>D.add(w));});let N=Array.from(new Set([...D,...x]));r.onBulkUpdate?.(v,{labels:N}),f(false);},b=()=>{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:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(x),children:[jsx("span",{className:m("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x.id),children:x.title},x.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,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"})})]})]})})});ps.displayName="BulkOperationsToolbar";function $h(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,u,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(f=>{let v=a?.find(k=>k.id===f);n=`assignee-${f}`,l=v?.name||`User ${f}`,u=v?.color,i=v?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={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];l=p.title,u=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Ki({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>$h(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(Yr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:m("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),p={...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&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Yr,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.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 Yi=[{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 qi({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=Yi.find(i=>i.value===e)||Yi[0];useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxs("div",{className:m("relative inline-block",a),children:[jsxs("button",{ref:n,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:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:m("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:Yi.map(i=>jsxs("button",{onClick:()=>u(i.value),className:m("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.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:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var yn=[{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 Hh(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&l&&u}function bu(e={}){let{shortcuts:t=yn,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(u=>{o.current=[...o.current,u];},[]),l=useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return useEffect(()=>{function u(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Hh(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Gh(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Vh(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 _h(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Vh(e),r=t?Gh(t):"";return a?`${a} + ${r}`:r}function jh(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 Xi({shortcuts:e=yn,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=jh(e);return jsxs("div",{className:m("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","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(n).map(([l,u])=>u.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:u.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:_h(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Ji=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,f.onmouseenter=()=>{f.style.opacity="1";},f.onmouseleave=()=>{f.style.opacity="0.5";},f.onclick=v=>{v.stopPropagation();let k=r<a.length-1?r+1:0;i(),o(k);},n.appendChild(d),n.appendChild(p),n.appendChild(f);}n.appendChild(l),n.appendChild(u),document.body.appendChild(n),setTimeout(()=>{u.style.transition="opacity 0.5s ease",u.style.opacity="0";},2e3);}function Y0(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 X0(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 Hi(e){return e.startsWith("image/")}function Er({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:o,maxFiles:s=10}){let[n,l]=useState(false),[u,i]=useState(false),[c,d]=useState(null),p=useRef(null),f=useRef(e);f.current=e;let v=useCallback((w,R)=>{R.preventDefault(),R.stopPropagation();let F=f.current.filter(A=>Hi(A.type)),T=F.findIndex(A=>A.id===w.id),H=A=>{let se=f.current.filter(j=>Hi(j.type)),S=se[A];S&&ru(S.url,S.name,se,A,H);};ru(w.url,w.name,F,T,H);},[]),k=useCallback(w=>{let R=[],F=[];return e.length+w.length>s?(F.push(`Maximum ${s} files allowed`),{valid:R,errors:F}):(w.forEach(T=>{if(T.size/1048576>r){F.push(`${T.name} is too large (max ${r}MB)`);return}if(o&&!o.some(A=>T.type.match(A))){F.push(`${T.name} has invalid file type`);return}R.push(T);}),{valid:R,errors:F})},[e.length,s,r,o]),g=useCallback(async w=>{let{valid:R,errors:F}=k(w);if(F.length>0){d(F.join(", ")),setTimeout(()=>d(null),5e3);return}if(R.length!==0){i(true),d(null);try{await t?.(R);}catch(T){d(T instanceof Error?T.message:"Upload failed"),setTimeout(()=>d(null),5e3);}finally{i(false);}}},[k,t]),y=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(true);},[]),h=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);},[]),b=useCallback(w=>{w.preventDefault(),w.stopPropagation();},[]),x=useCallback(w=>{w.preventDefault(),w.stopPropagation(),l(false);let R=Array.from(w.dataTransfer.files);g(R);},[g]),D=useCallback(w=>{let R=w.target.files?Array.from(w.target.files):[];g(R),p.current&&(p.current.value="");},[g]),N=useCallback(()=>{p.current?.click();},[]),C=useCallback(w=>{confirm("Are you sure you want to delete this attachment?")&&a?.(w);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${n?"dragging":""} ${u?"uploading":""}`,onDragEnter:y,onDragLeave:h,onDragOver:b,onDrop:x,onClick:N,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:D,style:{display:"none"},accept:o?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:u?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:n?"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"]})]})})]}),c&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:c})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(w=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Hi(w.type)&&w.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:R=>v(w,R),title:"Click to view full size",children:[jsx("img",{src:w.thumbnailUrl||w.url,alt:w.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:X0(w.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:w.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:w.name,children:w.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Y0(w.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(w.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>C(w.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"})})})]},w.id))})]})}function Wi({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],aiInsights:u=[],attachments:i=[],onAddComment:c,onDeleteComment:d,onUploadAttachments:p,onDeleteAttachment:f,onSuggestAssignee:v,onGenerateSubtasks:k,onEstimateEffort:g,currentUserId:y="user-1"}){let[h,b]=useState("details"),[x,D]=useState(false),[N,C]=useState({}),[w,R]=useState(""),[F,T]=useState(false),[H,A]=useState({});if(!t||!e)return null;let se=useCallback(()=>{D(false),C({}),b("details"),R(""),A({}),a();},[a]),S=useCallback(()=>{r&&Object.keys(N).length>0&&(r(e.id,N),C({}),D(false));},[e.id,N,r]),j=useCallback(()=>{o&&window.confirm("Are you sure you want to delete this card?")&&(o(e.id),se());},[e.id,o,se]),ie=useCallback(()=>{c&&w.trim()&&(c(e.id,w.trim()),R(""));},[e.id,w,c]),Ae=useCallback(async()=>{if(v){T(true);try{let B=await v(e);A(te=>({...te,assignees:B}));}catch(B){console.error("Failed to suggest assignee:",B);}finally{T(false);}}},[e,v]),L=useCallback(async()=>{if(k){T(true);try{let B=await k(e);A(te=>({...te,subtasks:B}));}catch(B){console.error("Failed to generate subtasks:",B);}finally{T(false);}}},[e,k]),ge=useCallback(async()=>{if(g){T(true);try{let B=await g(e);A(te=>({...te,effort:B}));}catch(B){console.error("Failed to estimate effort:",B);}finally{T(false);}}},[e,g]),ee={...e,...N},Ke=s.filter(B=>ee.assignedUserIds?.includes(B.id));return jsx(wt,{children:jsx("div",{className:"card-detail-overlay",onClick:se,children:jsxs("div",{className:"card-detail-modal",onClick:B=>B.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:ee.priority==="URGENT"?"#EF4444":ee.priority==="HIGH"?"#F59E0B":ee.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),x?jsx("input",{type:"text",value:N.title??ee.title,onChange:B=>C({...N,title:B.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:ee.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[x?jsxs(Fragment,{children:[jsx("button",{onClick:S,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{D(false),C({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>D(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:j,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:se,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:()=>b("details"),className:`card-detail-tab ${h==="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:()=>b("comments"),className:`card-detail-tab ${h==="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",n.length>0&&jsx("span",{className:"card-detail-tab-badge",children:n.length})]}),jsxs("button",{onClick:()=>b("activity"),className:`card-detail-tab ${h==="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",l.length>0&&jsx("span",{className:"card-detail-tab-badge",children:l.length})]}),jsxs("button",{onClick:()=>b("attachments"),className:`card-detail-tab ${h==="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",i.length>0&&jsx("span",{className:"card-detail-tab-badge",children:i.length})]}),jsxs("button",{onClick:()=>b("ai"),className:`card-detail-tab ${h==="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:[h==="details"&&jsxs("div",{className:"card-detail-details",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Description"}),x?jsx("textarea",{value:N.description??ee.description??"",onChange:B=>C({...N,description:B.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:ee.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),x?jsx("select",{multiple:true,value:N.assignedUserIds??ee.assignedUserIds??[],onChange:B=>{let te=Array.from(B.target.selectedOptions,xe=>xe.value);C({...N,assignedUserIds:te});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(B=>jsx("option",{value:B.id,children:B.name},B.id))}):jsx("div",{className:"card-detail-users",children:Ke.length>0?Ke.map(B=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:B.color},children:B.initials}),jsx("span",{children:B.name})]},B.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),x?jsxs("select",{value:N.priority??ee.priority??"",onChange:B=>C({...N,priority:B.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:ee.priority==="URGENT"?"#EF4444":ee.priority==="HIGH"?"#F59E0B":ee.priority==="MEDIUM"?"#3B82F6":"#6B7280"}}),jsx("span",{children:ee.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:ee.labels&&ee.labels.length>0?ee.labels.map(B=>jsx("span",{className:"card-detail-label-tag",children:B},B)):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"}),x?jsx("input",{type:"date",value:N.startDate?new Date(N.startDate).toISOString().split("T")[0]:ee.startDate?new Date(ee.startDate).toISOString().split("T")[0]:"",onChange:B=>C({...N,startDate:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:ee.startDate?new Date(ee.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),x?jsx("input",{type:"date",value:N.endDate?new Date(N.endDate).toISOString().split("T")[0]:ee.endDate?new Date(ee.endDate).toISOString().split("T")[0]:"",onChange:B=>C({...N,endDate:B.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:ee.endDate?new Date(ee.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),x?jsx("input",{type:"number",min:"0",step:"0.5",value:N.estimatedTime??ee.estimatedTime??"",onChange:B=>C({...N,estimatedTime:B.target.value?parseFloat(B.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:ee.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:ee.dependencies&&ee.dependencies.length>0?ee.dependencies.map(B=>{let te=typeof B=="string"?B:B.taskId;return jsxs("span",{className:"card-detail-dependency",children:["Card #",te.slice(-4)]},te)}):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:ee.createdAt?new Date(ee.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:w,onChange:B=>R(B.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:ie,disabled:!w.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:n.length>0?n.map(B=>{let te=s.find(xe=>xe.id===B.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:[te&&jsx("div",{className:"card-detail-user-avatar",style:{background:te.color},children:te.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-comment-author-name",children:te?.name||"Unknown"}),jsx("div",{className:"card-detail-comment-time",children:new Date(B.createdAt).toLocaleString()})]})]}),d&&jsx("button",{onClick:()=>d(B.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:B.content})]},B.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"})]})})]}),h==="activity"&&jsx("div",{className:"card-detail-activity",children:l.length>0?jsx("div",{className:"card-detail-activity-list",children:l.map(B=>{let te=s.find(xe=>xe.id===B.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[B.type.includes("CREATED")&&"\u2795",B.type.includes("UPDATED")&&"\u270F\uFE0F",B.type.includes("MOVED")&&"\u27A1\uFE0F",B.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",B.type.includes("COMMENT")&&"\u{1F4AC}",B.type.includes("ASSIGNED")&&"\u{1F464}",B.type.includes("PRIORITY")&&"\u{1F3AF}",B.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",B.type.includes("ATTACHMENT")&&"\u{1F4CE}"]}),jsxs("div",{className:"card-detail-activity-content",children:[jsxs("div",{className:"card-detail-activity-text",children:[jsx("strong",{children:te?.name||"Unknown"})," ",B.type.replace(/_/g," ").toLowerCase(),B.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:B.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(B.timestamp).toLocaleString()})]})]},B.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"})]})}),h==="attachments"&&jsx("div",{className:"card-detail-attachments",children:jsx(Er,{cardId:e.id,attachments:i,onUpload:p?B=>p(e.id,B):void 0,onDelete:f,currentUserId:y,maxSizeMB:10,maxFiles:20})}),h==="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:Ae,disabled:F||!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:L,disabled:F||!k,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:ge,disabled:F||!g,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"]})]}),H.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),H.assignees.map((B,te)=>{let xe=s.find(fe=>fe.id===B.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[xe&&jsx("div",{className:"card-detail-user-avatar",style:{background:xe.color},children:xe.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:xe?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:B.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(B.confidence*100).toFixed(0),"%"]})]})]},te)})]}),H.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),H.subtasks.map((B,te)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:B.title}),B.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:B.description}),B.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",B.estimatedTime,"h"]})]},te))]}),H.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:[H.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(H.effort.confidence*100).toFixed(0),"%"]})]})]}),u.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),u.map(B=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${B.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:B.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:B.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:B.description}),B.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",B.suggestedAction]})]},B.id))]}),!H.assignees&&!H.subtasks&&!H.effort&&u.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 yn({triggerRef:e,isOpen:t,onClose:a,children:r,width:o=200,estimatedHeight:s=300,className:n=""}){let[l,u]=useState({top:0,left:0}),i=useRef(null),c=useCallback(()=>{if(!e.current)return {top:0,left:0};let d=e.current.getBoundingClientRect(),p=window.innerHeight,f=window.innerWidth,v=4,k=d.left;k+o>f-10&&(k=f-o-10),k<10&&(k=10);let g=p-d.bottom,y=d.top,h;return g>=s+v?h=d.bottom+v:y>=s+v?h=d.top-s-v:g>=y?h=d.bottom+v:h=Math.max(10,d.top-s-v),{top:h,left:k}},[e,o,s]);return useEffect(()=>{t&&u(c());},[t,c]),useEffect(()=>{if(!t)return;let d=f=>{let v=f.target;i.current&&!i.current.contains(v)&&e.current&&!e.current.contains(v)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",d);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",d);}},[t,a,e]),useEffect(()=>{if(!t)return;let d=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t,a]),t?jsx(wt,{children:jsx("div",{ref:i,className:`smart-popover ${n}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.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 st={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:"#9CA3AF",dependencyHover:"#60A5FA",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.12)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 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:"#6B7280",dependencyHover:"#3B82F6",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#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:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524"}};var oh=["LOW","MEDIUM","HIGH","URGENT"],nh=["todo","in-progress","review","done"];function _i({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:o,availableUsers:s=[],comments:n=[],activities:l=[],onAddComment:u,onDeleteComment:i,currentUser:c,onAIGenerateDescription:d,onAICreateSubtasks:p,onAIFindSimilar:f,availableColumns:v=[],availableLabels:k=[],availableTags:g=[],onCreateTag:y,onUploadCoverImage:h,unsplashAccessKey:b,theme:x,onSubtasksChange:D,attachments:N=[],onUploadAttachments:C,onDeleteAttachment:w}){let R=Bo(),F=x||R?.themeName||"dark",[T,H]=useState(e),[A,se]=useState(false),[S,j]=useState(()=>[...e?.subtasks||[]].sort((ae,Le)=>(ae.position??0)-(Le.position??0))),[ie,Ae]=useState(false),[L,ge]=useState(""),[ee,Ke]=useState(""),[B,te]=useState("all"),[xe,fe]=useState(false),[He,ve]=useState(false),[_e,re]=useState(false),[V,Y]=useState(false),[me,Te]=useState(false),[Xe,z]=useState(false),Ne=useRef(null),Pe=useRef(null),Fe=useRef(null),J=useRef(null),I=useRef(null),K=useRef(null),le=useRef(null),De=useRef(null),je=useRef(null),ot=useRef(null),ct=useRef(null),qe=useRef(null);useEffect(()=>{if(e&&!T){H({...e});let U=[...e.subtasks||[]].sort((ae,Le)=>(ae.position??0)-(Le.position??0));j(U);}else if(e&&T&&e.id!==T.id){H({...e});let U=[...e.subtasks||[]].sort((ae,Le)=>(ae.position??0)-(Le.position??0));j(U);}},[e,T]),useEffect(()=>{let U=ae=>{let Le=ae.target;J.current&&!J.current.contains(Le)&&fe(false),I.current&&!I.current.contains(Le)&&ve(false),K.current&&!K.current.contains(Le)&&re(false),le.current&&!le.current.contains(Le)&&Y(false);};if(xe||He||_e||V)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[xe,He,_e,V]),useEffect(()=>{if(!t)return;let U=ae=>{let Le=ae.target,dt=Le.tagName==="INPUT"||Le.tagName==="TEXTAREA"||Le.isContentEditable;if(ae.key==="Escape"){ae.preventDefault(),xe||He||_e||V||me||Xe?(fe(false),ve(false),re(false),Y(false),Te(false),z(false)):dt||a();return}if(dt&&ae.key!=="Escape")return;let Ze=ae.metaKey||ae.ctrlKey;switch(ae.key.toLowerCase()){case "s":ae.preventDefault(),fe(true);break;case "a":ae.preventDefault(),re(true);break;case "p":ae.preventDefault(),ve(true);break;case "l":ae.preventDefault(),Y(true);break;case "d":Ze||(ae.preventDefault(),Te(true),setTimeout(()=>De.current?.focus(),0));break;case "e":Ze||(ae.preventDefault(),z(true));break;case "i":ae.preventDefault(),se(true),setTimeout(()=>Pe.current?.focus(),0);break;case "t":ae.preventDefault(),Ae(true);break;case "c":ae.preventDefault(),Fe.current?.focus();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[t,a,xe,He,_e,V,me,Xe]);let sa=useCallback(U=>{let ae=U.currentTarget.textContent?.trim()||"";if(T&&ae!==T.title){let Le={...T,title:ae};H(Le),r?.(T.id,{title:ae});}},[T,r]),G=useCallback(U=>{U.key==="Enter"&&(U.preventDefault(),U.currentTarget.blur()),U.key==="Escape"&&(U.preventDefault(),U.currentTarget.textContent=T?.title||"",U.currentTarget.blur());},[T]),q=useCallback(()=>{T&&e&&T.description!==e.description&&r?.(T.id,{description:T.description}),se(false);},[T,e,r]),ke=useCallback(U=>{if(T){let ae={...T,columnId:U};H(ae),r?.(T.id,{columnId:U}),fe(false);}},[T,r]),rt=useCallback(U=>{if(T){let ae={...T,priority:U};H(ae),r?.(T.id,{priority:U}),ve(false);}},[T,r]),Se=useCallback(U=>{if(T){let ae=T.assignedUserIds||[],Le=ae.includes(U)?ae.filter(Ze=>Ze!==U):[...ae,U],dt={...T,assignedUserIds:Le};H(dt),r?.(T.id,{assignedUserIds:Le});}},[T,r]),Re=useCallback(U=>{if(T){let ae=T.labels||[],Le=ae.includes(U)?ae.filter(Ze=>Ze!==U):[...ae,U],dt={...T,labels:Le};H(dt),r?.(T.id,{labels:Le});}},[T,r]),X=useCallback(U=>{if(T){let ae={...T,tags:U};H(ae),r?.(T.id,{tags:U});}},[T,r]),Ye=useCallback(U=>{if(T){let ae=U.target.value,Le={...T,endDate:ae};H(Le),r?.(T.id,{endDate:ae}),Te(false);}},[T,r]),$=useCallback(U=>{if(T){let ae={...T,estimatedTime:parseFloat(U)||0};H(ae),r?.(T.id,{estimatedTime:parseFloat(U)||0});}},[T,r]),de=useCallback(()=>{if(L.trim()&&T){let U={id:`subtask-${Date.now()}`,title:L.trim(),completed:false,position:S.length,createdAt:new Date},ae=[...S,U];j(ae),ge(""),Ae(false),D?.(T.id,ae);}},[L,S,T,D]),Oe=useCallback(U=>{let ae=S.map(Le=>Le.id===U?{...Le,completed:!Le.completed,updatedAt:new Date}:Le);j(ae),T&&D?.(T.id,ae);},[S,T,D]),et=useCallback(U=>{let ae=S.filter(Le=>Le.id!==U);j(ae),T&&D?.(T.id,ae);},[S,T,D]),tt=useCallback(()=>{ee.trim()&&T&&u&&(u(T.id,ee.trim()),Ke(""));},[ee,T,u]),Ge=useCallback(U=>{(U.metaKey||U.ctrlKey)&&U.key==="Enter"&&(U.preventDefault(),tt());},[tt]),be=U=>jsx(th,{remarkPlugins:[ah],rehypePlugins:[rh],components:{a:({node:ae,...Le})=>jsx("a",{...Le,target:"_blank",rel:"noopener noreferrer"})},children:U}),Ue=l.filter(U=>B==="comments"?U.type.includes("COMMENT"):B==="history"?!U.type.includes("COMMENT"):true);if(!t||!e)return null;let W=T||e,ce=s.filter(U=>W.assignedUserIds?.includes(U.id)),vt=S.filter(U=>U.completed).length;return jsx(wt,{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:U=>U.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":F,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:Ne,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:sa,onKeyDown:G,children:W.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:J,children:[jsxs("button",{ref:je,className:"modal-v2-field",onClick:()=>fe(!xe),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:W.columnId||"No status"})]}),jsx(yn,{triggerRef:je,isOpen:xe,onClose:()=>fe(false),width:250,estimatedHeight:200,children:(v.length>0?v:nh.map(U=>({id:U,title:U}))).map(U=>jsx("button",{className:`modal-v2-popover-item ${W.columnId===U.id?"active":""}`,onClick:()=>ke(U.id),children:U.title},U.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:K,children:[jsxs("button",{ref:ot,className:"modal-v2-field",onClick:()=>re(!_e),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:ce.length>0?jsx("div",{className:"modal-v2-avatars",children:ce.map(U=>jsx("div",{className:"modal-v2-avatar",style:{background:U.color},title:U.name,children:U.initials},U.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(yn,{triggerRef:ot,isOpen:_e,onClose:()=>re(false),width:280,estimatedHeight:300,children:s.map(U=>jsxs("button",{className:`modal-v2-popover-item ${W.assignedUserIds?.includes(U.id)?"active":""}`,onClick:()=>Se(U.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:U.color},children:U.initials}),U.name,W.assignedUserIds?.includes(U.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"})})]},U.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:I,children:[jsxs("button",{ref:ct,className:"modal-v2-field",onClick:()=>ve(!He),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:W.priority||"None"})]}),jsxs(yn,{triggerRef:ct,isOpen:He,onClose:()=>ve(false),width:180,estimatedHeight:220,children:[oh.map(U=>jsx("button",{className:`modal-v2-popover-item priority-${U.toLowerCase()} ${W.priority===U?"active":""}`,onClick:()=>rt(U),children:U},U)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>rt(""),children:"None"})]})]}),g.length>0||y?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(Kr,{selectedTags:W.tags||[],availableTags:g,onChange:X,onCreateTag:y,theme:st[F]||st.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:le,children:[jsxs("button",{ref:qe,className:"modal-v2-field",onClick:()=>Y(!V),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:W.labels&&W.labels.length>0?jsx("span",{children:W.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(yn,{triggerRef:qe,isOpen:V,onClose:()=>Y(false),width:220,estimatedHeight:200,children:(k.length>0?k:["Bug","Feature","Enhancement","Documentation"]).map(U=>jsxs("button",{className:`modal-v2-popover-item ${W.labels?.includes(U)?"active":""}`,onClick:()=>Re(U),children:[U,W.labels?.includes(U)&&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"})})]},U))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{Te(!me),setTimeout(()=>De.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:W.endDate?new Date(W.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:De,type:"date",value:typeof W.endDate=="string"?W.endDate.split("T")[0]:W.endDate?(()=>{let U=new Date(W.endDate),ae=U.getUTCFullYear(),Le=String(U.getUTCMonth()+1).padStart(2,"0"),dt=String(U.getUTCDate()).padStart(2,"0");return `${ae}-${Le}-${dt}`})():"",onChange:Ye,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>z(!Xe),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:W.estimatedTime?`${W.estimatedTime}h`:"Not set"})]}),Xe&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:W.estimatedTime||"",onChange:U=>$(U.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>z(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"})]}),A?jsx("textarea",{className:"modal-v2-textarea",value:W.description||"",onChange:U=>{if(T){let ae={...T,description:U.target.value};H(ae);}},onBlur:q,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>se(true),children:W.description?jsx("div",{className:"modal-v2-markdown",children:be(W.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"}),S.length>0&&jsxs("span",{className:"modal-v2-count",children:[vt,"/",S.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>Ae(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:[S.map(U=>jsxs("div",{className:`modal-v2-subtask ${U.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>Oe(U.id),children:U.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:U.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>et(U.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"})]})})]},U.id)),ie&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:L,onChange:U=>ge(U.target.value),onKeyDown:U=>{U.key==="Enter"&&de(),U.key==="Escape"&&(Ae(false),ge(""));},onBlur:de,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(C||N.length>0)&&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.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("h2",{children:"Attachments"}),N.length>0&&jsx("span",{className:"modal-v2-count",children:N.length})]}),jsx(Er,{cardId:W.id,attachments:N,onUpload:C?U=>C(W.id,U):void 0,onDelete:w,maxSizeMB:10,maxFiles:20})]}),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:()=>te("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${B==="comments"?"active":""}`,onClick:()=>te("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${B==="history"?"active":""}`,onClick:()=>te("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[c&&jsx("div",{className:"modal-v2-avatar",style:{background:c.color},children:c.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:Fe,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:ee,onChange:U=>Ke(U.target.value),onKeyDown:Ge,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:tt,disabled:!ee.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Ue.map(U=>{let ae=s.find(dt=>dt.id===U.userId);if(U.type.includes("COMMENT")){let dt=n.find(Ze=>Ze.id===U.metadata?.commentId);return dt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ae&&jsx("div",{className:"modal-v2-avatar",style:{background:ae.color},children:ae.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:ae?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:dt.content})]})]},U.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[U.type.includes("CREATED")&&"\u2795",U.type.includes("UPDATED")&&"\u270F\uFE0F",U.type.includes("MOVED")&&"\u27A1\uFE0F",U.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",U.type.includes("ASSIGNED")&&"\u{1F464}",U.type.includes("PRIORITY")&&"\u{1F3AF}",U.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:ae?.name||"Unknown"})," ",U.type.replace(/_/g," ").toLowerCase(),U.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:U.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(U.timestamp).toLocaleString()})]})]},U.id)}),Ue.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function gh({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 Ki({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:o=true}){let s=e.map(n=>({...n,average:n.average??e.reduce((l,u)=>l+u.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(gh,{})}),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((n,l)=>n+l.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((n,l)=>n+l.completed,0)/e.length).toFixed(1)})]}),o&&e.some(n=>n.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((n,l)=>n+(l.planned||0),0)})]})]})]})}function Ch({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 qi({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:o=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),n=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,u=s>0?(s-n)/s*100:0,i=n<=l;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(Ch,{})}),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:i?"#10B981":"#EF4444",fill:i?"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:i?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:i?"#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:u>=50?"#10B981":"#F59E0B"},children:[u.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:i?"#10B981":"#EF4444"},children:n})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:i?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:i?"#10B981":"#EF4444"},children:i?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Ah={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#3B82F6",LOW:"#10B981"},mu=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Lh({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:o,percent:s}){let n=r+(o-r)*.5,l=e+n*Math.cos(-a*(Math.PI/180)),u=t+n*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:u,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function pu({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 Yi({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:o=true}){let s=e.reduce((u,i)=>u+i.value,0),n=e.map(u=>({...u,totalValue:s,color:u.color||Ah[u.name]||mu[e.indexOf(u)%mu.length]})),l=n.map(u=>u.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:n,cx:"50%",cy:"50%",labelLine:false,label:o?Lh:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:n.map((u,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(pu,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(u,i)=>{let c=i.payload,d=s>0?(c.value/s*100).toFixed(0):"0";return `${u} (${c.value} - ${d}%)`}})]}):jsxs(BarChart$1,{data:n,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(pu,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:n.map((u,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))})]})}),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((u,i)=>i.value>u.value?i:u).name})]})]})]})}var gs=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:o=[],availableLabels:s=[]})=>{let[n,l]=useState(false),[u,i]=useState(false),[c,d]=useState(false),[p,f]=useState(false);if(e.length===0)return null;let v=e.map(x=>x.id),k=x=>{r.onBulkUpdate?.(v,{priority:x}),l(false);},g=x=>{r.onBulkMove?.(v,x),i(false),a();},y=x=>{r.onBulkUpdate?.(v,{assignedUserIds:x}),d(false);},h=x=>{let D=new Set;e.forEach(C=>{C.labels?.forEach(w=>D.add(w));});let N=Array.from(new Set([...D,...x]));r.onBulkUpdate?.(v,{labels:N}),f(false);},b=()=>{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:()=>l(!n),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),n&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>k(x),children:[jsx("span",{className:m("asakaa-priority-dot",x==="LOW"&&"bg-asakaa-priority-low",x==="MEDIUM"&&"bg-asakaa-priority-medium",x==="HIGH"&&"bg-asakaa-priority-high",x==="URGENT"&&"bg-asakaa-priority-urgent")}),x]},x))})]}),o.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!u),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:o.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>g(x.id),children:x.title},x.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>d(!c),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(x=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([x.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:x.color},children:x.initials}),x.name]},x.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>f(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(x=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([x]),children:x},x))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:b,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"})})]})]})})});gs.displayName="BulkOperationsToolbar";function $h(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(o=>{let s,n,l,u,i;switch(t){case "assignee":let c=o.assignedUserIds||(o.assigneeId?[o.assigneeId]:[]);c.length>0?c.forEach(f=>{let v=a?.find(k=>k.id===f);n=`assignee-${f}`,l=v?.name||`User ${f}`,u=v?.color,i=v?.avatar,r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id);}):(n="assignee-unassigned",l="Unassigned",u="#6b7280",i="\u{1F464}",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u,icon:i}),r.get(n).cardIds.push(o.id));break;case "priority":s=o.priority||"NONE",n=`priority-${s}`;let p={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];l=p.title,u=p.color,r.has(n)||r.set(n,{id:n,title:l,groupValue:s,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);break;case "label":o.labels&&o.labels.length>0?o.labels.forEach(f=>{n=`label-${f}`,l=f,u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:f,cardIds:[],color:u}),r.get(n).cardIds.push(o.id);}):(n="label-none",l="No Labels",u="#6b7280",r.has(n)||r.set(n,{id:n,title:l,groupValue:null,cardIds:[],color:u}),r.get(n).cardIds.push(o.id));break}}),Array.from(r.values()).sort((o,s)=>o.title.localeCompare(s.title))}function Xi({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:o}){let[s,n]=useState(new Set),l=useMemo(()=>$h(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),u=useCallback(i=>{n(c=>{let d=new Set(c);return d.has(i)?d.delete(i):d.add(i),d});},[]);return t.groupBy==="none"||l.length===0?jsx(Yr,{board:e,callbacks:r,availableUsers:a,className:o}):jsxs("div",{className:m("asakaa-swimlane-view",o),children:[l.map(i=>{let c=s.has(i.id),d=e.cards.filter(f=>i.cardIds.includes(f.id)),p={...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&&u(i.id),style:{borderLeft:i.color?`4px solid ${i.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[i.icon&&jsx("span",{className:"text-2xl leading-none",children:i.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:i.color},children:i.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",i.cardIds.length," ",i.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":c?"Expand lane":"Collapse lane",children:c?"\u25B6":"\u25BC"})]}),!c&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(Yr,{board:p,callbacks:r,availableUsers:a})})]},i.id)}),l.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 Ji=[{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 Zi({value:e,onChange:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null),l=Ji.find(i=>i.value===e)||Ji[0];useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let u=i=>{t(i),o(false);};return jsxs("div",{className:m("relative inline-block",a),children:[jsxs("button",{ref:n,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:l.icon}),jsx("span",{children:l.label}),jsx("svg",{className:m("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:Ji.map(i=>jsxs("button",{onClick:()=>u(i.value),className:m("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===i.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:i.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:i.label}),e===i.value&&jsx("span",{className:"text-blue-400 text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var vn=[{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 Hh(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let o=t.modifiers||{},s=o.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,n=o.shift?e.shiftKey:!e.shiftKey,l=o.alt?e.altKey:!e.altKey,u=o.meta?e.metaKey:true;return s&&n&&l&&u}function yu(e={}){let{shortcuts:t=vn,enabled:a=true,preventDefault:r=true}=e,o=useRef(t),s=useRef(a);useEffect(()=>{o.current=t,s.current=a;},[t,a]);let n=useCallback(u=>{o.current=[...o.current,u];},[]),l=useCallback(u=>{o.current=o.current.filter(i=>i.action!==u);},[]);return useEffect(()=>{function u(i){if(!s.current)return;let c=i.target;if(!((c.tagName==="INPUT"||c.tagName==="TEXTAREA"||c.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let d of o.current)if(Hh(i,d)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:d.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[r]),{registerShortcut:n,unregisterShortcut:l,isEnabled:a}}function Gh(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Vh(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 _h(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Vh(e),r=t?Gh(t):"";return a?`${a} + ${r}`:r}function jh(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 Qi({shortcuts:e=vn,isOpen:t,onClose:a,className:r}){let[o,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(u){u.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!o||!t)return null;let n=jh(e);return jsxs("div",{className:m("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","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(n).map(([l,u])=>u.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-blue-500 rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:u.map(i=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:i.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:_h(i)})]},i.action))})]},l))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var el=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,7 +122,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Zi({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},u=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxs("div",{className:m("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:m("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(u).map(([i,c])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:c.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function el({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[u,i]=useState("json"),[c,d]=useState(null),p=useRef(null);if(!t)return null;let f=async()=>{let k=o?.current||void 0,g=await _d(e,u,k);jd(g,u);},v=async k=>{let g=k.target.files?.[0];if(g){try{let y=await qd(g),h=g.name.endsWith(".json")?"json":"csv",b=Yd(y,h);d(b),b.success&&r&&r(b,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:m("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:()=>l("export"),className:m("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:m("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(k=>jsxs("button",{onClick:()=>i(k),className:m("p-4 rounded-lg border-2 transition-all text-center",u===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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:f,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),c&&jsxs("div",{className:m("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:m("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((k,g)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},g))})]})]})]})]})]})}var Jh=["URGENT","HIGH","MEDIUM","LOW"],Zh=[{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"}],Qh=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function tl({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:u=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:p=false,groupBy:f="none",onGroupByChange:v}){let[k,g]=useState(true),y=useCallback(N=>{a({search:N.target.value});},[a]),h=useCallback(N=>{a({dateFilter:N.target.value});},[a]),b=useCallback(N=>{r({by:N.target.value});},[r]),x=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>g(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:k?"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"}),D&&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)"]})]}),!k&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,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:y,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let C=N.target.value;a({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Jh.map(N=>jsx("option",{value:N,children:N},N))]})}),u.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let C=N.target.value;a({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),u.map(N=>jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let C=N.target.value;a({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsx("option",{value:N,children:N},N))]})}),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:b,className:"filter-bar__select filter-bar__select--sm",children:Zh.map(N=>jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsx("button",{onClick:x,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:f,onChange:N=>v(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Qh.map(N=>jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function al({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:u}){let[i,c]=useState(false),d=useRef(null);useEffect(()=>{let f=v=>{d.current&&!d.current.contains(v.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let p=f=>{f(),c(false);};return jsxs("div",{className:m("relative",r),ref:d,children:[jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await 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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>u?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 rl={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"}},ol={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"}},nl={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"}},xo={dark:rl,light:ol,neutral:nl},fs="dark";var hs=createContext(void 0),db="asakaa-theme";function xu({children:e,defaultTheme:t=fs,storageKey:a=db}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,u=xo[r];Object.entries(u.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${cb(c)}`,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(([c,d])=>{let p=u.colors[c];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:xo};return jsx(hs.Provider,{value:n,children:e})}function _o(){let e=useContext(hs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function cb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function sl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=_o();return e?jsxs("div",{className:m("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(xo).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:m("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function ku(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return st[e]||st.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",st[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",st[e].bgSecondary),bgGrid:r("--theme-bg-card",st[e].bgGrid),bgWeekend:r("--theme-bg-hover",st[e].bgWeekend),border:r("--theme-border-primary",st[e].border),borderLight:r("--theme-border-subtle",st[e].borderLight),textPrimary:r("--theme-text-primary",st[e].textPrimary),textSecondary:r("--theme-text-secondary",st[e].textSecondary),textTertiary:r("--theme-text-tertiary",st[e].textTertiary),accent:r("--theme-accent-primary",st[e].accent),accentHover:r("--theme-accent-hover",st[e].accentHover),accentLight:r("--theme-accent-primary",st[e].accentLight),taskBarPrimary:r("--theme-accent-primary",st[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",st[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",st[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",st[e].dependency),dependencyHover:r("--theme-border-secondary",st[e].dependencyHover),criticalPath:r("--theme-error",st[e].criticalPath),criticalPathLight:r("--theme-error",st[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",st[e].today):e==="neutral"?r("--theme-text-primary",st[e].today):r("--theme-error",st[e].today),todayLight:e==="light"?r("--theme-accent-primary",st[e].todayLight):e==="neutral"?r("--theme-text-primary",st[e].todayLight):r("--theme-error",st[e].todayLight),milestone:r("--theme-warning",st[e].milestone),milestoneLight:r("--theme-warning",st[e].milestoneLight),statusTodo:r("--theme-text-tertiary",st[e].statusTodo),statusInProgress:r("--theme-accent-primary",st[e].statusInProgress),statusCompleted:r("--theme-success",st[e].statusCompleted),hoverBg:r("--theme-bg-hover",st[e].hoverBg),focusRing:r("--theme-accent-primary",st[e].focusRing)}}var bs={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},wu={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},il={en:bs,es:wu};function Cu(e){return il[e]||il.en}function ll(e,t){let a=Cu(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 Ko=createContext(bs);function Qr(){return useContext(Ko)}function Fb({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,u]=useState(false),[i,c]=useState(null),d=useRef(null),p=Qr();if(useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&u(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))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:n}].filter(g=>g.handler),k=async(g,y)=>{if(y){c(g);try{await y();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),u(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>u(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:p.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:l&&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((g,y)=>jsxs(motion.button,{onClick:()=>k(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ab({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Lb({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 Ib({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=Qr();useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],u=l.find(i=>i.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:`${n.toolbar.density||"Density"}: ${u}`,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:l.map((i,c)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.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:c<l.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:c*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Bb({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),u=Qr();useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let f=k=>{l.current&&!l.current.contains(k.target)&&n(false);},v=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",v),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(p),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:u.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:u.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:u.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:u.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:p=>{p.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:u.toolbar.filter||"Filters"}),c&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsx(AnimatePresence,{children:s&&jsxs(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-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:u.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-2",children:i.map(p=>{let f=t===p.value&&!r,v=()=>p.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxs(motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx("span",{className:`${f?p.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:p.label}),f&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},p.value)})}),jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:u.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function vs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:p,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:k=false,onHideCompletedChange:g,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:D,onExportMSProject:N}){let C=Qr(),w=y||h||b||x||D||N,R=[{value:"day",label:C.toolbar.day},{value:"week",label:C.toolbar.week},{value:"month",label:C.toolbar.month}],A=[{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(Lb,{options:R,value:t,onChange:T=>a(T),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(Ib,{theme:e,value:l,onChange:u}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Bb,{theme:e,value:f,onChange:v,hideCompleted:k,onHideCompletedChange:g})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[c&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,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||C.toolbar.createTask})]}),(w||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxs(Fragment,{children:[jsx(Fb,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:D,onExportMSProject:N}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(Ab,{options:A,value:s,onChange:T=>n(T),theme:e})]})]})}function xs({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),u=useRef(null);useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let c=u.current.getBoundingClientRect();n({x:c.left,y:c.bottom+4});}o(!r);},className:"p-2 rounded-md transition-colors flex items-center gap-1",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Plus,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:r&&jsx(kt,{children:jsx(motion.div,{ref:l,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxs("button",{onClick:()=>{t(c.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:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function Yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[l,u]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,p=8,f=window.innerWidth,v=window.innerHeight,k=t,g=a;t+c+p>f&&(k=t-c,k<p&&(k=p)),a+d+p>v&&(g=v-d-p,g<p&&(g=p)),u({x:k,y:g});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Lt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Au({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:p=true}){let f=useRef(false),v=useCallback(b=>{f.current=b;},[]),k=useCallback(b=>{let x=[],D=N=>{for(let C of N)x.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&D(C.subtasks);};return D(b),x},[]),g=useCallback(()=>{let b=k(e);for(let x of b)if(t.has(x.id))return x;return null},[e,t,k]),y=useCallback((b,x)=>{let D=k(e);if(D.length===0)return;let N=g();if(!N){a(D[0].id,false);return}let C=D.findIndex(A=>A.id===N.id);if(C===-1)return;let w=b==="up"?C-1:C+1;if(w<0||w>=D.length)return;let R=D[w];a(R.id,x);},[e,g,k,a]),h=useCallback(b=>{if(!p)return;let x=b.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){b.key==="Escape"&&(x.blur(),f.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,w=Array.from(t),R=g();if(b.key==="ArrowUp"){b.preventDefault(),y("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),y("down",b.shiftKey);return}if(R&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!R.isExpanded||b.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){w.length>0&&(b.preventDefault(),n(w,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){w.length>0&&(b.preventDefault(),l(w));return}if(b.key==="Tab"&&b.shiftKey){w.length>0&&(b.preventDefault(),u(w));return}if(b.key==="Enter"&&!b.shiftKey&&!C){R&&(b.preventDefault(),r(R.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!C){R&&(b.preventDefault(),r(R.id,"above"));return}if(b.key==="Enter"&&C){R&&(b.preventDefault(),d(R.id));return}if(b.key==="F2"){R&&(b.preventDefault(),i(R.id));return}if(b.key==="Delete"||b.key==="Backspace"&&C){w.length>0&&(b.preventDefault(),o(w));return}if(b.key==="d"&&C&&!b.shiftKey){w.length>0&&(b.preventDefault(),s(w));return}},[p,t,g,y,r,o,s,n,l,u,i,c,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:v}}function Iu(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let f=new Set(p);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let f=p.indexOf(a),v=p.indexOf(d);if(f===-1||v===-1){o(d);return}let k=Math.min(f,v),g=Math.max(f,v),y=p.slice(k,g+1);t(new Set(y)),r(d);},[a,o]),l=useCallback((d,p,f,v)=>{v?n(d,p):f?s(d):o(d);},[o,s,n]),u=useCallback((d,p)=>{p?t(f=>{let v=new Set(f);return v.add(d),v}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:c}}function hl(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?hl(t.subtasks):t.subtasks}))}function qo(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,u)=>(l.position??0)-(u.position??0));for(let l=0;l<n.length;l++){let u={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(u),u.subtasks&&u.subtasks.length>0&&u.isExpanded&&a(u.subtasks,u.id,s+1);}};return a(e),t}function ks(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ks(a.subtasks,t);if(r)return r}}return null}function fl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=fl(a.subtasks,t);if(r)return r}return null}function bl(e,t){if(t.length===0)return e;let a=qo(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,f)=>{let v=[];return {tasks:p.filter(g=>{if(f.has(g.id))return v.push(g),false;if(g.subtasks){let y=n(g.subtasks,f);g.subtasks=y.tasks,v.push(...y.removed);}return true}),removed:v}},l=(p,f,v)=>p.map(k=>k.id===f?{...k,subtasks:[...k.subtasks||[],...v],isExpanded:true}:k.subtasks?{...k,subtasks:l(k.subtasks,f,v)}:k),u=new Set(t),{tasks:i,removed:c}=n(e,u),d=l(i,s.id,c);return hl(d)}function yl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=fl(a,r);if(!o)continue;let s=fl(a,o.id),n=(i,c,d)=>{for(let p=0;p<i.length;p++){let f=i[p];if(f.id===c&&f.subtasks){let v=f.subtasks.findIndex(k=>k.id===d);if(v!==-1){let[k]=f.subtasks.splice(v,1);return k}}if(f.subtasks){let v=n(f.subtasks,c,d);if(v)return v}}return null},l=(i,c,d)=>{let p=i.findIndex(f=>f.id===c);if(p!==-1)return i.splice(p+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?l(s.subtasks,o.id,u):l(a,o.id,u));}return hl(a)}function vl(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,u)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,u))return true;return false}let c=u==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],n[i]={...n[i],position:i},n[c]={...n[c],position:c},true)};return s(r,o,a),r}function xl(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 xn(e,t){let a=[...e],r=[];for(let o of t){let s=(u,i)=>u.map((c,d)=>({...c,id:`${c.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${d}`):void 0})),n=u=>{let i=u.findIndex(f=>f.id===o);if(i===-1){for(let f of u)if(f.subtasks){let v=n(f.subtasks);if(v)return v}return null}let c=u[i],d=`${c.id}-copy-${Date.now()}`,p={...c,id:d,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,d):void 0};return u.splice(i+1,0,p),p},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Bu(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},l=u=>{let i=u.findIndex(d=>d.id===t);if(i===-1){for(let d of u)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return u.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function kl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:kl(r.subtasks,t,a)}:r)}function wl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:wl(a.subtasks,t)}:a)}function Cl(e,t){let a=p=>{for(let f of p){if(f.id===t)return f;if(f.subtasks){let v=a(f.subtasks);if(v)return v}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,u=p=>{for(let f of p){if(f.id===t)return (f.subtasks||[]).length;if(f.subtasks){let v=u(f.subtasks);if(v>=0)return v}}return 0},i=u(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6",position:i,parentId:t},d=p=>p.map(f=>{if(f.id===t){let v=f.subtasks||[];return {...f,subtasks:[...v,c],isExpanded:true}}return f.subtasks?{...f,subtasks:d(f.subtasks)}:f});return {tasks:d(e),newTask:c}}function Ru(e,t,a,r){if(t===a)return e;let o=ks(e,t);if(!o)return e;if(a){let l=(u,i)=>{if(!u.subtasks)return false;for(let c of u.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>{let u=l.filter(c=>c.id!==t),i=u.length<l.length;return u.map((c,d)=>{let p=i?{...c,position:d}:c;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((u,i)=>({...u,position:i}));}else {let l=u=>u.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,p=[...c];p.splice(d,0,{...o,parentId:a});let f=p.map((v,k)=>({...v,position:k}));return {...i,subtasks:f,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function Cs({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:u,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:p,onTaskUpdate:f,onTaskIndent:v,onTaskOutdent:k,onTaskMove:g,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:x,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:C,onTaskReparent:w,scrollContainerRef:R}){let A=useContext(Ko),[T,H]=useState(null),[L,ne]=useState(null),[S,V]=useState(""),ie=useRef(null),[Me,F]=useState(null),[ye,Q]=useState(0),[te,B]=useState(0),[X,me]=useState({isOpen:false,x:0,y:0,type:"header"}),[fe,Ge]=useState(null),[be,Ve]=useState(null),[re,_]=useState(null),q=useRef(0),ge=5,De=useRef(false),[qe,Se]=useState(null),[ot,We]=useState(false),Qe=useRef(null),[ae,I]=useState(null),[j,le]=useState(false),Te=useRef(null);useEffect(()=>{function U(ce){Te.current&&!Te.current.contains(ce.target)&&le(false);}if(j)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[j]),useEffect(()=>{L&&ie.current&&(ie.current.focus(),ie.current.select());},[L]),useEffect(()=>{if(!Me)return;let U=yt=>{let z=yt.clientX-ye,ee=te+z;p?.(Me,ee);},ce=()=>{F(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",ce),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",ce),document.body.style.cursor="",document.body.style.userSelect="";}},[Me,ye,te,p]);let{selectedTaskIds:_e,handleTaskClick:rt,isTaskSelected:ct}=Iu(),{setIsEditing:je}=Au({tasks:e,selectedTaskIds:_e,onTaskSelect:(U,ce)=>{let z=qo(e).map(ee=>ee.id);rt(U,z,ce||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:U=>{let ce=qo(e).find(yt=>yt.id===U);ce&&Ne(ce);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:U=>{let ce=qo(e).find(yt=>yt.id===U);ce&&N&&N(ce);},enableKeyboard:true}),sa=(U,ce=0)=>{let yt=[],z=[...U].sort((ee,Fe)=>(ee.position??0)-(Fe.position??0));for(let ee of z)yt.push({task:ee,level:ce}),ee.subtasks&&ee.subtasks.length>0&&ee.isExpanded&&yt.push(...sa(ee.subtasks,ce+1));return yt},W=sa(e),K=48,ke=Math.max(W.length*a,600-K),at=U=>!U.startDate||!U.endDate?"-":`${Math.ceil((U.endDate.getTime()-U.startDate.getTime())/(1e3*60*60*24))}d`,Ne=U=>{ne(U.id),V(U.name),je(true);},Ie=U=>{S.trim()&&S!==e.find(ce=>ce.id===U)?.name&&x?.(U,S.trim()),ne(null),V(""),je(false);},Y=()=>{ne(null),V(""),je(false);},Ke=(U,ce)=>{ce.stopPropagation(),D?.(U.id);},$=(U,ce)=>{ce.preventDefault(),q.current=ce.clientY,Ge(U),De.current=false,We(false),Se({x:ce.clientX,y:ce.clientY});},de=U=>{if(!fe||(Math.abs(U.clientY-q.current)>ge&&!De.current&&(De.current=true,We(true)),Se({x:U.clientX,y:U.clientY}),!De.current))return;if(R?.current){let Fe=R.current,dt=Fe.getBoundingClientRect(),Xe=60,Yt=12;Qe.current&&(cancelAnimationFrame(Qe.current),Qe.current=null);let gt=U.clientY-dt.top,Fa=dt.bottom-U.clientY;if(gt<Xe&&Fe.scrollTop>0){let Vt=Math.round(Yt*(1-gt/Xe)),Ea=()=>{Fe.scrollTop-=Vt,De.current&&Fe.scrollTop>0&&(Qe.current=requestAnimationFrame(Ea));};Qe.current=requestAnimationFrame(Ea);}else if(Fa<Xe&&Fe.scrollTop<Fe.scrollHeight-Fe.clientHeight){let Vt=Math.round(Yt*(1-Fa/Xe)),Ea=()=>{Fe.scrollTop+=Vt,De.current&&Fe.scrollTop<Fe.scrollHeight-Fe.clientHeight&&(Qe.current=requestAnimationFrame(Ea));};Qe.current=requestAnimationFrame(Ea);}}let yt=document.querySelectorAll("[data-task-row]"),z=null,ee=null;yt.forEach(Fe=>{let dt=Fe.getBoundingClientRect(),Xe=Fe.getAttribute("data-task-row");if(Xe&&Xe!==fe&&U.clientY>=dt.top&&U.clientY<=dt.bottom){z=Xe;let Yt=U.clientY-dt.top,gt=dt.height;Yt<gt*.25?ee="above":Yt>gt*.75?ee="below":ee="child";}}),Ve(z),_(ee);},Be=()=>{if(De.current&&fe&&be&&re){if(re==="child")w?.(fe,be);else if(re==="above"||re==="below"){let U=(ee,Fe,dt=null)=>{for(let Xe of ee){if(Xe.id===Fe)return dt;if(Xe.subtasks){let Yt=U(Xe.subtasks,Fe,Xe.id);if(Yt!==void 0)return Yt}}},ce=U(e,fe,null),yt=U(e,be,null),z=(ee,Fe,dt,Xe)=>{let Yt=ee.findIndex(Vt=>Vt.id===Fe),gt=Xe?ee.findIndex(Vt=>Vt.id===dt):-1,Fa=re==="below"?Yt+1:Yt;return Xe&>!==-1&><Yt&&(Fa-=1),Math.max(0,Fa)};if(yt===null){let Fe=z(e,be,fe,ce===null);w?.(fe,null,Fe);}else {let ee=W.find(Fe=>Fe.task.id===yt)?.task;if(ee?.subtasks){let Fe=ce===yt,dt=z(ee.subtasks,be,fe,Fe);w?.(fe,yt,dt);}}}}Qe.current&&(cancelAnimationFrame(Qe.current),Qe.current=null),Ge(null),Ve(null),_(null),Se(null),De.current=false,We(false);};useEffect(()=>{if(fe)return document.addEventListener("mousemove",de),document.addEventListener("mouseup",Be),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",Be),document.body.style.cursor="",document.body.style.userSelect="";}},[fe,be,re]);let Ze=(U,ce,yt)=>{switch(U.id){case "name":let z=L===ce.id,ee=T===ce.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${yt*20}px`},children:[w&&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:ee?1:.3},onMouseDown:Pe=>$(ce.id,Pe),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ce.subtasks&&ce.subtasks.length>0?jsx("button",{onClick:Pe=>{Pe.stopPropagation(),u?.(ce.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ce.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 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:ce.color||"#3B82F6",opacity:ce.parentId?.6:1,borderColor:ce.isMilestone?t.accent:"transparent",borderWidth:ce.isMilestone?"2px":"0px"},title:ce.isMilestone?"Milestone":ce.parentId?"Subtask":"Task"})}),z?jsx("input",{ref:ie,type:"text",value:S,onChange:Pe=>V(Pe.target.value),onKeyDown:Pe=>{Pe.key==="Enter"?Ie(ce.id):Pe.key==="Escape"&&Y();},onBlur:()=>Ie(ce.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:Pe=>Pe.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:ce.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ce.parentId?"13px":"14px",fontWeight:ce.isMilestone?600:ce.parentId?400:600,letterSpacing:ce.parentId?"0":"-0.01em"},title:ce.name,children:ce.name}),ee&&!z&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Pe=>Pe.stopPropagation(),children:[jsx("button",{onClick:Pe=>Ke(ce,Pe),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:Pe=>{Pe.stopPropagation(),Ne(ce);},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 dt=U.id==="startDate"?"startDate":"endDate",Xe=ce[dt],Yt=ae?.taskId===ce.id&&ae?.field===dt,gt=Pe=>Pe?(typeof Pe=="string"?new Date(Pe):Pe).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Pe=>Pe.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:Pe=>{if(Yt)I(null);else {let Rt=Pe.currentTarget.getBoundingClientRect();I({taskId:ce.id,field:dt,month:Xe?typeof Xe=="string"?new Date(Xe):Xe:new Date,position:{top:Rt.bottom+4,left:Rt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:gt(Xe)})]}),Yt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>I(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:ae?.position.top,left:ae?.position.left},onClick:Pe=>Pe.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Pe=new Date,Rt=new Date(Pe);Rt.setDate(Pe.getDate()+1);let Ot=new Date(Pe);Ot.setDate(Pe.getDate()+7);let Fr=new Date(Pe);return Fr.setDate(Pe.getDate()+14),[{label:"Hoy",date:Pe},{label:"Ma\xF1ana",date:Rt},{label:"Pr\xF3xima semana",date:Ot},{label:"2 semanas",date:Fr}].map((P,J)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:He=>He.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:He=>He.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ce.id,{[dt]:P.date}),I(null);},children:P.label},J))})(),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:Pe=>Pe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Pe=>Pe.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ce.id,{[dt]:void 0}),I(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:()=>I(Pe=>Pe?{...Pe,month:new Date(Pe.month.getFullYear(),Pe.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:ae?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>I(Pe=>Pe?{...Pe,month:new Date(Pe.month.getFullYear(),Pe.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((Pe,Rt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Pe},Rt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Pe=ae?.month||new Date,Rt=Pe.getFullYear(),Ot=Pe.getMonth(),Fr=new Date(Rt,Ot,1).getDay(),Ba=new Date(Rt,Ot+1,0).getDate(),P=new Date,J=[];for(let ze=Fr-1;ze>=0;ze--)J.push({day:new Date(Rt,Ot,-ze).getDate(),date:new Date(Rt,Ot-1,new Date(Rt,Ot,-ze).getDate()),isCurrentMonth:false});for(let ze=1;ze<=Ba;ze++)J.push({day:ze,date:new Date(Rt,Ot,ze),isCurrentMonth:true});let He=42-J.length;for(let ze=1;ze<=He;ze++)J.push({day:ze,date:new Date(Rt,Ot+1,ze),isCurrentMonth:false});return J.map((ze,qt)=>{let Pa=ze.date.toDateString()===P.toDateString(),Ra=(Xe?typeof Xe=="string"?new Date(Xe):Xe:null)?.toDateString()===ze.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:ze.isCurrentMonth?Ra?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ra?"#3B82F6":"transparent",boxShadow:Pa&&!Ra?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(ce.id,{[dt]:ze.date}),I(null);},children:ze.day},qt)})})()})]})]})]}),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:at(ce)})});case "assignees":let Fa=r.filter(Pe=>ce.assignees?.some(Rt=>Rt.name===Pe.name||Rt.initials===Pe.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Pe=>Pe.stopPropagation(),children:jsx(go,{assignedUsers:Fa,availableUsers:r,onChange:Pe=>{let Rt=Pe.map(Ot=>({id:Ot.id,name:Ot.name,initials:Ot.initials,color:Ot.color}));f?.(ce.id,{assignees:Rt.length>0?Rt:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:Pe=>Pe.stopPropagation(),children:jsx(gc,{status:ce.status||"todo",onChange:Pe=>{f?.(ce.id,{status:Pe,progress:Pe==="completed"?100:ce.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:`${ce.progress}%`,backgroundColor:ce.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:[ce.progress,"%"]})]});case "priority":let Vt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ea={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Hr=Vt[ce.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Pe=>Pe.stopPropagation(),children:jsx(mo,{priority:Hr,onChange:Pe=>{Pe&&f?.(ce.id,{priority:Ea[Pe]||"medium"});}})});default:return null}},et=U=>[{id:"hide",label:"Hide Column",icon:Lt.Hide,onClick:()=>d(U),disabled:U==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Lt.SortDesc,onClick:()=>{}}],Ue=U=>U.subtasks&&U.subtasks.length>0?[{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{D?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{C?C(U.id,U.name):y?.([U.id]);}}]:[{id:"edit",label:A?.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{n?.(U);}},{id:"addSubtask",label:A?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{D?.(U.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:A?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{f?.(U.id,{status:"todo",progress:0});},disabled:U.status==="todo"},{id:"setInProgress",label:A?.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{f?.(U.id,{status:"in-progress"});},disabled:U.status==="in-progress"},{id:"markComplete",label:A?.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{f?.(U.id,{status:"completed",progress:100});},disabled:U.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:A?.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{h?.([U.id]);}},{id:"split",label:A?.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:A?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{C?C(U.id,U.name):y?.([U.id]);}}],ve=c.filter(U=>U.visible),$e=ve.reduce((U,ce)=>U+ce.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:$e},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${K}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ve.map((U,ce)=>{let yt=ce===ve.length-1,z=U.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${z?"":"justify-center"}`,style:{width:`${U.width}px`,minWidth:`${U.minWidth??(z?200:60)}px`,maxWidth:`${U.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:yt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ee=>{ee.preventDefault(),me({isOpen:true,x:ee.clientX,y:ee.clientY,type:"header",columnId:U.id});},onMouseEnter:ee=>{ee.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ee=>{ee.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:U.label,children:U.label}),U.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Me===U.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ee=>{ee.preventDefault(),ee.stopPropagation(),F(U.id),Q(ee.clientX),B(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)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(xs,{columns:c,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>le(!j),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),j&&jsxs("div",{ref:Te,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:()=>le(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:ke},children:W.map(({task:U,level:ce},yt)=>{let z=ct(U.id),ee=be===U.id,Fe=ee&&re==="above",dt=ee&&re==="below",Xe=ee&&re==="child",Yt={};return Xe&&(Yt.backgroundColor=`${t.accent}15`,Yt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":U.id,className:`flex items-center cursor-pointer group ${fe===U.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:z?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:z?t.accentLight:Xe?`${t.accent}15`:yt%2===0?t.bgPrimary:t.bgGrid,...Yt},onMouseEnter:()=>H(U.id),onMouseLeave:()=>H(null),onClick:gt=>{let Vt=qo(e).map(Pe=>Pe.id),Hr=navigator.platform.toUpperCase().indexOf("MAC")>=0?gt.metaKey:gt.ctrlKey;rt(U.id,Vt,Hr,gt.shiftKey),s?.(U);},onDoubleClick:gt=>{gt.stopPropagation(),n?.(U);},onContextMenu:gt=>{gt.preventDefault(),me({isOpen:true,x:gt.clientX,y:gt.clientY,type:"task",task:U}),l?.(U,gt);},whileHover:{backgroundColor:z?t.accentLight:t.hoverBg},children:[Fe&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),dt&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ve.map((gt,Fa)=>{let Vt=Fa===ve.length-1,Ea=gt.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ea?"justify-start":"justify-center"}`,style:{width:`${gt.width}px`,minWidth:`${gt.minWidth??(Ea?200:60)}px`,maxWidth:`${gt.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Vt?"none":`1px solid ${T===U.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:Ze(gt,U,Ea?ce:0)},`${U.id}-${gt.id}`)})]},U.id)})}),jsx(Yo,{isOpen:X.isOpen,x:X.x,y:X.y,items:X.type==="header"&&X.columnId?et(X.columnId):X.type==="task"&&X.task?Ue(X.task):[],onClose:()=>me({...X,isOpen:false}),theme:t}),ot&&qe&&fe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:qe.x+12,top:qe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let U=W.find(ce=>ce.task.id===fe)?.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 Hu(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[u,i]=useState(t),[c,d]=useState(null),[p,f]=useState(null),[v,k]=useState(null),[g,y]=useState(null),[h,b]=useState(0),[x,D]=useState(0),[N,C]=useState(null),[w,R]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:u,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:f,activeZone:v,setActiveZone:k,draggedSegmentIndex:g,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:x,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:C,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ne,S)=>{r("none"),d(null),f(null),l(ne),i(S),D(0),y(null),b(0);}}}function Ns({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:u,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:p,allTaskPositions:f=[],onDragMove:v,onHoverChange:k}){let g=Hu(t,r),y=useRef(null),h=useRef(null),b=useRef(null),{dragMode:x,setDragMode:D,dragOffset:N,setDragOffset:C,ghostX:w,setGhostX:R,ghostWidth:A,setGhostWidth:T,connectionLine:H,setConnectionLine:L,hoveredTaskId:ne,setHoveredTaskId:S,activeZone:V,setActiveZone:ie,draggedSegmentIndex:Me,setDraggedSegmentIndex:F,draggedSegmentStartX:ye,setDraggedSegmentStartX:Q,segmentDragOffsetX:te,setSegmentDragOffsetX:B,hoveredSegmentIndex:X,setHoveredSegmentIndex:me,isHovered:fe,setIsHovered:Ge,isDragging:be,isResizing:Ve,isConnecting:re,resetDragState:_}=g,q=24,ge=8,De=e.endDate&&e.endDate<new Date&&e.progress<100,qe=e.isCriticalPath,Se=o.name==="neutral"||o.today==="#1C1917",ot=e.status==="completed"||e.progress===100,We={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},ae=e.isCriticalPath||De?"#DC2626":e.color?e.color:e.priority&&We[e.priority]?We[e.priority]:o.taskBarPrimary,j=($=>$>=80?20:$>=60?15:$>=50?12:10)(r),le=r<50,Te=r<40;useEffect(()=>{if(k)if(fe&&!be&&!e.segments){let $=a<100;k({task:e,x:t,y:a,width:r,height:q,showBelow:$});}else k(null);},[fe,be,e,t,a,r,q,k]);let _e=$=>$.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),rt=()=>{let $=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${$} day${$!==1?"s":""}`},ct=$=>Math.round($/s)*s,je=$=>{let de=Math.round($/s),Be=new Date(n);return Be.setDate(Be.getDate()+de),Be},sa=($,de)=>{for(let Be of f){if(Be.id===e.id)continue;let Ze=5;if($>=Be.x-Ze&&$<=Be.x+Be.width+Ze&&de>=Be.y-Ze&&de<=Be.y+Be.height+Ze)return Be.id}return null},W=useCallback(($,de,Be)=>{$.preventDefault(),$.stopPropagation();let Ze=y.current?.ownerSVGElement;if(!Ze)return;let et=Ze.createSVGPoint();et.x=$.clientX,et.y=$.clientY;let Ue=et.matrixTransform(Ze.getScreenCTM()?.inverse()),ve=Be!==void 0?Be:t,$e=de;if(!$e){let U=Ue.x-ve;$.shiftKey?($e="connect",L({x:t+r,y:a+q/2})):$.ctrlKey||$.metaKey?$e="move":$.altKey?$e=U<r/2?"resize-start":"resize-end":Te?U<r/2?$e="move":$e="resize-end":le?U<=j/2?$e="resize-start":U>=r-j/2?$e="resize-end":$e="move":U<=j?$e="resize-start":U>=r-j?$e="resize-end":$e="move";}D($e),Ge(false),ie(null),$e==="move"?C(Ue.x-ve):$e==="connect"?L({x:t+r,y:a+q/2}):C(0),R(ve),T(r);},[t,r,a,q]),K=useCallback($=>{let de=y.current?.ownerSVGElement;if(!de)return;let Be=de.closest(".gantt-timeline-scroll");if(!Be)return;let Ze=Be.getBoundingClientRect(),et=60,Ue=15,ve=0;if($.clientX<Ze.left+et){let $e=Ze.left+et-$.clientX;ve=-Math.min(Ue,$e/2);}else if($.clientX>Ze.right-et){let $e=$.clientX-(Ze.right-et);ve=Math.min(Ue,$e/2);}return ve!==0&&(Be.scrollLeft+=ve),ve!==0},[]),ke=useCallback($=>{if(x==="none")return;b.current=$;let de=y.current?.ownerSVGElement;if(!de)return;if(x==="move"||x==="resize-start"||x==="resize-end"){let et=K($);et&&!h.current?h.current=window.setInterval(()=>{b.current&&(K(b.current),ke(b.current));},16):!et&&h.current&&(window.clearInterval(h.current),h.current=null);}let Be=de.createSVGPoint();Be.x=$.clientX,Be.y=$.clientY;let Ze=Be.matrixTransform(de.getScreenCTM()?.inverse());if(x==="connect"){L({x:Ze.x,y:Ze.y});let et=sa(Ze.x,Ze.y);S(et);}else if(x==="move"){let et=Ze.x-N,Ue=ct(et);R(Ue),T(r);let ve=Math.round((Ue-t)/s);if(v?.(e.id,ve,true),e.segments&&e.segments.length>0&&Me!==null){let $e=Ue-ye;B($e);}}else if(x==="resize-start"){let et=Ze.x,Ue=ct(et),ve=t+r-Ue;ve>=s&&(R(Ue),T(ve));}else if(x==="resize-end"){let et=Ze.x,ve=ct(et)-t;ve>=s&&T(ve);}},[x,t,r,s,N,e,ct,Me,ye,sa,S,L,R,T,B,v,K]),at=useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),b.current=null,x!=="none"){if(x==="connect")ne&&p&&p(e,ne),L(null),S(null);else {let $=e.endDate.getTime()-e.startDate.getTime(),de,Be,Ze=true;if(x==="move"){if(de=je(w),Be=new Date(de.getTime()+$),e.segments&&e.segments.length>0&&Me!==null){let et=Math.round(te/s),Ue=e.segments.map((ce,yt)=>{if(yt===Me){let z=new Date(ce.startDate),ee=new Date(ce.endDate);return z.setDate(z.getDate()+et),ee.setDate(ee.getDate()+et),{startDate:z,endDate:ee}}return ce}),ve=Ue.flatMap(ce=>[ce.startDate,ce.endDate]),$e=new Date(Math.min(...ve.map(ce=>ce.getTime()))),U=new Date(Math.max(...ve.map(ce=>ce.getTime())));d?.({...e,segments:Ue},$e,U),_(t,r);return}}else x==="resize-start"?(de=je(w),Be=e.endDate,de>Be&&(console.warn("Invalid date range: start date must be before or equal to end date"),Ze=false)):x==="resize-end"?(de=e.startDate,Be=je(w+A),Be<de&&(console.warn("Invalid date range: end date must be after or equal to start date"),Ze=false)):Ze=false;Ze&&de&&Be&&(Be.getTime()<de.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,de,Be));}v?.(e.id,0,false),_(t,r);}},[x,w,A,e,d,ne,p,t,r,s,je,te,Me,_,v]);useEffect(()=>{if(x==="none")return;let $=Be=>{ke(Be);},de=()=>{at();};return window.addEventListener("mousemove",$),window.addEventListener("mouseup",de),()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",de),h.current&&(window.clearInterval(h.current),h.current=null);}},[x,ke,at]);let Ne=be&&!re?w:t,Ie=be&&!re?A:r,Y=l.taskClass(e);return jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!be&&u?.(e),onDoubleClick:$=>{be||($.stopPropagation(),i?.(e));},onContextMenu:$=>{$.preventDefault(),c?.(e,$);},onMouseEnter:()=>!be&&Ge(true),onMouseLeave:()=>{be||(Ge(false),ie(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:q,fill:"transparent",style:{pointerEvents:"all"}}),fe&&!be&&!le&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:j,height:q,fill:V==="resize-start"?o.accent:"transparent",opacity:V==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-start"),onMouseDown:$=>W($,"resize-start")}),jsx("rect",{x:t+j,y:a,width:r-j*2,height:q,fill:V==="move"?o.accent:"transparent",opacity:V==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:$=>W($,"move")}),jsx("rect",{x:t+r-j,y:a,width:j,height:q,fill:V==="resize-end"?o.accent:"transparent",opacity:V==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:$=>W($,"resize-end")})]}),fe&&!be&&Te&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:q,fill:V==="move"?o.accent:"transparent",opacity:V==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:$=>W($,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:q,fill:V==="resize-end"?o.accent:"transparent",opacity:V==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:$=>W($,"resize-end")}),fe&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+q-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),be&&!re&&!e.segments&&jsx(motion.rect,{x:w,y:a,width:A,height:q,rx:ge,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:Ne,y:a,width:Ie,height:q,rx:ge,fill:ae,"data-task-class":Y,initial:{opacity:0,scale:.95},animate:{opacity:be&&!re?.15:e.parentId?.6:fe?.9:.8,scale:fe&&!be?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$=>W($),style:{cursor:be?re?"crosshair":Ve?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Ne,y:a,width:Ie*(e.progress/100),height:q,rx:ge,fill:ae,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map(($,de)=>{let Be=($.startDate.getTime()-n.getTime())/864e5*s,et=($.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Be+s,Ue=be&&x==="move"&&Me===de,ve=X===de,$e=Ue?Be+te:Be;return jsxs("g",{onMouseEnter:()=>!be&&me(de),onMouseLeave:()=>!be&&me(null),children:[jsx(motion.rect,{x:$e,y:a,width:et,height:q,rx:ge,fill:ae,initial:{opacity:0,scale:.95},animate:{opacity:Ue||e.parentId?.6:ve?.9:.8,scale:ve&&!be?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:U=>{U.stopPropagation(),F(de),Q(Be),W(U,void 0,Be);},style:{cursor:be?re?"crosshair":Ve?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:$e,y:a,width:et*(e.progress/100),height:q,rx:ge,fill:ae,opacity:1,style:{pointerEvents:"none"}})]},`segment-${de}`)}),Se&&(De||qe)&&!e.segments&&jsxs(Fragment,{children:[qe&&!De&&jsx("rect",{x:Ne,y:a,width:Ie,height:q,rx:ge,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),De&&jsx("rect",{x:Ne,y:a,width:Ie,height:q,rx:ge,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Ie>60&&!e.segments&&(()=>{let $=l.taskLabel(e),de=typeof $=="string"?$:e.name,Be=de.length>Math.floor(Ie/8)?`${de.substring(0,Math.floor(Ie/8))}...`:de;return jsx("text",{x:Ne+12,y:a+q/2,dominantBaseline:"middle",fill:ot?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ot?"line-through":"none"},children:Be})})(),Ie>100&&e.progress>0&&e.progress<100&&!be&&!e.segments&&jsxs("text",{x:Ne+Ie-12,y:a+q/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&&Ie>80&&!be&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ne+Ie-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ne+Ie-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(fe||Ve)&&!re&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ne-2,y:a,width:16,height:q,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-start"),onMouseLeave:()=>ie(null),onMouseDown:$=>{$.stopPropagation(),W($,"resize-start");}}),jsx(motion.rect,{x:Ne+4,y:a+8,width:3,height:q-16,rx:1.5,fill:V==="resize-start"||x==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Ne+Ie-14,y:a,width:16,height:q,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-end"),onMouseLeave:()=>ie(null),onMouseDown:$=>{$.stopPropagation(),W($,"resize-end");}}),jsx(motion.rect,{x:Ne+Ie-7,y:a+8,width:3,height:q-16,rx:1.5,fill:V==="resize-end"||x==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:fe&&!be&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+q/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ie("connect"),onMouseLeave:()=>ie(null),onMouseDown:$=>{$.stopPropagation(),W($,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+q/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:V==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),re&&H&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+q/2,x2:H.x,y2:H.y,stroke:ne?o.statusCompleted:o.accent,strokeWidth:ne?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:ne?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:H.x,cy:H.y,r:ne?8:6,fill:ne?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),ne&&jsx(motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(fe||be)&&!re&&!e.segments&&jsx(motion.rect,{x:Ne-2,y:a-2,width:Ie+4,height:q+4,rx:ge+2,fill:"none",stroke:be?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:be?.6:.4,initial:{opacity:0},animate:{opacity:be?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ve&&jsxs(Fragment,{children:[jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:w+A,y1:0,x2:w+A,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:fe&&!be&&!e.segments&&!k&&(()=>{let Be=a<100,Ze=Be?a+q+13:a-82-13,et=Be?`M ${Ne+Ie/2-6} ${a+q+3} L ${Ne+Ie/2} ${a+q+13} L ${Ne+Ie/2+6} ${a+q+3}`:`M ${Ne+Ie/2-6} ${a-13} L ${Ne+Ie/2} ${a-3} L ${Ne+Ie/2+6} ${a-13}`,Ue=Ze+22,ve=Ze+40,$e=Ze+55,U=Ze+70,ce=Be?Ze+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Be?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Be?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:et,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Ne+Ie/2-120,y:Ze,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:Ne+Ie/2,y:Ue,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:Ne+Ie/2-110,y:ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Ne+Ie/2-70,y:ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:_e(e.startDate)}),jsx("text",{x:Ne+Ie/2-110,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Ne+Ie/2-70,y:$e,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:_e(e.endDate)}),jsx("text",{x:Ne+Ie/2+10,y:ve,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Ne+Ie/2+65,y:ve,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:rt()}),jsx("text",{x:Ne+Ie/2+10,y:$e,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Ne+Ie/2+65,y:$e,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:Ne+Ie/2-110,y:U,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Ne+Ie/2-50,y:U,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(yt=>yt.name).join(", ").substring(0,30),e.assignees.map(yt=>yt.name).join(", ").length>30?"...":""]})]}),!Be&&jsx("text",{x:Ne+Ie/2,y:ce,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Te?"Left: move \u2022 Right: resize":le?"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 Vu({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:u}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,d=13,p=u?s+l+d:s-c-d,f=u?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,v=p+22,k=p+40,g=p+55,y=p+70,h=p+90,b=p+105,x=p+120,D=T=>T.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let T=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${T} day${T!==1?"s":""}`},C=T=>{if(T==null||T===0)return "N/A";let H=Math.floor(T/60),L=T%60;return H===0?`${L}m`:L===0?`${H}h`:`${H}h ${L}m`},w={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:u?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:u?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:o+n/2-120,y:p,width:240,height:c,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:o+n/2,y:v,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsx("text",{x:o+n/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.start}),jsx("text",{x:o+n/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsx("text",{x:o+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.end}),jsx("text",{x:o+n/2-70,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsx("text",{x:o+n/2+10,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.duration}),jsx("text",{x:o+n/2+65,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsx("text",{x:o+n/2+10,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.progress}),jsxs("text",{x:o+n/2+65,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.assignees}),jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(T=>T.name).join(", ").substring(0,30),r.assignees.map(T=>T.name).join(", ").length>30?"...":""]})]}),i&&jsxs(Fragment,{children:[r.effortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.estimated}),jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.logged}),jsx("text",{x:o+n/2-50,y:b,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:C(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.quoted}),jsx("text",{x:o+n/2-50,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C(r.soldEffortMinutes)})]})]})]})})}function Nn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:u,hoverOverlayOnly:i=false}){let[,c]=useState(false),[d,p]=useState(null),f=r-t,v=f>0,k=Math.abs(f)<5,g=20,y=!k&&a<=e,h,b,x=a-e,D=e+x/2;if(b=D,n==="squared")if(k)h=`M ${e} ${t} L ${a} ${r}`;else if(y){let F=e+15,ye=a-g,Q=v?t+20:t-20;b=ye,h=`M ${e} ${t} L ${F} ${t} L ${F} ${Q} L ${ye} ${Q} L ${ye} ${r} L ${a} ${r}`;}else b=a-g,h=`M ${e} ${t} L ${b} ${t} L ${b} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${D} ${t}, ${D} ${r}, ${a} ${r}`;let N=5,C=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,w=o.dependency,R=o.dependencyHover||w,A="#f87171",T="rgba(248, 113, 113, 0.15)",H=b,L=(t+r)/2;if(d)if(k)H=Math.max(e+10,Math.min(a-10,d.x)),L=t;else if(y){let Me=e+15,F=a-g,ye=v?t+20:t-20,Q=[[e,t,Me,t],[Me,t,Me,ye],[Me,ye,F,ye],[F,ye,F,r],[F,r,a,r]],te=1/0,B={x:H,y:L};for(let X of Q){let me=ne(d.x,d.y,X[0],X[1],X[2],X[3]),fe=Math.hypot(d.x-me.x,d.y-me.y);fe<te&&(te=fe,B=me);}H=B.x,L=B.y;}else {let Me=[[e,t,b,t],[b,t,b,r],[b,r,a,r]],F=1/0,ye={x:H,y:L};for(let Q of Me){let te=ne(d.x,d.y,Q[0],Q[1],Q[2],Q[3]),B=Math.hypot(d.x-te.x,d.y-te.y);B<F&&(F=B,ye=te);}H=ye.x,L=ye.y;}function ne(Me,F,ye,Q,te,B){let X=te-ye,me=B-Q,fe=X*X+me*me;if(fe===0)return {x:ye,y:Q};let Ge=((Me-ye)*X+(F-Q)*me)/fe;return Ge=Math.max(0,Math.min(1,Ge)),{x:ye+Ge*X,y:Q+Ge*me}}let S=Me=>{let F=Me.currentTarget.ownerSVGElement;if(!F)return;let ye=F.getBoundingClientRect();p({x:Me.clientX-ye.left,y:Me.clientY-ye.top});},V=()=>{c(false),p(null),u?.(false);},ie=()=>{c(true),u?.(true);};return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:V,onMouseMove:S,children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:R,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Me=>{Me.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:H,cy:L,r:9,fill:T,stroke:A,strokeWidth:1.5}),jsx("line",{x1:H-3,y1:L-3,x2:H+3,y2:L+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:H+3,y1:L-3,x2:H-3,y2:L+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ie,onMouseLeave:V,onMouseMove:S,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:h,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:R,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:Me=>{Me.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:H,cy:L,r:9,fill:T,stroke:A,strokeWidth:1.5}),jsx("line",{x1:H-3,y1:L-3,x2:H+3,y2:L+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:H+3,y1:L-3,x2:H-3,y2:L+3,stroke:A,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:ie,onMouseLeave:V,onMouseMove:S,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:h,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsx(motion.path,{d:C,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:w,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Ss({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,u=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+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:u(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 Ce={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=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,u=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&u(d))return true;if(l.has(d))return true}}return l.delete(i),false};return u(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ce.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ce.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Ce.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=Ce.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(`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function tl({templates:e,onSelectTemplate:t,className:a}){let[r,o]=useState(false),s=useRef(null),n=useRef(null);useEffect(()=>{function i(c){s.current&&!s.current.contains(c.target)&&n.current&&!n.current.contains(c.target)&&o(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),o(false);},u=e.reduce((i,c)=>{let d=c.category||"Other";return i[d]||(i[d]=[]),i[d].push(c),i},{});return jsxs("div",{className:m("relative inline-block",a),children:[jsxs("button",{ref:n,onClick:()=>o(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",i.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:i=>{i.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",i.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:m("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(u).map(([i,c])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:c.map(d=>jsxs("button",{onClick:()=>l(d),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:p=>{p.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:d.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:d.name}),d.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:d.description})]})]},d.id))})]},i)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function rl({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:o,className:s}){let[n,l]=useState("export"),[u,i]=useState("json"),[c,d]=useState(null),p=useRef(null);if(!t)return null;let f=async()=>{let k=o?.current||void 0,g=await jd(e,u,k);Kd(g,u);},v=async k=>{let g=k.target.files?.[0];if(g){try{let y=await Xd(g),h=g.name.endsWith(".json")?"json":"csv",b=Yd(y,h);d(b),b.success&&r&&r(b,y);}catch(y){d({success:false,errors:[`Failed to read file: ${y instanceof Error?y.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:m("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:()=>l("export"),className:m("flex-1 px-6 py-4 font-semibold transition-colors",n==="export"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:m("flex-1 px-6 py-4 font-semibold transition-colors",n==="import"?"text-white border-b-2 border-blue-500":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[n==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(k=>jsxs("button",{onClick:()=>i(k),className:m("p-4 rounded-lg border-2 transition-all text-center",u===k?"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:[k==="json"&&"\u{1F4C4}",k==="csv"&&"\u{1F4CA}",k==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:k})]},k))})]}),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:f,className:"w-full py-3 px-4 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-semibold rounded-lg transition-all shadow-lg shadow-blue-500/20",children:"Export Board"})]}),n==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:p,type:"file",accept:".json,.csv",onChange:v,className:"hidden"}),jsxs("button",{onClick:()=>p.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),c&&jsxs("div",{className:m("p-4 rounded-lg",c.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:m("font-semibold mb-2",c.success?"text-green-400":"text-red-400"),children:c.success?"\u2713 Import Successful":"\u2717 Import Failed"}),c.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",c.cardsImported]}),jsxs("div",{children:["Columns imported: ",c.columnsImported]})]}),c.errors&&c.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:c.errors.map((k,g)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",k]},g))})]})]})]})]})]})}var Jh=["URGENT","HIGH","MEDIUM","LOW"],Zh=[{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"}],Qh=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ol({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:o,onFilterMyTasks:s,onFilterOverdue:n,onFilterHighPriority:l,availableUsers:u=[],availableLabels:i=[],availableColumns:c=[],showQuickFilters:d=true,compact:p=false,groupBy:f="none",onGroupByChange:v}){let[k,g]=useState(true),y=useCallback(N=>{a({search:N.target.value});},[a]),h=useCallback(N=>{a({dateFilter:N.target.value});},[a]),b=useCallback(N=>{r({by:N.target.value});},[r]),x=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),D=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${k?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>g(!k),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:k?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:k?"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"}),D&&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)"]})]}),!k&&jsxs("div",{className:"filter-bar__content",children:[d&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),n&&jsx("button",{onClick:n,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),l&&jsx("button",{onClick:l,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:y,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:N=>{let C=N.target.value;a({priorities:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Jh.map(N=>jsx("option",{value:N,children:N},N))]})}),u.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:N=>{let C=N.target.value;a({assignees:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),u.map(N=>jsx("option",{value:N.id,children:N.name},N.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:N=>{let C=N.target.value;a({labels:C==="all"?[]:[C]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(N=>jsx("option",{value:N,children:N},N))]})}),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:b,className:"filter-bar__select filter-bar__select--sm",children:Zh.map(N=>jsx("option",{value:N.value,children:N.label},N.value))}),t.by!=="none"&&jsx("button",{onClick:x,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:f,onChange:N=>v(N.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Qh.map(N=>jsx("option",{value:N.value,children:N.label},N.value))})}),D&&jsx("button",{onClick:o,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function nl({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:o="kanban",onExportGanttPDF:s,onExportGanttExcel:n,onExportGanttPNG:l,onExportGanttCSV:u}){let[i,c]=useState(false),d=useRef(null);useEffect(()=>{let f=v=>{d.current&&!d.current.contains(v.target)&&c(false);};return i&&document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f);}},[i]);let p=f=>{f(),c(false);};return jsxs("div",{className:m("relative",r),ref:d,children:[jsxs("button",{onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",f.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",f.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[o==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await n?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await 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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>u?.()),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:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:f=>{f.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:f=>{f.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 sl={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"}},il={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"}},ll={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"}},ko={dark:sl,light:il,neutral:ll},hs="dark";var bs=createContext(void 0),db="asakaa-theme";function ku({children:e,defaultTheme:t=hs,storageKey:a=db}){let[r,o]=useState(()=>{if(typeof window<"u"){let l=localStorage.getItem(a);if(l&&(l==="dark"||l==="light"||l==="neutral"))return l}return t}),s=useCallback(l=>{o(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,u=ko[r];Object.entries(u.colors).forEach(([c,d])=>{d&&l.style.setProperty(`--theme-${cb(c)}`,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(([c,d])=>{let p=u.colors[c];p&&l.style.setProperty(d,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let n={theme:r,setTheme:s,themes:ko};return jsx(bs.Provider,{value:n,children:e})}function jo(){let e=useContext(bs);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function cb(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function dl({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:o}=jo();return e?jsxs("div",{className:m("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(ko).map(([s,n])=>jsxs("button",{onClick:()=>{o(s),t();},className:m("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-blue-500 bg-blue-500/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:n.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:n.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}function wu(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return st[e]||st.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,n)=>a.getPropertyValue(s).trim()||n;return {bgPrimary:r("--theme-bg-primary",st[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",st[e].bgSecondary),bgGrid:r("--theme-bg-card",st[e].bgGrid),bgWeekend:r("--theme-bg-hover",st[e].bgWeekend),border:r("--theme-border-primary",st[e].border),borderLight:r("--theme-border-subtle",st[e].borderLight),textPrimary:r("--theme-text-primary",st[e].textPrimary),textSecondary:r("--theme-text-secondary",st[e].textSecondary),textTertiary:r("--theme-text-tertiary",st[e].textTertiary),accent:r("--theme-accent-primary",st[e].accent),accentHover:r("--theme-accent-hover",st[e].accentHover),accentLight:r("--theme-accent-primary",st[e].accentLight),taskBarPrimary:r("--theme-accent-primary",st[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",st[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",st[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",st[e].dependency),dependencyHover:r("--theme-border-secondary",st[e].dependencyHover),criticalPath:r("--theme-error",st[e].criticalPath),criticalPathLight:r("--theme-error",st[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",st[e].today):e==="neutral"?r("--theme-text-primary",st[e].today):r("--theme-error",st[e].today),todayLight:e==="light"?r("--theme-accent-primary",st[e].todayLight):e==="neutral"?r("--theme-text-primary",st[e].todayLight):r("--theme-error",st[e].todayLight),milestone:r("--theme-warning",st[e].milestone),milestoneLight:r("--theme-warning",st[e].milestoneLight),statusTodo:r("--theme-text-tertiary",st[e].statusTodo),statusInProgress:r("--theme-accent-primary",st[e].statusInProgress),statusCompleted:r("--theme-success",st[e].statusCompleted),hoverBg:r("--theme-bg-hover",st[e].hoverBg),focusRing:r("--theme-accent-primary",st[e].focusRing)}}var ys={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Cu={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},cl={en:ys,es:Cu};function Tu(e){return cl[e]||cl.en}function ul(e,t){let a=Tu(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 qo=createContext(ys);function eo(){return useContext(qo)}function Fb({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:o,onExportJSON:s,onExportMSProject:n}){let[l,u]=useState(false),[i,c]=useState(null),d=useRef(null),p=eo();if(useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&u(false);};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]),!(t||a||r||o||s||n))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:n}].filter(g=>g.handler),k=async(g,y)=>{if(y){c(g);try{await y();}catch(h){console.error(`Export ${g} failed:`,h);}finally{c(null),u(false);}}};return jsxs("div",{ref:d,className:"relative",children:[jsxs(motion.button,{onClick:()=>u(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:l?e.accent:e.bgSecondary,border:`1px solid ${l?e.accent:e.borderLight}`,color:l?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:p.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:l&&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((g,y)=>jsxs(motion.button,{onClick:()=>k(g.id,g.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:y<v.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===g.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):g.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:g.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:g.description})]})]},g.id))})})})]})}function Ab({options:e,value:t,onChange:a,theme:r,layoutId:o="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let n=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-xs transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:n?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:n?600:500,zIndex:n?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[n&&jsx(motion.div,{layoutId:o,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:n?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Lb({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 Ib({theme:e,value:t,onChange:a}){let[r,o]=useState(false),s=useRef(null),n=eo();useEffect(()=>{let i=c=>{s.current&&!s.current.contains(c.target)&&o(false);};return r&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=[{value:"compact",label:n.toolbar.compact||"Compact"},{value:"comfortable",label:n.toolbar.normal||"Normal"},{value:"spacious",label:n.toolbar.spacious||"Spacious"}],u=l.find(i=>i.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:`${n.toolbar.density||"Density"}: ${u}`,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:l.map((i,c)=>{let d=t===i.value;return jsxs(motion.button,{onClick:()=>{a(i.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:c<l.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:c*.03},children:[jsx("span",{className:"text-xs",style:{color:d?e.accent:e.textPrimary,fontFamily:"Inter, sans-serif",fontWeight:d?600:500},children:i.label}),d&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},i.value)})})})})]})}function Bb({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:o}){let[s,n]=useState(false),l=useRef(null),u=eo();useEffect(()=>{if(!s)return;let p=setTimeout(()=>{let f=k=>{l.current&&!l.current.contains(k.target)&&n(false);},v=k=>{k.key==="Escape"&&n(false);};document.addEventListener("mousedown",f),document.addEventListener("keydown",v),l._cleanup=()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);};},100);return ()=>{clearTimeout(p),l._cleanup&&l._cleanup();}},[s]);let i=[{value:"all",label:u.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:u.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in_progress",label:u.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"incomplete",label:u.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],c=t!=="all"||r,d=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.textPrimary==="#FFFFFF";return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:p=>{p.stopPropagation(),n(f=>!f);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:c?d?"rgba(59, 130, 246, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${c?d?"rgba(59, 130, 246, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:c?"#3B82F6":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:u.toolbar.filter||"Filters"}),c&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#3B82F6"}})]}),jsx(AnimatePresence,{children:s&&jsxs(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-72 rounded-lg overflow-hidden z-50",style:{backgroundColor:d?"#0F1117":"#FFFFFF",border:`1px solid ${d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"},children:jsx("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:d?"#6B7280":"#9CA3AF"},children:u.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-2",children:i.map(p=>{let f=t===p.value&&!r,v=()=>p.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):p.icon;return jsxs(motion.button,{onClick:()=>{a(p.value),o&&o(false),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:f?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx("span",{className:`${f?p.color:"text-gray-400"} flex-shrink-0`,children:v()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:p.label}),f&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]},p.value)})}),jsx("div",{className:"my-2 mx-4 h-px",style:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(229 231 235)"}}),o&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{o(!r),r||a("all"),n(false);},className:"w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",style:{backgroundColor:r?d?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent"},whileHover:{backgroundColor:d?"rgba(255,255,255,0.1)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-4 h-4 flex-shrink-0",style:{color:r?d?"#3B82F6":"#2563EB":d?"#6B7280":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap",style:{color:d?"#FFFFFF":"#111827"},children:u.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-4 h-4 flex-shrink-0",style:{color:d?"#3B82F6":"#2563EB"}})]})})]})})]})}function xs({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:o,currentTheme:s,onThemeChange:n,rowDensity:l,onRowDensityChange:u,showThemeSelector:i=false,showCreateTaskButton:c=false,createTaskLabel:d,onCreateTask:p,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:k=false,onHideCompletedChange:g,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:D,onExportMSProject:N}){let C=eo(),w=y||h||b||x||D||N,R=[{value:"day",label:C.toolbar.day},{value:"week",label:C.toolbar.week},{value:"month",label:C.toolbar.month}],F=[{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(Lb,{options:R,value:t,onChange:T=>a(T),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(Ib,{theme:e,value:l,onChange:u}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(Bb,{theme:e,value:f,onChange:v,hideCompleted:k,onHideCompletedChange:g})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[c&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,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||C.toolbar.createTask})]}),(w||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),w&&jsxs(Fragment,{children:[jsx(Fb,{theme:e,onExportPNG:y,onExportPDF:h,onExportExcel:b,onExportCSV:x,onExportJSON:D,onExportMSProject:N}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),i&&jsx(Ab,{options:F,value:s,onChange:T=>n(T),theme:e})]})]})}function ks({columns:e,onToggleColumn:t,theme:a}){let[r,o]=useState(false),[s,n]=useState({x:0,y:0}),l=useRef(null),u=useRef(null);useEffect(()=>{if(!r)return;let c=d=>{l.current&&!l.current.contains(d.target)&&o(false);};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let i=e.filter(c=>c.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:u,onClick:()=>{if(!r&&u.current){let c=u.current.getBoundingClientRect();n({x:c.left,y:c.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(wt,{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},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${s.x}px`,top:`${s.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),i.map(c=>jsxs("button",{onClick:()=>{t(c.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:c.label}),c.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},c.id))]})})})})]})}function Yo({isOpen:e,x:t,y:a,items:r,onClose:o,theme:s}){let n=useRef(null),[l,u]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let c=200,d=r.length*36+8,p=8,f=window.innerWidth,v=window.innerHeight,k=t,g=a;t+c+p>f&&(k=t-c,k<p&&(k=p)),a+d+p>v&&(g=v-d-p,g<p&&(g=p)),u({x:k,y:g});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let c=p=>{n.current&&!n.current.contains(p.target)&&o();},d=p=>{p.key==="Escape"&&o();};return document.addEventListener("mousedown",c),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",d);}},[e,o]),!e)return null;let i=c=>c.startsWith("#")&&(c.length===7||c.length===4)?c:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:n,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${l.x}px`,top:`${l.y}px`,backgroundColor:i(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(c=>jsxs("div",{children:[c.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{c.disabled||(c.onClick(),o());},disabled:c.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:c.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:c.disabled?"not-allowed":"pointer",opacity:c.disabled?.5:1},onMouseEnter:d=>{c.disabled||(d.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[c.icon&&jsx("span",{style:{color:s.textSecondary},children:c.icon}),jsx("span",{className:"flex-1",children:c.label}),c.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},c.id))})})})}var Lt={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Lu({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:o,onTaskDuplicate:s,onTaskMove:n,onTaskIndent:l,onTaskOutdent:u,onTaskRename:i,onTaskToggleExpand:c,onOpenTaskModal:d,enableKeyboard:p=true}){let f=useRef(false),v=useCallback(b=>{f.current=b;},[]),k=useCallback(b=>{let x=[],D=N=>{for(let C of N)x.push(C),C.subtasks&&C.subtasks.length>0&&C.isExpanded&&D(C.subtasks);};return D(b),x},[]),g=useCallback(()=>{let b=k(e);for(let x of b)if(t.has(x.id))return x;return null},[e,t,k]),y=useCallback((b,x)=>{let D=k(e);if(D.length===0)return;let N=g();if(!N){a(D[0].id,false);return}let C=D.findIndex(F=>F.id===N.id);if(C===-1)return;let w=b==="up"?C-1:C+1;if(w<0||w>=D.length)return;let R=D[w];a(R.id,x);},[e,g,k,a]),h=useCallback(b=>{if(!p)return;let x=b.target;if(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable||f.current){b.key==="Escape"&&(x.blur(),f.current=false);return}let C=navigator.platform.toUpperCase().indexOf("MAC")>=0?b.metaKey:b.ctrlKey,w=Array.from(t),R=g();if(b.key==="ArrowUp"){b.preventDefault(),y("up",b.shiftKey);return}if(b.key==="ArrowDown"){b.preventDefault(),y("down",b.shiftKey);return}if(R&&(b.key==="ArrowRight"||b.key==="ArrowLeft")){R.subtasks&&R.subtasks.length>0&&(b.preventDefault(),(b.key==="ArrowRight"&&!R.isExpanded||b.key==="ArrowLeft"&&R.isExpanded)&&c(R.id));return}if(b.altKey&&(b.key==="ArrowUp"||b.key==="ArrowDown")){w.length>0&&(b.preventDefault(),n(w,b.key==="ArrowUp"?"up":"down"));return}if(b.key==="Tab"&&!b.shiftKey){w.length>0&&(b.preventDefault(),l(w));return}if(b.key==="Tab"&&b.shiftKey){w.length>0&&(b.preventDefault(),u(w));return}if(b.key==="Enter"&&!b.shiftKey&&!C){R&&(b.preventDefault(),r(R.id,"below"));return}if(b.key==="Enter"&&b.shiftKey&&!C){R&&(b.preventDefault(),r(R.id,"above"));return}if(b.key==="Enter"&&C){R&&(b.preventDefault(),d(R.id));return}if(b.key==="F2"){R&&(b.preventDefault(),i(R.id));return}if(b.key==="Delete"||b.key==="Backspace"&&C){w.length>0&&(b.preventDefault(),o(w));return}if(b.key==="d"&&C&&!b.shiftKey){w.length>0&&(b.preventDefault(),s(w));return}},[p,t,g,y,r,o,s,n,l,u,i,c,d]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:v}}function Bu(){let[e,t]=useState(new Set),[a,r]=useState(null),o=useCallback(d=>{t(new Set([d])),r(d);},[]),s=useCallback(d=>{t(p=>{let f=new Set(p);return f.has(d)?f.delete(d):f.add(d),f}),r(d);},[]),n=useCallback((d,p)=>{if(!a){o(d);return}let f=p.indexOf(a),v=p.indexOf(d);if(f===-1||v===-1){o(d);return}let k=Math.min(f,v),g=Math.max(f,v),y=p.slice(k,g+1);t(new Set(y)),r(d);},[a,o]),l=useCallback((d,p,f,v)=>{v?n(d,p):f?s(d):o(d);},[o,s,n]),u=useCallback((d,p)=>{p?t(f=>{let v=new Set(f);return v.add(d),v}):o(d);},[o]),i=useCallback(()=>{t(new Set),r(null);},[]),c=useCallback(d=>e.has(d),[e]);return {selectedTaskIds:e,selectTask:o,toggleTaskSelection:s,selectTaskRange:n,handleTaskClick:l,handleKeyboardSelection:u,clearSelection:i,isTaskSelected:c}}function vl(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?vl(t.subtasks):t.subtasks}))}function Xo(e){let t=[],a=(r,o,s=0)=>{let n=[...r].sort((l,u)=>(l.position??0)-(u.position??0));for(let l=0;l<n.length;l++){let u={...n[l],parentId:o,level:s,position:n[l].position??l};t.push(u),u.subtasks&&u.subtasks.length>0&&u.isExpanded&&a(u.subtasks,u.id,s+1);}};return a(e),t}function ws(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=ws(a.subtasks,t);if(r)return r}}return null}function yl(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(o=>o.id===t))return a;let r=yl(a.subtasks,t);if(r)return r}return null}function xl(e,t){if(t.length===0)return e;let a=Xo(e),r=t[0],o=a.findIndex(p=>p.id===r);if(o<=0)return e;let s=a[o-1],n=(p,f)=>{let v=[];return {tasks:p.filter(g=>{if(f.has(g.id))return v.push(g),false;if(g.subtasks){let y=n(g.subtasks,f);g.subtasks=y.tasks,v.push(...y.removed);}return true}),removed:v}},l=(p,f,v)=>p.map(k=>k.id===f?{...k,subtasks:[...k.subtasks||[],...v],isExpanded:true}:k.subtasks?{...k,subtasks:l(k.subtasks,f,v)}:k),u=new Set(t),{tasks:i,removed:c}=n(e,u),d=l(i,s.id,c);return vl(d)}function kl(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let o=yl(a,r);if(!o)continue;let s=yl(a,o.id),n=(i,c,d)=>{for(let p=0;p<i.length;p++){let f=i[p];if(f.id===c&&f.subtasks){let v=f.subtasks.findIndex(k=>k.id===d);if(v!==-1){let[k]=f.subtasks.splice(v,1);return k}}if(f.subtasks){let v=n(f.subtasks,c,d);if(v)return v}}return null},l=(i,c,d)=>{let p=i.findIndex(f=>f.id===c);if(p!==-1)return i.splice(p+1,0,d),i;for(let f of i)f.subtasks&&l(f.subtasks,c,d);return i},u=n(a,o.id,r);u&&(s&&s.subtasks?l(s.subtasks,o.id,u):l(a,o.id,u));}return vl(a)}function wl(e,t,a){if(t.length===0)return e;let r=[...e],o=t[0],s=(n,l,u)=>{let i=n.findIndex(d=>d.id===l);if(i===-1){for(let d of n)if(d.subtasks&&s(d.subtasks,l,u))return true;return false}let c=u==="up"?i-1:i+1;return c<0||c>=n.length?false:([n[i],n[c]]=[n[c],n[i]],n[i]={...n[i],position:i},n[c]={...n[c],position:c},true)};return s(r,o,a),r}function Cl(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 kn(e,t){let a=[...e],r=[];for(let o of t){let s=(u,i)=>u.map((c,d)=>({...c,id:`${c.id}-copy-${Date.now()}-${d}`,parentId:i,subtasks:c.subtasks?s(c.subtasks,`${c.id}-copy-${Date.now()}-${d}`):void 0})),n=u=>{let i=u.findIndex(f=>f.id===o);if(i===-1){for(let f of u)if(f.subtasks){let v=n(f.subtasks);if(v)return v}return null}let c=u[i],d=`${c.id}-copy-${Date.now()}`,p={...c,id:d,name:`${c.name} (Copy)`,subtasks:c.subtasks?s(c.subtasks,d):void 0};return u.splice(i+1,0,p),p},l=n(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Ru(e,t,a){let r=[...e],o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:o,endDate:s,color:"#6366F1"},l=u=>{let i=u.findIndex(d=>d.id===t);if(i===-1){for(let d of u)if(d.subtasks&&l(d.subtasks))return true;return false}let c=a==="above"?i:i+1;return u.splice(c,0,n),true};return l(r),{tasks:r,newTask:n}}function Tl(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Tl(r.subtasks,t,a)}:r)}function Nl(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Nl(a.subtasks,t)}:a)}function Dl(e,t){let a=p=>{for(let f of p){if(f.id===t)return f;if(f.subtasks){let v=a(f.subtasks);if(v)return v}}return null},r=a(e),o=new Date,s=new Date(o);s.setDate(s.getDate()+7);let n=r?.startDate||o,l=r?.endDate||s,u=p=>{for(let f of p){if(f.id===t)return (f.subtasks||[]).length;if(f.subtasks){let v=u(f.subtasks);if(v>=0)return v}}return 0},i=u(e),c={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(n),endDate:new Date(l),color:r?.color||"#3B82F6",position:i,parentId:t},d=p=>p.map(f=>{if(f.id===t){let v=f.subtasks||[];return {...f,subtasks:[...v,c],isExpanded:true}}return f.subtasks?{...f,subtasks:d(f.subtasks)}:f});return {tasks:d(e),newTask:c}}function Ou(e,t,a,r){if(t===a)return e;let o=ws(e,t);if(!o)return e;if(a){let l=(u,i)=>{if(!u.subtasks)return false;for(let c of u.subtasks)if(c.id===i||l(c,i))return true;return false};if(l(o,a))return e}let s=l=>{let u=l.filter(c=>c.id!==t),i=u.length<l.length;return u.map((c,d)=>{let p=i?{...c,position:d}:c;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},n=s(e);if(a===null){let l=r!==void 0?r:n.length;n.splice(l,0,{...o,parentId:void 0}),n=n.map((u,i)=>({...u,position:i}));}else {let l=u=>u.map(i=>{if(i.id===a){let c=i.subtasks||[],d=r!==void 0?r:c.length,p=[...c];p.splice(d,0,{...o,parentId:a});let f=p.map((v,k)=>({...v,position:k}));return {...i,subtasks:f,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});n=l(n);}return n}function Ts({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:o,onTaskClick:s,onTaskDblClick:n,onTaskContextMenu:l,onTaskToggle:u,scrollTop:i,columns:c,onToggleColumn:d,onColumnResize:p,onTaskUpdate:f,onTaskIndent:v,onTaskOutdent:k,onTaskMove:g,onMultiTaskDelete:y,onTaskDuplicate:h,onTaskCreate:b,onTaskRename:x,onCreateSubtask:D,onOpenTaskModal:N,onDeleteRequest:C,onTaskReparent:w,scrollContainerRef:R}){let F=useContext(qo),[T,H]=useState(null),[A,se]=useState(null),[S,j]=useState(""),ie=useRef(null),[Ae,L]=useState(null),[ge,ee]=useState(0),[Ke,B]=useState(0),[te,xe]=useState({isOpen:false,x:0,y:0,type:"header"}),[fe,He]=useState(null),[ve,_e]=useState(null),[re,V]=useState(null),Y=useRef(0),me=5,Te=useRef(false),[Xe,z]=useState(null),[Ne,Pe]=useState(false),Fe=useRef(null),[J,I]=useState(null),[K,le]=useState(false),De=useRef(null);useEffect(()=>{function W(ce){De.current&&!De.current.contains(ce.target)&&le(false);}if(K)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[K]),useEffect(()=>{A&&ie.current&&(ie.current.focus(),ie.current.select());},[A]),useEffect(()=>{if(!Ae)return;let W=vt=>{let U=vt.clientX-ge,ae=Ke+U;p?.(Ae,ae);},ce=()=>{L(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",W),document.addEventListener("mouseup",ce),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",ce),document.body.style.cursor="",document.body.style.userSelect="";}},[Ae,ge,Ke,p]);let{selectedTaskIds:je,handleTaskClick:ot,isTaskSelected:ct}=Bu(),{setIsEditing:qe}=Lu({tasks:e,selectedTaskIds:je,onTaskSelect:(W,ce)=>{let U=Xo(e).map(ae=>ae.id);ot(W,U,ce||false,false);},onTaskCreate:b||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:h||(()=>{}),onTaskMove:g||(()=>{}),onTaskIndent:v||(()=>{}),onTaskOutdent:k||(()=>{}),onTaskRename:W=>{let ce=Xo(e).find(vt=>vt.id===W);ce&&Se(ce);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:W=>{let ce=Xo(e).find(vt=>vt.id===W);ce&&N&&N(ce);},enableKeyboard:true}),sa=(W,ce=0)=>{let vt=[],U=[...W].sort((ae,Le)=>(ae.position??0)-(Le.position??0));for(let ae of U)vt.push({task:ae,level:ce}),ae.subtasks&&ae.subtasks.length>0&&ae.isExpanded&&vt.push(...sa(ae.subtasks,ce+1));return vt},G=sa(e),q=48,ke=Math.max(G.length*a,600-q),rt=W=>!W.startDate||!W.endDate?"-":`${Math.ceil((W.endDate.getTime()-W.startDate.getTime())/(1e3*60*60*24))}d`,Se=W=>{se(W.id),j(W.name),qe(true);},Re=W=>{S.trim()&&S!==e.find(ce=>ce.id===W)?.name&&x?.(W,S.trim()),se(null),j(""),qe(false);},X=()=>{se(null),j(""),qe(false);},Ye=(W,ce)=>{ce.stopPropagation(),D?.(W.id);},$=(W,ce)=>{ce.preventDefault(),Y.current=ce.clientY,He(W),Te.current=false,Pe(false),z({x:ce.clientX,y:ce.clientY});},de=W=>{if(!fe||(Math.abs(W.clientY-Y.current)>me&&!Te.current&&(Te.current=true,Pe(true)),z({x:W.clientX,y:W.clientY}),!Te.current))return;if(R?.current){let Le=R.current,dt=Le.getBoundingClientRect(),Ze=60,qt=12;Fe.current&&(cancelAnimationFrame(Fe.current),Fe.current=null);let ft=W.clientY-dt.top,Fa=dt.bottom-W.clientY;if(ft<Ze&&Le.scrollTop>0){let Vt=Math.round(qt*(1-ft/Ze)),Ea=()=>{Le.scrollTop-=Vt,Te.current&&Le.scrollTop>0&&(Fe.current=requestAnimationFrame(Ea));};Fe.current=requestAnimationFrame(Ea);}else if(Fa<Ze&&Le.scrollTop<Le.scrollHeight-Le.clientHeight){let Vt=Math.round(qt*(1-Fa/Ze)),Ea=()=>{Le.scrollTop+=Vt,Te.current&&Le.scrollTop<Le.scrollHeight-Le.clientHeight&&(Fe.current=requestAnimationFrame(Ea));};Fe.current=requestAnimationFrame(Ea);}}let vt=document.querySelectorAll("[data-task-row]"),U=null,ae=null;vt.forEach(Le=>{let dt=Le.getBoundingClientRect(),Ze=Le.getAttribute("data-task-row");if(Ze&&Ze!==fe&&W.clientY>=dt.top&&W.clientY<=dt.bottom){U=Ze;let qt=W.clientY-dt.top,ft=dt.height;qt<ft*.25?ae="above":qt>ft*.75?ae="below":ae="child";}}),_e(U),V(ae);},Oe=()=>{if(Te.current&&fe&&ve&&re){if(re==="child")w?.(fe,ve);else if(re==="above"||re==="below"){let W=(ae,Le,dt=null)=>{for(let Ze of ae){if(Ze.id===Le)return dt;if(Ze.subtasks){let qt=W(Ze.subtasks,Le,Ze.id);if(qt!==void 0)return qt}}},ce=W(e,fe,null),vt=W(e,ve,null),U=(ae,Le,dt,Ze)=>{let qt=ae.findIndex(Vt=>Vt.id===Le),ft=Ze?ae.findIndex(Vt=>Vt.id===dt):-1,Fa=re==="below"?qt+1:qt;return Ze&&ft!==-1&&ft<qt&&(Fa-=1),Math.max(0,Fa)};if(vt===null){let Le=U(e,ve,fe,ce===null);w?.(fe,null,Le);}else {let ae=G.find(Le=>Le.task.id===vt)?.task;if(ae?.subtasks){let Le=ce===vt,dt=U(ae.subtasks,ve,fe,Le);w?.(fe,vt,dt);}}}}Fe.current&&(cancelAnimationFrame(Fe.current),Fe.current=null),He(null),_e(null),V(null),z(null),Te.current=false,Pe(false);};useEffect(()=>{if(fe)return document.addEventListener("mousemove",de),document.addEventListener("mouseup",Oe),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",de),document.removeEventListener("mouseup",Oe),document.body.style.cursor="",document.body.style.userSelect="";}},[fe,ve,re]);let et=(W,ce,vt)=>{switch(W.id){case "name":let U=A===ce.id,ae=T===ce.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${vt*20}px`},children:[w&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:ae?1:.3},onMouseDown:Me=>$(ce.id,Me),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ce.subtasks&&ce.subtasks.length>0?jsx("button",{onClick:Me=>{Me.stopPropagation(),u?.(ce.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ce.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 flex items-center justify-center",children:jsx("div",{className:"w-3 h-3 rounded-full border",style:{backgroundColor:ce.color||"#3B82F6",opacity:ce.parentId?.6:1,borderColor:ce.isMilestone?t.accent:"transparent",borderWidth:ce.isMilestone?"2px":"0px"},title:ce.isMilestone?"Milestone":ce.parentId?"Subtask":"Task"})}),U?jsx("input",{ref:ie,type:"text",value:S,onChange:Me=>j(Me.target.value),onKeyDown:Me=>{Me.key==="Enter"?Re(ce.id):Me.key==="Escape"&&X();},onBlur:()=>Re(ce.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:Me=>Me.stopPropagation()}):jsxs(Fragment,{children:[jsx("span",{className:"flex-1",style:{color:ce.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ce.parentId?"13px":"14px",fontWeight:ce.isMilestone?600:ce.parentId?400:600,letterSpacing:ce.parentId?"0":"-0.01em"},title:ce.name,children:ce.name}),ae&&!U&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Me=>Me.stopPropagation(),children:[jsx("button",{onClick:Me=>Ye(ce,Me),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:Me=>{Me.stopPropagation(),Se(ce);},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 dt=W.id==="startDate"?"startDate":"endDate",Ze=ce[dt],qt=J?.taskId===ce.id&&J?.field===dt,ft=Me=>Me?(typeof Me=="string"?new Date(Me):Me).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Me=>Me.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:Me=>{if(qt)I(null);else {let Rt=Me.currentTarget.getBoundingClientRect();I({taskId:ce.id,field:dt,month:Ze?typeof Ze=="string"?new Date(Ze):Ze:new Date,position:{top:Rt.bottom+4,left:Rt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:ft(Ze)})]}),qt&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>I(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:J?.position.top,left:J?.position.left},onClick:Me=>Me.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Me=new Date,Rt=new Date(Me);Rt.setDate(Me.getDate()+1);let Ot=new Date(Me);Ot.setDate(Me.getDate()+7);let Ar=new Date(Me);return Ar.setDate(Me.getDate()+14),[{label:"Hoy",date:Me},{label:"Ma\xF1ana",date:Rt},{label:"Pr\xF3xima semana",date:Ot},{label:"2 semanas",date:Ar}].map((P,Z)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Ve=>Ve.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Ve=>Ve.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ce.id,{[dt]:P.date}),I(null);},children:P.label},Z))})(),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:Me=>Me.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Me=>Me.currentTarget.style.backgroundColor="transparent",onClick:()=>{f?.(ce.id,{[dt]:void 0}),I(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:()=>I(Me=>Me?{...Me,month:new Date(Me.month.getFullYear(),Me.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:J?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>I(Me=>Me?{...Me,month:new Date(Me.month.getFullYear(),Me.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((Me,Rt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Me},Rt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Me=J?.month||new Date,Rt=Me.getFullYear(),Ot=Me.getMonth(),Ar=new Date(Rt,Ot,1).getDay(),Ra=new Date(Rt,Ot+1,0).getDate(),P=new Date,Z=[];for(let We=Ar-1;We>=0;We--)Z.push({day:new Date(Rt,Ot,-We).getDate(),date:new Date(Rt,Ot-1,new Date(Rt,Ot,-We).getDate()),isCurrentMonth:false});for(let We=1;We<=Ra;We++)Z.push({day:We,date:new Date(Rt,Ot,We),isCurrentMonth:true});let Ve=42-Z.length;for(let We=1;We<=Ve;We++)Z.push({day:We,date:new Date(Rt,Ot+1,We),isCurrentMonth:false});return Z.map((We,Yt)=>{let Pa=We.date.toDateString()===P.toDateString(),Oa=(Ze?typeof Ze=="string"?new Date(Ze):Ze:null)?.toDateString()===We.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:We.isCurrentMonth?Oa?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Oa?"#3B82F6":"transparent",boxShadow:Pa&&!Oa?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{f?.(ce.id,{[dt]:We.date}),I(null);},children:We.day},Yt)})})()})]})]})]}),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:rt(ce)})});case "assignees":let Fa=r.filter(Me=>ce.assignees?.some(Rt=>Rt.name===Me.name||Rt.initials===Me.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsx(fo,{assignedUsers:Fa,availableUsers:r,onChange:Me=>{let Rt=Me.map(Ot=>({id:Ot.id,name:Ot.name,initials:Ot.initials,color:Ot.color}));f?.(ce.id,{assignees:Rt.length>0?Rt:void 0});}})});case "status":return jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsx(fc,{status:ce.status||"todo",onChange:Me=>{f?.(ce.id,{status:Me,progress:Me==="completed"?100:ce.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:`${ce.progress}%`,backgroundColor:ce.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:[ce.progress,"%"]})]});case "priority":let Vt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Ea={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Wr=Vt[ce.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Me=>Me.stopPropagation(),children:jsx(po,{priority:Wr,onChange:Me=>{Me&&f?.(ce.id,{priority:Ea[Me]||"medium"});}})});default:return null}},tt=W=>[{id:"hide",label:"Hide Column",icon:Lt.Hide,onClick:()=>d(W),disabled:W==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:Lt.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:Lt.SortDesc,onClick:()=>{}}],Ge=W=>W.subtasks&&W.subtasks.length>0?[{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{D?.(W.id);}},{id:"duplicate",label:F?.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{h?.([W.id]);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{C?C(W.id,W.name):y?.([W.id]);}}]:[{id:"edit",label:F?.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{n?.(W);}},{id:"addSubtask",label:F?.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{D?.(W.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:F?.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{f?.(W.id,{status:"todo",progress:0});},disabled:W.status==="todo"},{id:"setInProgress",label:F?.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{f?.(W.id,{status:"in-progress"});},disabled:W.status==="in-progress"},{id:"markComplete",label:F?.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{f?.(W.id,{status:"completed",progress:100});},disabled:W.status==="completed"},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:F?.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{h?.([W.id]);}},{id:"split",label:F?.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:F?.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{C?C(W.id,W.name):y?.([W.id]);}}],be=c.filter(W=>W.visible),Ue=be.reduce((W,ce)=>W+ce.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ue},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.bgGrid,height:`${q}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:be.map((W,ce)=>{let vt=ce===be.length-1,U=W.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${U?"":"justify-center"}`,style:{width:`${W.width}px`,minWidth:`${W.minWidth??(U?200:60)}px`,maxWidth:`${W.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:vt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ae=>{ae.preventDefault(),xe({isOpen:true,x:ae.clientX,y:ae.clientY,type:"header",columnId:W.id});},onMouseEnter:ae=>{ae.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ae=>{ae.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:W.label,children:W.label}),W.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"8px",marginRight:"-4px",backgroundColor:Ae===W.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ae=>{ae.preventDefault(),ae.stopPropagation(),L(W.id),ee(ae.clientX),B(W.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"}})})]},W.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.bgGrid,zIndex:5},children:[jsx(ks,{columns:c,onToggleColumn:d,theme:t}),jsx("button",{onClick:()=>le(!K),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),K&&jsxs("div",{ref:De,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:W=>W.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:()=>le(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsx("div",{className:"gantt-taskgrid-content",style:{minHeight:ke},children:G.map(({task:W,level:ce},vt)=>{let U=ct(W.id),ae=ve===W.id,Le=ae&&re==="above",dt=ae&&re==="below",Ze=ae&&re==="child",qt={};return Ze&&(qt.backgroundColor=`${t.accent}15`,qt.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":W.id,className:`flex items-center cursor-pointer group ${fe===W.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:U?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:U?t.accentLight:Ze?`${t.accent}15`:vt%2===0?t.bgPrimary:t.bgGrid,...qt},onMouseEnter:()=>H(W.id),onMouseLeave:()=>H(null),onClick:ft=>{let Vt=Xo(e).map(Me=>Me.id),Wr=navigator.platform.toUpperCase().indexOf("MAC")>=0?ft.metaKey:ft.ctrlKey;ot(W.id,Vt,Wr,ft.shiftKey),s?.(W);},onDoubleClick:ft=>{ft.stopPropagation(),n?.(W);},onContextMenu:ft=>{ft.preventDefault(),xe({isOpen:true,x:ft.clientX,y:ft.clientY,type:"task",task:W}),l?.(W,ft);},whileHover:{backgroundColor:U?t.accentLight:t.hoverBg},children:[Le&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),dt&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),be.map((ft,Fa)=>{let Vt=Fa===be.length-1,Ea=ft.id==="name";return jsx("div",{className:`px-4 flex items-center ${Ea?"justify-start":"justify-center"}`,style:{width:`${ft.width}px`,minWidth:`${ft.minWidth??(Ea?200:60)}px`,maxWidth:`${ft.maxWidth??2e3}px`,flexShrink:0,flexGrow:0,borderRight:Vt?"none":`1px solid ${T===W.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},children:et(ft,W,Ea?ce:0)},`${W.id}-${ft.id}`)})]},W.id)})}),jsx(Yo,{isOpen:te.isOpen,x:te.x,y:te.y,items:te.type==="header"&&te.columnId?tt(te.columnId):te.type==="task"&&te.task?Ge(te.task):[],onClose:()=>xe({...te,isOpen:false}),theme:t}),Ne&&Xe&&fe&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Xe.x+12,top:Xe.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let W=G.find(ce=>ce.task.id===fe)?.task;return W?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:W.name})}):null})()}),document.body)]})}function Wu(e,t){let[a,r]=useState("none"),[o,s]=useState(0),[n,l]=useState(e),[u,i]=useState(t),[c,d]=useState(null),[p,f]=useState(null),[v,k]=useState(null),[g,y]=useState(null),[h,b]=useState(0),[x,D]=useState(0),[N,C]=useState(null),[w,R]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:o,setDragOffset:s,ghostX:n,setGhostX:l,ghostWidth:u,setGhostWidth:i,connectionLine:c,setConnectionLine:d,hoveredTaskId:p,setHoveredTaskId:f,activeZone:v,setActiveZone:k,draggedSegmentIndex:g,setDraggedSegmentIndex:y,draggedSegmentStartX:h,setDraggedSegmentStartX:b,segmentDragOffsetX:x,setSegmentDragOffsetX:D,hoveredSegmentIndex:N,setHoveredSegmentIndex:C,isHovered:w,setIsHovered:R,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(se,S)=>{r("none"),d(null),f(null),l(se),i(S),D(0),y(null),b(0);}}}function Ds({task:e,x:t,y:a,width:r,theme:o,dayWidth:s,startDate:n,templates:l,onClick:u,onDoubleClick:i,onContextMenu:c,onDateChange:d,onDependencyCreate:p,allTaskPositions:f=[],onDragMove:v,onHoverChange:k}){let g=Wu(t,r),y=useRef(null),h=useRef(null),b=useRef(null),{dragMode:x,setDragMode:D,dragOffset:N,setDragOffset:C,ghostX:w,setGhostX:R,ghostWidth:F,setGhostWidth:T,connectionLine:H,setConnectionLine:A,hoveredTaskId:se,setHoveredTaskId:S,activeZone:j,setActiveZone:ie,draggedSegmentIndex:Ae,setDraggedSegmentIndex:L,draggedSegmentStartX:ge,setDraggedSegmentStartX:ee,segmentDragOffsetX:Ke,setSegmentDragOffsetX:B,hoveredSegmentIndex:te,setHoveredSegmentIndex:xe,isHovered:fe,setIsHovered:He,isDragging:ve,isResizing:_e,isConnecting:re,resetDragState:V}=g,Y=24,me=8,Te=e.endDate&&e.endDate<new Date&&e.progress<100,Xe=e.isCriticalPath,z=o.name==="neutral"||o.today==="#1C1917",Ne=e.status==="completed"||e.progress===100,Pe={low:"#2ECC71",LOW:"#2ECC71",medium:"#F1C40F",MEDIUM:"#F1C40F",high:"#E67E22",HIGH:"#E67E22",urgent:"#E74C3C",URGENT:"#E74C3C"},J=e.isCriticalPath||Te?"#DC2626":e.color?e.color:e.priority&&Pe[e.priority]?Pe[e.priority]:o.taskBarPrimary,K=($=>$>=80?20:$>=60?15:$>=50?12:10)(r),le=r<50,De=r<40;useEffect(()=>{if(k)if(fe&&!ve&&!e.segments){let $=a<100;k({task:e,x:t,y:a,width:r,height:Y,showBelow:$});}else k(null);},[fe,ve,e,t,a,r,Y,k]);let je=$=>$.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),ot=()=>{let $=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${$} day${$!==1?"s":""}`},ct=$=>Math.round($/s)*s,qe=$=>{let de=Math.round($/s),Oe=new Date(n);return Oe.setDate(Oe.getDate()+de),Oe},sa=($,de)=>{for(let Oe of f){if(Oe.id===e.id)continue;let et=5;if($>=Oe.x-et&&$<=Oe.x+Oe.width+et&&de>=Oe.y-et&&de<=Oe.y+Oe.height+et)return Oe.id}return null},G=useCallback(($,de,Oe)=>{$.preventDefault(),$.stopPropagation();let et=y.current?.ownerSVGElement;if(!et)return;let tt=et.createSVGPoint();tt.x=$.clientX,tt.y=$.clientY;let Ge=tt.matrixTransform(et.getScreenCTM()?.inverse()),be=Oe!==void 0?Oe:t,Ue=de;if(!Ue){let W=Ge.x-be;$.shiftKey?(Ue="connect",A({x:t+r,y:a+Y/2})):$.ctrlKey||$.metaKey?Ue="move":$.altKey?Ue=W<r/2?"resize-start":"resize-end":De?W<r/2?Ue="move":Ue="resize-end":le?W<=K/2?Ue="resize-start":W>=r-K/2?Ue="resize-end":Ue="move":W<=K?Ue="resize-start":W>=r-K?Ue="resize-end":Ue="move";}D(Ue),He(false),ie(null),Ue==="move"?C(Ge.x-be):Ue==="connect"?A({x:t+r,y:a+Y/2}):C(0),R(be),T(r);},[t,r,a,Y]),q=useCallback($=>{let de=y.current?.ownerSVGElement;if(!de)return;let Oe=de.closest(".gantt-timeline-scroll");if(!Oe)return;let et=Oe.getBoundingClientRect(),tt=60,Ge=15,be=0;if($.clientX<et.left+tt){let Ue=et.left+tt-$.clientX;be=-Math.min(Ge,Ue/2);}else if($.clientX>et.right-tt){let Ue=$.clientX-(et.right-tt);be=Math.min(Ge,Ue/2);}return be!==0&&(Oe.scrollLeft+=be),be!==0},[]),ke=useCallback($=>{if(x==="none")return;b.current=$;let de=y.current?.ownerSVGElement;if(!de)return;if(x==="move"||x==="resize-start"||x==="resize-end"){let tt=q($);tt&&!h.current?h.current=window.setInterval(()=>{b.current&&(q(b.current),ke(b.current));},16):!tt&&h.current&&(window.clearInterval(h.current),h.current=null);}let Oe=de.createSVGPoint();Oe.x=$.clientX,Oe.y=$.clientY;let et=Oe.matrixTransform(de.getScreenCTM()?.inverse());if(x==="connect"){A({x:et.x,y:et.y});let tt=sa(et.x,et.y);S(tt);}else if(x==="move"){let tt=et.x-N,Ge=ct(tt);R(Ge),T(r);let be=Math.round((Ge-t)/s);if(v?.(e.id,be,true),e.segments&&e.segments.length>0&&Ae!==null){let Ue=Ge-ge;B(Ue);}}else if(x==="resize-start"){let tt=et.x,Ge=ct(tt),be=t+r-Ge;be>=s&&(R(Ge),T(be));}else if(x==="resize-end"){let tt=et.x,be=ct(tt)-t;be>=s&&T(be);}},[x,t,r,s,N,e,ct,Ae,ge,sa,S,A,R,T,B,v,q]),rt=useCallback(()=>{if(h.current&&(window.clearInterval(h.current),h.current=null),b.current=null,x!=="none"){if(x==="connect")se&&p&&p(e,se),A(null),S(null);else {let $=e.endDate.getTime()-e.startDate.getTime(),de,Oe,et=true;if(x==="move"){if(de=qe(w),Oe=new Date(de.getTime()+$),e.segments&&e.segments.length>0&&Ae!==null){let tt=Math.round(Ke/s),Ge=e.segments.map((ce,vt)=>{if(vt===Ae){let U=new Date(ce.startDate),ae=new Date(ce.endDate);return U.setDate(U.getDate()+tt),ae.setDate(ae.getDate()+tt),{startDate:U,endDate:ae}}return ce}),be=Ge.flatMap(ce=>[ce.startDate,ce.endDate]),Ue=new Date(Math.min(...be.map(ce=>ce.getTime()))),W=new Date(Math.max(...be.map(ce=>ce.getTime())));d?.({...e,segments:Ge},Ue,W),V(t,r);return}}else x==="resize-start"?(de=qe(w),Oe=e.endDate,de>Oe&&(console.warn("Invalid date range: start date must be before or equal to end date"),et=false)):x==="resize-end"?(de=e.startDate,Oe=qe(w+F),Oe<de&&(console.warn("Invalid date range: end date must be after or equal to start date"),et=false)):et=false;et&&de&&Oe&&(Oe.getTime()<de.getTime()?console.warn("Invalid date range: end date cannot be before start date"):d?.(e,de,Oe));}v?.(e.id,0,false),V(t,r);}},[x,w,F,e,d,se,p,t,r,s,qe,Ke,Ae,V,v]);useEffect(()=>{if(x==="none")return;let $=Oe=>{ke(Oe);},de=()=>{rt();};return window.addEventListener("mousemove",$),window.addEventListener("mouseup",de),()=>{window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",de),h.current&&(window.clearInterval(h.current),h.current=null);}},[x,ke,rt]);let Se=ve&&!re?w:t,Re=ve&&!re?F:r,X=l.taskClass(e);return jsxs("g",{ref:y,"data-task-bar":"true",onClick:()=>!ve&&u?.(e),onDoubleClick:$=>{ve||($.stopPropagation(),i?.(e));},onContextMenu:$=>{$.preventDefault(),c?.(e,$);},onMouseEnter:()=>!ve&&He(true),onMouseLeave:()=>{ve||(He(false),ie(null));},children:[jsx("rect",{x:t,y:a,width:r+24,height:Y,fill:"transparent",style:{pointerEvents:"all"}}),fe&&!ve&&!le&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:K,height:Y,fill:j==="resize-start"?o.accent:"transparent",opacity:j==="resize-start"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-start"),onMouseDown:$=>G($,"resize-start")}),jsx("rect",{x:t+K,y:a,width:r-K*2,height:Y,fill:j==="move"?o.accent:"transparent",opacity:j==="move"?.1:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:$=>G($,"move")}),jsx("rect",{x:t+r-K,y:a,width:K,height:Y,fill:j==="resize-end"?o.accent:"transparent",opacity:j==="resize-end"?.15:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:$=>G($,"resize-end")})]}),fe&&!ve&&De&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Y,fill:j==="move"?o.accent:"transparent",opacity:j==="move"?.2:0,style:{cursor:"grab",pointerEvents:"all"},onMouseEnter:()=>ie("move"),onMouseDown:$=>G($,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Y,fill:j==="resize-end"?o.accent:"transparent",opacity:j==="resize-end"?.2:0,style:{cursor:"ew-resize",pointerEvents:"all"},onMouseEnter:()=>ie("resize-end"),onMouseDown:$=>G($,"resize-end")}),fe&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Y-4,stroke:o.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),ve&&!re&&!e.segments&&jsx(motion.rect,{x:w,y:a,width:F,height:Y,rx:me,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:Se,y:a,width:Re,height:Y,rx:me,fill:J,"data-task-class":X,initial:{opacity:0,scale:.95},animate:{opacity:ve&&!re?.15:e.parentId?.6:fe?.9:.8,scale:fe&&!ve?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:$=>G($),style:{cursor:ve?re?"crosshair":_e?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),!e.segments&&jsx("rect",{x:Se,y:a,width:Re*(e.progress/100),height:Y,rx:me,fill:J,opacity:1,style:{pointerEvents:"none"}}),e.segments&&e.segments.map(($,de)=>{let Oe=($.startDate.getTime()-n.getTime())/864e5*s,tt=($.endDate.getTime()-n.getTime())/(1e3*60*60*24)*s-Oe+s,Ge=ve&&x==="move"&&Ae===de,be=te===de,Ue=Ge?Oe+Ke:Oe;return jsxs("g",{onMouseEnter:()=>!ve&&xe(de),onMouseLeave:()=>!ve&&xe(null),children:[jsx(motion.rect,{x:Ue,y:a,width:tt,height:Y,rx:me,fill:J,initial:{opacity:0,scale:.95},animate:{opacity:Ge||e.parentId?.6:be?.9:.8,scale:be&&!ve?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:W=>{W.stopPropagation(),L(de),ee(Oe),G(W,void 0,Oe);},style:{cursor:ve?re?"crosshair":_e?"ew-resize":"grabbing":"grab",pointerEvents:"all"}}),jsx("rect",{x:Ue,y:a,width:tt*(e.progress/100),height:Y,rx:me,fill:J,opacity:1,style:{pointerEvents:"none"}})]},`segment-${de}`)}),z&&(Te||Xe)&&!e.segments&&jsxs(Fragment,{children:[Xe&&!Te&&jsx("rect",{x:Se,y:a,width:Re,height:Y,rx:me,fill:"none",stroke:o.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),Te&&jsx("rect",{x:Se,y:a,width:Re,height:Y,rx:me,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),Re>60&&!e.segments&&(()=>{let $=l.taskLabel(e),de=typeof $=="string"?$:e.name,Oe=de.length>Math.floor(Re/8)?`${de.substring(0,Math.floor(Re/8))}...`:de;return jsx("text",{x:Se+12,y:a+Y/2,dominantBaseline:"middle",fill:Ne?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"13",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ne?"line-through":"none"},children:Oe})})(),Re>100&&e.progress>0&&e.progress<100&&!ve&&!e.segments&&jsxs("text",{x:Se+Re-12,y:a+Y/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&&Re>80&&!ve&&!e.segments&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Se+Re-8,cy:a+8,r:4,fill:o.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Se+Re-8,cy:a+8,r:4,fill:o.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(fe||_e)&&!re&&!e.segments&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Se-2,y:a,width:16,height:Y,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-start"),onMouseLeave:()=>ie(null),onMouseDown:$=>{$.stopPropagation(),G($,"resize-start");}}),jsx(motion.rect,{x:Se+4,y:a+8,width:3,height:Y-16,rx:1.5,fill:j==="resize-start"||x==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Se+Re-14,y:a,width:16,height:Y,fill:"transparent",style:{cursor:"ew-resize"},onMouseEnter:()=>ie("resize-end"),onMouseLeave:()=>ie(null),onMouseDown:$=>{$.stopPropagation(),G($,"resize-end");}}),jsx(motion.rect,{x:Se+Re-7,y:a+8,width:3,height:Y-16,rx:1.5,fill:j==="resize-end"||x==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:fe&&!ve&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Y/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ie("connect"),onMouseLeave:()=>ie(null),onMouseDown:$=>{$.stopPropagation(),G($,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Y/2,r:4,fill:o.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:j==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),re&&H&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Y/2,x2:H.x,y2:H.y,stroke:se?o.statusCompleted:o.accent,strokeWidth:se?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:se?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:H.x,cy:H.y,r:se?8:6,fill:se?o.statusCompleted:o.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),se&&jsx(motion.text,{x:H.x+15,y:H.y,dominantBaseline:"middle",fill:o.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:H.x+10},animate:{opacity:1,x:H.x+15},transition:{duration:.2},children:"Connect"})]}),(fe||ve)&&!re&&!e.segments&&jsx(motion.rect,{x:Se-2,y:a-2,width:Re+4,height:Y+4,rx:me+2,fill:"none",stroke:ve?o.accent:o.taskBarPrimary,strokeWidth:2,opacity:ve?.6:.4,initial:{opacity:0},animate:{opacity:ve?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),_e&&jsxs(Fragment,{children:[jsx("line",{x1:w,y1:0,x2:w,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:w+F,y1:0,x2:w+F,y2:1e3,stroke:o.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:fe&&!ve&&!e.segments&&!k&&(()=>{let Oe=a<100,et=Oe?a+Y+13:a-82-13,tt=Oe?`M ${Se+Re/2-6} ${a+Y+3} L ${Se+Re/2} ${a+Y+13} L ${Se+Re/2+6} ${a+Y+3}`:`M ${Se+Re/2-6} ${a-13} L ${Se+Re/2} ${a-3} L ${Se+Re/2+6} ${a-13}`,Ge=et+22,be=et+40,Ue=et+55,W=et+70,ce=Oe?et+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:Oe?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:Oe?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:tt,fill:o.bgSecondary,stroke:o.border,strokeWidth:1}),jsx("rect",{x:Se+Re/2-120,y:et,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:Se+Re/2,y:Ge,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:Se+Re/2-110,y:be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Se+Re/2-70,y:be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:je(e.startDate)}),jsx("text",{x:Se+Re/2-110,y:Ue,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Se+Re/2-70,y:Ue,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:je(e.endDate)}),jsx("text",{x:Se+Re/2+10,y:be,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Se+Re/2+65,y:be,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:ot()}),jsx("text",{x:Se+Re/2+10,y:Ue,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Se+Re/2+65,y:Ue,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:Se+Re/2-110,y:W,fill:o.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Se+Re/2-50,y:W,fill:o.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(vt=>vt.name).join(", ").substring(0,30),e.assignees.map(vt=>vt.name).join(", ").length>30?"...":""]})]}),!Oe&&jsx("text",{x:Se+Re/2,y:ce,textAnchor:"middle",fill:o.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:De?"Left: move \u2022 Right: resize":le?"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 _u({tooltipData:e,theme:t,locale:a="en"}){if(!e)return null;let {task:r,x:o,y:s,width:n,height:l,showBelow:u}=e,i=r.effortMinutes!=null||r.timeLoggedMinutes!=null||r.soldEffortMinutes!=null,c=i?130:82,d=13,p=u?s+l+d:s-c-d,f=u?`M ${o+n/2-6} ${s+l+3} L ${o+n/2} ${s+l+13} L ${o+n/2+6} ${s+l+3}`:`M ${o+n/2-6} ${s-13} L ${o+n/2} ${s-3} L ${o+n/2+6} ${s-13}`,v=p+22,k=p+40,g=p+55,y=p+70,h=p+90,b=p+105,x=p+120,D=T=>T.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),N=()=>{if(!r.startDate||!r.endDate)return "N/A";let T=Math.ceil((r.endDate.getTime()-r.startDate.getTime())/(1e3*60*60*24));return `${T} day${T!==1?"s":""}`},C=T=>{if(T==null||T===0)return "N/A";let H=Math.floor(T/60),A=T%60;return H===0?`${A}m`:A===0?`${H}h`:`${H}h ${A}m`},w={start:a==="es"?"Inicio:":"Start:",end:a==="es"?"Fin:":"End:",duration:a==="es"?"Duraci\xF3n:":"Duration:",progress:a==="es"?"Progreso:":"Progress:",assignees:a==="es"?"Asignados:":"Assignees:",estimated:a==="es"?"Estimado:":"Estimated:",logged:a==="es"?"Registrado:":"Logged:",quoted:a==="es"?"Ofertado:":"Quoted:"};return jsx(AnimatePresence,{children:jsxs(motion.g,{initial:{opacity:0,y:u?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:u?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:f,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("rect",{x:o+n/2-120,y:p,width:240,height:c,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:o+n/2,y:v,textAnchor:"middle",fill:t.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:r.name.length>28?`${r.name.substring(0,28)}...`:r.name}),jsx("text",{x:o+n/2-110,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.start}),jsx("text",{x:o+n/2-70,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.startDate?D(r.startDate):"N/A"}),jsx("text",{x:o+n/2-110,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.end}),jsx("text",{x:o+n/2-70,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:r.endDate?D(r.endDate):"N/A"}),jsx("text",{x:o+n/2+10,y:k,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.duration}),jsx("text",{x:o+n/2+65,y:k,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:N()}),jsx("text",{x:o+n/2+10,y:g,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.progress}),jsxs("text",{x:o+n/2+65,y:g,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.progress,"%"]}),r.assignees&&r.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.assignees}),jsxs("text",{x:o+n/2-50,y,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[r.assignees.map(T=>T.name).join(", ").substring(0,30),r.assignees.map(T=>T.name).join(", ").length>30?"...":""]})]}),i&&jsxs(Fragment,{children:[r.effortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:h,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.estimated}),jsx("text",{x:o+n/2-50,y:h,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C(r.effortMinutes)})]}),r.timeLoggedMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:b,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.logged}),jsx("text",{x:o+n/2-50,y:b,fill:t.accent,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",children:C(r.timeLoggedMinutes)})]}),r.soldEffortMinutes!=null&&jsxs(Fragment,{children:[jsx("text",{x:o+n/2-110,y:x,fill:t.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:w.quoted}),jsx("text",{x:o+n/2-50,y:x,fill:t.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:C(r.soldEffortMinutes)})]})]})]})})}function Dn({x1:e,y1:t,x2:a,y2:r,theme:o,onDelete:s,lineStyle:n="curved",isHoverLayer:l=false,onHoverChange:u,hoverOverlayOnly:i=false}){let[,c]=useState(false),[d,p]=useState(null),f=r-t,v=f>0,k=Math.abs(f)<5,g=20,y=!k&&a<=e,h,b,x=a-e,D=e+x/2;if(b=D,n==="squared")if(k)h=`M ${e} ${t} L ${a} ${r}`;else if(y){let L=e+15,ge=a-g,ee=v?t+20:t-20;b=ge,h=`M ${e} ${t} L ${L} ${t} L ${L} ${ee} L ${ge} ${ee} L ${ge} ${r} L ${a} ${r}`;}else b=a-g,h=`M ${e} ${t} L ${b} ${t} L ${b} ${r} L ${a} ${r}`;else h=`M ${e} ${t} C ${D} ${t}, ${D} ${r}, ${a} ${r}`;let N=5,C=`M ${a} ${r} L ${a-N} ${r-N*.5} M ${a} ${r} L ${a-N} ${r+N*.5}`,w=o.dependency,R=o.dependencyHover||w,F="#f87171",T="rgba(248, 113, 113, 0.15)",H=b,A=(t+r)/2;if(d)if(k)H=Math.max(e+10,Math.min(a-10,d.x)),A=t;else if(y){let Ae=e+15,L=a-g,ge=v?t+20:t-20,ee=[[e,t,Ae,t],[Ae,t,Ae,ge],[Ae,ge,L,ge],[L,ge,L,r],[L,r,a,r]],Ke=1/0,B={x:H,y:A};for(let te of ee){let xe=se(d.x,d.y,te[0],te[1],te[2],te[3]),fe=Math.hypot(d.x-xe.x,d.y-xe.y);fe<Ke&&(Ke=fe,B=xe);}H=B.x,A=B.y;}else {let Ae=[[e,t,b,t],[b,t,b,r],[b,r,a,r]],L=1/0,ge={x:H,y:A};for(let ee of Ae){let Ke=se(d.x,d.y,ee[0],ee[1],ee[2],ee[3]),B=Math.hypot(d.x-Ke.x,d.y-Ke.y);B<L&&(L=B,ge=Ke);}H=ge.x,A=ge.y;}function se(Ae,L,ge,ee,Ke,B){let te=Ke-ge,xe=B-ee,fe=te*te+xe*xe;if(fe===0)return {x:ge,y:ee};let He=((Ae-ge)*te+(L-ee)*xe)/fe;return He=Math.max(0,Math.min(1,He)),{x:ge+He*te,y:ee+He*xe}}let S=Ae=>{let L=Ae.currentTarget.ownerSVGElement;if(!L)return;let ge=L.getBoundingClientRect();p({x:Ae.clientX-ge.left,y:Ae.clientY-ge.top});},j=()=>{c(false),p(null),u?.(false);},ie=()=>{c(true),u?.(true);};return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:j,onMouseMove:S,children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:R,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:R,opacity:.9,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Ae=>{Ae.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:H,cy:A,r:9,fill:T,stroke:F,strokeWidth:1.5}),jsx("line",{x1:H-3,y1:A-3,x2:H+3,y2:A+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:H+3,y1:A-3,x2:H-3,y2:A+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"})]})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:ie,onMouseLeave:j,onMouseMove:S,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:h,fill:"none",stroke:o.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:h,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:R,strokeWidth:2,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:R,style:{pointerEvents:"none"}}),s&&jsxs(motion.g,{initial:{opacity:0,scale:0},animate:{opacity:1,scale:1},transition:{duration:.15},onClick:Ae=>{Ae.stopPropagation(),s();},style:{cursor:"pointer"},children:[jsx("circle",{cx:H,cy:A,r:9,fill:T,stroke:F,strokeWidth:1.5}),jsx("line",{x1:H-3,y1:A-3,x2:H+3,y2:A+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"}),jsx("line",{x1:H+3,y1:A-3,x2:H-3,y2:A+3,stroke:F,strokeWidth:1.5,strokeLinecap:"round"})]})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:ie,onMouseLeave:j,onMouseMove:S,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:h,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none"}}),jsx(motion.path,{d:C,fill:"none",stroke:w,strokeWidth:2,strokeLinecap:"round",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:w,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Es({task:e,x:t,y:a,theme:r,onClick:o}){let[s,n]=useState(false),l=16,u=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>n(true),onMouseLeave:()=>n(false),onClick:()=>o?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:l+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{x:t-l/2,y:a+16-l/2,width:l,height:l,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-(l+4)/2,y:a+16-(l+4)/2,width:l+4,height:l+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:u(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 Ce={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=i=>{i.forEach(c=>{c.dependencies&&r.set(c.id,c.dependencies),c.subtasks&&o(c.subtasks);});};o(e);let s=r.get(a)||[];r.set(a,[...s,t]);let n=new Set,l=new Set,u=i=>{if(!n.has(i)){n.add(i),l.add(i);let c=r.get(i)||[];for(let d of c){if(!n.has(d)&&u(d))return true;if(l.has(d))return true}}return l.delete(i),false};return u(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,n)=>(s.position??0)-(n.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ce.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ce.findTaskById(e,t);if(!r||!r.parentId)return a;let o=r.parentId;for(;o;){let s=Ce.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=Ce.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(`
|
|
126
126
|
`)},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=Ce.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=Ce.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)=>Ce.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ce.findTaskById(e,t);return !a||!a.dependencies?[]:Ce.flattenTasks(e).filter(o=>a.dependencies.includes(o.id))},filterByStatus:(e,t)=>Ce.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ce.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=Ce.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=>Ce.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=Ce.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 n=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(u=>{let i=u.startDate&&u.endDate?Ce.calculateDuration(u.startDate,u.endDate):0;return [u.name,u.startDate?Ce.formatDate(u.startDate):"N/A",u.endDate?Ce.formatDate(u.endDate):"N/A",i>0?`${i} days`:"N/A",`${u.progress}%`,u.status||"N/A"]});r(o,{head:n,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),o.save(t);}catch(a){throw a}},exportToExcel:async(e,t="gantt-chart.xlsx")=>{let a=await import('xlsx'),o=Ce.flattenTasks(e).map(u=>{let i=u.startDate&&u.endDate?Ce.calculateDuration(u.startDate,u.endDate):0;return {"Task ID":u.id,"Task Name":u.name,"Start Date":u.startDate?Ce.formatDate(u.startDate):"","End Date":u.endDate?Ce.formatDate(u.endDate):"","Duration (days)":i>0?i:"","Progress (%)":u.progress,Status:u.status||"",Assignees:u.assignees?.map(c=>c.name).join(", ")||"",Dependencies:u.dependencies?.join(", ")||"","Is Milestone":u.isMilestone?"Yes":"No","Parent ID":u.parentId||"",Level:u.level||0}}),s=a.utils.json_to_sheet(o),n=[{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"]=n;let l=a.utils.book_new();a.utils.book_append_sheet(l,s,"Gantt Tasks"),a.writeFile(l,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Ce.flattenTasks(e),o=new Map;r.forEach((p,f)=>{o.set(p.id,f+1);});let s=p=>p.toISOString().replace("Z",""),n=Ce.getEarliestStartDate(e)||new Date,l=Ce.getLatestEndDate(e)||new Date,u=r.map((p,f)=>{let v=o.get(p.id),k=p.startDate&&p.endDate?Ce.calculateDuration(p.startDate,p.endDate):0,g=(p.dependencies||[]).filter(y=>o.has(y)).map(y=>`
|
|
127
127
|
<PredecessorLink>
|
|
128
128
|
<PredecessorUID>${o.get(y)}</PredecessorUID>
|
|
@@ -353,9 +353,9 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
353
353
|
</Calendars>
|
|
354
354
|
<Tasks>${u}
|
|
355
355
|
</Tasks>
|
|
356
|
-
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Ce.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?Ce.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let v=t.find(k=>k.id===f);if(v){o(v);let k=r.get(f)?.ef||0;d=Math.max(d,k);}}let p=d+c;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?Ce.calculateDuration(i.startDate,i.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),p=s;if(d.length>0)for(let v of d){l(v);let k=n.get(v.id)?.ls||0;p=Math.min(p,k);}let f=p-c;n.set(i.id,{ls:f,lf:p});};a.forEach(l);let u=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let p=d.ls-c.es;Math.abs(p)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let a=Ce.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ce.calculateCriticalPath(e).includes(t))return 0;let o=Ce.getDependentTasks(e,t);if(o.length===0){let l=Ce.getLatestEndDate(e);if(!l)return null;let u=Ce.calculateDuration(a.endDate,l);return Math.max(0,u)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,u)=>l-u)[0];if(!s)return null;let n=Ce.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Ce.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Ce.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Ce.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=Ce.calculateDuration(n.startDate,n.endDate),u;a!==void 0?(u=new Date(n.startDate),u.setDate(u.getDate()+a)):(u=new Date(r.endDate),u.setDate(u.getDate()+1));let i=Ce.calculateEndDate(u,l),c=d=>d.map(p=>p.id===n.id?{...p,startDate:u,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=Ce.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let u=[],i=o.getTime(),c=1e3*60*60*24,d=Ce.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(f,v,k=new Set)=>{if(k.has(f))return;k.add(f);let g=Ce.getDependentTasks(e,f);for(let y of g){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(T=>T.id===y.id);if(h===-1)continue;let b=y.startDate.getTime(),D=(y.endDate.getTime()-b)/c,C=(b-i)/c*s,w=C+v*s,R=Math.max(D*s,s),A=l+h*n+12;u.push({taskId:y.id,taskName:y.name,originalX:C,previewX:w,width:R,y:A,rowIndex:h,daysDelta:v,color:y.color}),p(y.id,v,k);}};return p(t,a),u},splitTask:(e,t,a,r=3)=>{let o=Ce.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 n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:u}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ps({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:u,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:k}){let y=Qr(),[h,b]=useState([]),[x,D]=useState(null),[N,C]=useState(null),w=useRef(false),[R,A]=useState(new Set),[T,H]=useState(null),L=useCallback(_=>{if(N&&!w.current){let q=_.target,ge=false;for(;q&&q!==_.currentTarget;){if(q.getAttribute?.("data-dependency-line")==="true"||q.getAttribute?.("data-dependency-hover-overlay")==="true"){ge=true;break}q=q.parentElement;}ge||C(null);}},[N]),ne=useCallback(_=>{D(_);},[]),S=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),V=r==="day"?60:r==="week"?20:8,ie=S*V*n,Me=_=>{let q=new Date(Date.UTC(_.getFullYear(),_.getMonth(),_.getDate())),ge=q.getUTCDay()||7;q.setUTCDate(q.getUTCDate()+4-ge);let De=new Date(Date.UTC(q.getUTCFullYear(),0,1));return Math.ceil(((q.getTime()-De.getTime())/864e5+1)/7)},F=_=>{let q=_.getDay();return q===0||q===6},ye=useCallback(_=>{let q=Math.round(_/(V*n)),ge=new Date(o);return ge.setDate(ge.getDate()+q),ge},[o,V,n]),Q=useCallback((_,q)=>{if(q.startDate&&q.endDate)return;let ge=_.currentTarget.ownerSVGElement;if(!ge)return;let De=ge.createSVGPoint();De.x=_.clientX,De.y=_.clientY;let qe=De.matrixTransform(ge.getScreenCTM()?.inverse()),Se=ye(qe.x),ot=new Date(Se);ot.setDate(ot.getDate()+1),H(null),f?.(q,Se,ot);},[ye,f]),te=useCallback((_,q,ge)=>{let De=_.currentTarget.ownerSVGElement;if(!De)return;let qe=De.createSVGPoint();qe.x=_.clientX,qe.y=_.clientY;let Se=qe.matrixTransform(De.getScreenCTM()?.inverse()),ot=ye(Se.x),Qe=Math.round(Se.x/(V*n))*V*n;H({taskId:q.id,x:Qe,y:ge*a+a/2,date:ot});},[ye,V,n,a]),B=useCallback(()=>{H(null);},[]),X=useMemo(()=>{let _=qe=>qe.map(Se=>{if(Se.subtasks&&Se.subtasks.length>0){let ot=_(Se.subtasks),We=ot.filter(Qe=>Qe.startDate&&Qe.endDate);if(We.length>0){let Qe=We.map(le=>le.startDate.getTime()),ae=We.map(le=>le.endDate.getTime()),I=new Date(Math.min(...Qe)),j=new Date(Math.max(...ae));return {...Se,subtasks:ot,startDate:I,endDate:j}}return {...Se,subtasks:ot}}return Se}),q=(qe,Se=[])=>{let ot=[...qe].sort((We,Qe)=>(We.position??0)-(Qe.position??0));for(let We of ot)Se.push(We),We.subtasks&&We.subtasks.length>0&&(We.isExpanded===void 0||We.isExpanded)&&q(We.subtasks,Se);return Se},ge=_(e);return q(ge)},[e]),me=useCallback(_=>{if(!_.startDate||!_.endDate)return {x:0,width:0};let q=_.startDate.getTime(),ge=_.endDate.getTime(),De=o.getTime(),qe=(q-De)/(1e3*60*60*24),Se=(ge-q)/(1e3*60*60*24),ot=qe*V*n,We=Math.max(V*n,40),Qe=Math.max(Se*V*n,We);return {x:ot,width:Qe}},[o,V,n]),fe=useMemo(()=>X.filter(_=>_.startDate&&_.endDate).map(_=>{let{x:q,width:ge}=me(_),qe=X.findIndex(Se=>Se.id===_.id)*a+14;return {id:_.id,x:q,y:qe,width:ge,height:24}}),[X,me]),Ge=useCallback((_,q,ge)=>{if(!ge||q===0){b([]);return}let De=Ce.calculateCascadePreview(e,_,q,X,o,V*n,a,48);b(De);},[e,X,o,V,n,a,48]),be=useMemo(()=>{let _=[],q=new Date(o);for(;q<=s;){let qe=(q.getTime()-o.getTime())/864e5*V*n;if(r==="day")_.push({date:new Date(q),label:q.toLocaleDateString(l,{day:"numeric",month:"short"}),x:qe}),q.setDate(q.getDate()+1);else if(r==="week"){let Se=Me(q);_.push({date:new Date(q),label:`${y.labels.week} ${Se}`,x:qe}),q.setDate(q.getDate()+7);}else _.push({date:new Date(q),label:q.toLocaleDateString(l,{month:"short",year:"numeric"}),x:qe}),q.setMonth(q.getMonth()+1);}return _},[o,s,r,V,n,l,y.labels.week]),Ve=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*V*n,[o,V,n]),re=Math.max(X.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},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(ie,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(ie,1e3),height:48,fill:t.bgGrid}),be.map((_,q)=>jsxs("g",{children:[q>0&&jsx("line",{x1:_.x,y1:0,x2:_.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:_.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:_.label})]},`header-${q}`)),Ve>=0&&Ve<=ie&&jsx("circle",{cx:Ve,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(ie,1e3),height:re,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:L,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(ie,1e3),height:re,fill:t.bgPrimary}),be.map((_,q)=>{let ge=be[q+1]?.x||ie,De=F(_.date);return jsxs("g",{children:[De&&jsx("rect",{x:_.x,y:0,width:ge-_.x,height:X.length*a,fill:t.bgWeekend,opacity:1}),q>0&&jsx("line",{x1:_.x,y1:0,x2:_.x,y2:X.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},q)}),X.map((_,q)=>{let ge=_.startDate&&_.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:q*a,width:ie,height:a,fill:q%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${_.id}`),!ge&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:q*a,width:ie,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:De=>Q(De,_),onMouseMove:De=>te(De,_,q),onMouseLeave:()=>{B();}},`clickable-${_.id}`),T&&T.taskId===_.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:T.x,y1:q*a+4,x2:T.x,y2:q*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:T.x,cy:T.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:T.x,cy:T.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${T.x}, ${q*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:T.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!T||T.taskId!==_.id)&&jsx("text",{x:Ve>0?Ve:100,y:q*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${_.id}`)]})]},`row-group-${_.id}`)}),X.map((_,q)=>{if(!_.startDate||!_.endDate)return null;let{x:ge,width:De}=me(_),qe=q*a+14,Se=_.subtasks&&_.subtasks.length>0&&!_.isMilestone;if(_.isMilestone)return jsx(Ss,{task:_,x:ge+De/2,y:qe+12,theme:t,onClick:c},_.id);if(Se){let We=qe+10,Qe=5,ae=t.taskBarPrimary,I=De*(_.progress/100);return jsxs("g",{onClick:()=>c?.(_),onContextMenu:j=>{j.preventDefault(),j.stopPropagation(),p?.(_,j);},onMouseEnter:()=>{ne({task:_,x:ge,y:We,width:De,height:8,showBelow:We<100});},onMouseLeave:()=>ne(null),style:{cursor:"default"},children:[jsx("rect",{x:ge,y:qe,width:De,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:ge,y:We,width:De,height:8,fill:ae,opacity:.35,rx:2}),_.progress>0&&jsx("rect",{x:ge,y:We,width:I,height:8,fill:ae,opacity:1,rx:2,style:{pointerEvents:"none"}}),jsx("path",{d:`M ${ge} ${We} L ${ge+Qe} ${We} L ${ge} ${We+8+Qe} Z`,fill:ae,opacity:.9}),jsx("path",{d:`M ${ge+De-Qe} ${We} L ${ge+De} ${We} L ${ge+De} ${We+8+Qe} Z`,fill:ae,opacity:.9}),De>60&&jsx("text",{x:ge+12,y:We+8/2,dominantBaseline:"middle",fill:t.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:_.name.length>Math.floor(De/8)?`${_.name.substring(0,Math.floor(De/8))}...`:_.name})]},_.id)}return jsx(Ns,{task:_,x:ge,y:qe,width:De,theme:t,dayWidth:V*n,startDate:o,templates:u,onClick:c,onDoubleClick:d,onContextMenu:p,onDateChange:f,onDependencyCreate:v,allTaskPositions:fe,onDragMove:Ge,onHoverChange:ne},_.id)}),X.map((_,q)=>!_.dependencies||_.dependencies.length===0||!_.startDate||!_.endDate?null:_.dependencies.map(ge=>{let De=X.find(le=>le.id===ge);if(!De||!De.startDate||!De.endDate)return null;let qe=X.findIndex(le=>le.id===ge),Se=me(De),ot=me(_),We=Se.x+Se.width,Qe=qe*a+26,ae=ot.x,I=q*a+26,j=`dep-${ge}-${_.id}`;return R.has(j)?null:jsx(Nn,{x1:We,y1:Qe,x2:ae,y2:I,theme:t,lineStyle:i,onDelete:()=>k?.(_.id,ge),onHoverChange:le=>{w.current=le,le&&C({key:j,fromId:ge,toId:_.id,exitX:We,exitY:Qe,enterX:ae,enterY:I});}},j)})),h.map(_=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:_.previewX,y:_.y-48,width:_.width,height:32,rx:8,fill:_.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(_.daysDelta)>0&&jsx("text",{x:_.previewX+_.width/2,y:_.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:_.daysDelta>0?`+${_.daysDelta}d`:`${_.daysDelta}d`})]},`cascade-preview-${_.taskId}`)),N&&jsx(Nn,{x1:N.exitX,y1:N.exitY,x2:N.enterX,y2:N.enterY,theme:t,lineStyle:i,onDelete:()=>{let _=N.key;C(null),w.current=false,A(q=>new Set(q).add(_)),k?.(N.toId,N.fromId);},hoverOverlayOnly:true,onHoverChange:_=>{w.current=_,_||C(null);}},`${N.key}-hover-overlay`),Ve>=0&&Ve<=ie&&jsx("line",{x1:Ve,y1:0,x2:Ve,y2:re,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),x&&jsx(Vu,{tooltipData:x,theme:t,locale:l==="es"?"es":"en"})]})]})}var Ny=['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"'],Ku=()=>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"})]}),Dy=()=>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"})}),Sy=()=>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"})}),Ey=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Py=()=>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 Ms({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:u}){let[i,c]=useState(false),[d,p]=useState(false),[f,v]=useState([]),[k,g]=useState(""),[y,h]=useState(false),[b,x]=useState(true),D=useRef(null),N=useRef(null),C=useRef(null),{enabled:w=true,placeholder:R='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:A="bottom-right",onCommand:T,suggestions:H=Ny,maxHistory:L=50,persistHistory:ne}=a,S=ne?.storageKey||"gantt-ai-history",V=ne?.maxMessages??5;useEffect(()=>{if(ne?.enabled)try{let te=localStorage.getItem(S);if(te){let X=JSON.parse(te).map(me=>({...me,timestamp:new Date(me.timestamp)}));v(X.slice(-V));}}catch(te){console.warn("[GanttAIAssistant] Failed to load persisted history:",te);}},[ne?.enabled,S,V]),useEffect(()=>{if(ne?.enabled&&f.length>0)try{let te=f.filter(B=>!B.isLoading).slice(-V);localStorage.setItem(S,JSON.stringify(te));}catch(te){console.warn("[GanttAIAssistant] Failed to persist history:",te);}},[f,ne?.enabled,S,V]),useEffect(()=>{N.current&&N.current.scrollIntoView({behavior:"smooth"});},[f]),useEffect(()=>{i&&!d&&D.current&&setTimeout(()=>D.current?.focus(),100);},[i,d]);let ie=useCallback(te=>{if(te.success)switch(te.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":te.taskId&&te.updates&&o?.(te.taskId,te.updates);break;case "create_task":te.newTask&&s?.(te.newTask);break;case "delete_task":te.taskId&&n?.(te.taskId);break;case "link_tasks":te.dependencyFrom&&te.dependencyTo&&l?.(te.dependencyFrom,te.dependencyTo);break;case "unlink_tasks":te.taskId&&te.dependencyFrom&&u?.(te.taskId,te.dependencyFrom);break}},[o,s,n,l,u]),Me=useCallback(async te=>{if(!te.trim()||y)return;let B={id:`user-${Date.now()}`,role:"user",content:te,timestamp:new Date};v(me=>[...me.slice(-(L-1)),B]),g(""),x(false),h(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(me=>[...me,X]);try{if(T){let me=await T(te,e);v(fe=>{let Ge=fe.filter(Ve=>!Ve.isLoading),be={id:`assistant-${Date.now()}`,role:"assistant",content:me.message,timestamp:new Date,command:me};return [...Ge,be]}),ie(me);}else v(me=>[...me.filter(Ge=>!Ge.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(me){v(fe=>[...fe.filter(be=>!be.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${me instanceof Error?me.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[y,L,T,e,ie]),F=te=>{te.preventDefault(),Me(k);},ye=te=>{g(te),D.current?.focus();};if(useEffect(()=>{let te=B=>{(B.metaKey||B.ctrlKey)&&B.key==="k"&&(B.preventDefault(),c(X=>!X),i||p(false)),B.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[i]),useEffect(()=>{if(!i)return;let te=X=>{let me=X.target;C.current&&!C.current.contains(me)&&c(false);},B=setTimeout(()=>{document.addEventListener("mousedown",te);},100);return ()=>{clearTimeout(B),document.removeEventListener("mousedown",te);}},[i]),!w)return null;let Q={"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(kt,{children:[jsx(AnimatePresence,{children:!i&&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 ${Q[A]} 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:()=>c(true),children:[jsx(Ku,{}),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:i&&jsxs(motion.div,{ref:C,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 ${Q[A]} 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(Ku,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>p(te=>!te),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Ey,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Sy,{})})]})]}),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:[f.length===0&&b&&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:H.slice(0,4).map((te,B)=>jsx("button",{onClick:()=>ye(te),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:te.length>30?te.slice(0,30)+"...":te},B))})]}),f.map(te=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${te.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${te.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:te.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:te.role==="user"?"white":t.textPrimary},children:[te.isLoading?jsx(Py,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:te.content}),te.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:te.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:te.command.success?"#10B981":"#EF4444"},children:[te.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:te.command.type.replace(/_/g," ")})]})]})},te.id)),jsx("div",{ref:N})]}),jsxs("form",{onSubmit:F,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:D,type:"text",value:k,onChange:te=>g(te.target.value),placeholder:R,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!k.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsx(Dy,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function Yu(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!c)return {...d,present:p};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:p,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),u=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function qu({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=l?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&u&&n.key==="y"){n.preventDefault(),t();return}if(l&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ly={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ce.formatDate(e.startDate)} - ${Ce.formatDate(e.endDate)}`);let a=Ce.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=>Ce.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Xu(e){return {...Ly,...e}}var Hy=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Qu=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:u=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:p=true,persistExpandedState:f,persistFilter:v,clearFiltersKey:k,aiAssistant:g,locale:y="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:x,onCreateTask:D,taskFilter:N,onTaskFilterChange:C,onThemeChange:w,onTaskClick:R,onTaskDblClick:A,onTaskContextMenu:T,onTaskUpdate:H,onProgressChange:L,onTaskEdit:ne,onTaskAddSubtask:S,onTaskMarkIncomplete:V,onTaskSetInProgress:ie,onDependencyCreate:Me,onDependencyDelete:F,onBeforeTaskAdd:ye,onAfterTaskAdd:Q,onBeforeTaskUpdate:te,onAfterTaskUpdate:B,onBeforeTaskDelete:X,onAfterTaskDelete:me,permissions:fe}=a,be=useContext(hs)?.theme,[Ve,re]=useState(be||s||"dark"),[_,q]=useState(n),[ge,De]=useState(l),[qe,Se]=useState(1),ot=useCallback(()=>v?typeof v=="string"?v:"gantt-filter-state":null,[v]),[We,Qe]=useState(()=>{if(!v)return "all";try{let E=typeof v=="string"?v:"gantt-filter-state",M=localStorage.getItem(E);if(M){let G=JSON.parse(M);if(G.taskFilter)return G.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),ae=N??We,I=C??Qe,[j,le]=useState(()=>{if(!v)return false;try{let E=typeof v=="string"?v:"gantt-filter-state",M=localStorage.getItem(E);if(M){let G=JSON.parse(M);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=ot();if(E)try{let M={taskFilter:ae,hideCompleted:j};localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[ae,j,ot]);let Te=useRef(k);useEffect(()=>{if(Te.current!==k&&k!==void 0){Qe("all"),le(false);let E=ot();if(E)try{localStorage.removeItem(E);}catch(M){console.warn("[GanttBoard] Error clearing filter state from localStorage:",M);}}Te.current=k;},[k,ot]);let[_e,rt]=useState(0),[ct,je]=useState(false),[sa,W]=useState(null),[K,ke]=useState({isOpen:false,x:0,y:0,task:null}),[at,Ne]=useState(null),[Ie,Y]=useState(null);useEffect(()=>{be&&be!==Ve&&re(be);},[be]),useEffect(()=>{s&&s!==Ve&&re(s);},[s]);let Ke=useCallback(E=>{re(E),w?.(E);},[w]),{state:$,setState:de,undo:Be,redo:Ze,canUndo:et,canRedo:Ue,clearHistory:ve}=Yu(t,50),$e=useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),U=useRef(new Map),ce=useRef(false);if(!ce.current&&f){ce.current=true;let E=typeof f=="string"?f:"gantt-expanded-tasks";try{let M=localStorage.getItem(E);if(M){let G=JSON.parse(M);Array.isArray(G)&&(U.current=new Map(G));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let yt=useCallback(()=>{let E=$e();if(E)try{let M=Array.from(U.current.entries());localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[$e]),z=useRef(0),ee=useRef(false);useEffect(()=>{if(z.current>0){z.current-=1;return}let E=G=>{let se=new Map;for(let pe of G){let we=pe.id;se.get(we)||se.set(we,pe);}return Array.from(se.values())},M=G=>G.map(se=>{let pe=U.current.get(se.id),we=pe!==void 0?{...se,isExpanded:pe}:se;if(we.subtasks?.length){let Tt=E(we.subtasks);return {...we,subtasks:M(Tt)}}return we});if(U.current.size>0)de(M(t));else {let G=se=>se.map(pe=>pe.subtasks?.length?{...pe,subtasks:E(G(pe.subtasks))}:pe);de(G(t));}},[t,de]);let Fe=useRef(t),dt=useRef(true);useEffect(()=>{if(dt.current){dt.current=false,Fe.current=$;return}if(ee.current){ee.current=false,Fe.current=$;return}if(!r)return;let E=JSON.stringify(Fe.current),M=JSON.stringify($);E!==M&&(Fe.current=$,r($));},[$,r]);let Xe=useMemo(()=>ll(y,h),[y,h]),Yt=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}],[]),[gt,Fa]=useState(()=>Yt(Xe));useEffect(()=>{Fa(E=>E.map(M=>({...M,label:Xe.columns[M.id==="name"?"taskName":M.id]||M.label})));},[Xe]);let Vt=useMemo(()=>gt.filter(M=>M.visible).reduce((M,G)=>M+G.width,0),[gt]),Ea=useRef(gt.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=gt.filter(se=>se.visible),M=E.map(se=>se.id).join(","),G=Ea.current;if(M!==G){let se=E.some(we=>we.id!=="name"),pe=G.includes(",");se?!pe&&se&&W(null):W(null),Ea.current=M;}},[gt]);let Hr=60,Pe=.6,Rt=useMemo(()=>{let M=Vt+Hr,G=typeof window<"u"?window.innerWidth*Pe:800,se=Math.max(M,G);return sa!==null?Math.max(200,Math.min(sa,se)):Math.max(200,M)},[sa,Vt]),Ot=useRef(null),Fr=useRef(null),Ba=useRef(null),P=useRef(null),J=useMemo(()=>ku(Ve),[Ve]),He=useMemo(()=>({theme:J,themeName:Ve}),[J,Ve]),ze=useMemo(()=>Xu(d),[d]),qt=useMemo(()=>{if(!p)return $;let E=Ce.calculateCriticalPath($),M=G=>G.map(se=>({...se,isCriticalPath:E.includes(se.id),subtasks:se.subtasks?M(se.subtasks):void 0}));return M($)},[$,p]),Pa=useMemo(()=>{if(ae==="all"&&!j)return qt;let E=M=>{let G=[];for(let se of M){let pe=se.subtasks?.length?E(se.subtasks):void 0,we=false;if(j)we=se.progress<100;else switch(ae){case "all":we=true;break;case "incomplete":we=se.progress<100;break;case "in_progress":we=se.progress>0&&se.progress<100;break;case "completed":we=se.progress===100;break}(we||pe&&pe.length>0)&&G.push({...se,subtasks:pe});}return G};return E(qt)},[qt,ae,j]),ia=Hy(ge);qu({undo:Be,redo:Ze,canUndo:et,canRedo:Ue,enabled:true}),useImperativeHandle(o,()=>({getTask:E=>Ce.findTaskById($,E),addTask:(E,M)=>{de(G=>{if(!M)return [...G,{...E,level:0}];let se=pe=>pe.map(we=>we.id===M?{...we,subtasks:[...we.subtasks||[],{...E,parentId:M,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:se(we.subtasks)}:we);return se(G)});},updateTask:(E,M)=>{de(G=>{let se=pe=>pe.map(we=>we.id===E?{...we,...M}:we.subtasks?{...we,subtasks:se(we.subtasks)}:we);return se(G)});},deleteTask:E=>{de(M=>{let G=se=>se.filter(pe=>pe.id===E?false:(pe.subtasks&&(pe.subtasks=G(pe.subtasks)),true));return G(M)});},deleteTasks:E=>{de(M=>xl(M,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let M=Ce.findTaskById($,E);M&&a.onTaskDuplicate(M);}else de(M=>xn(M,[E]).tasks);},splitTask:(E,M,G=3)=>{de(se=>Ce.splitTask(se,E,M,G));},calculateEndDate:Ce.calculateEndDate,calculateDuration:Ce.calculateDuration,validateDependency:(E,M)=>!Ce.validateDependencies($,E,M),getAllTasks:()=>Ce.flattenTasks($),getTasksByStatus:E=>Ce.flattenTasks($).filter(M=>M.status===E),getTasksByParent:E=>E?Ce.findTaskById($,E)?.subtasks||[]:$.filter(G=>!G.parentId),getCriticalPath:()=>Ce.flattenTasks($).filter(E=>E.isCriticalPath),indentTask:E=>{de(M=>bl(M,[E]));},outdentTask:E=>{de(M=>yl(M,[E]));},moveTask:(E,M)=>{de(G=>vl(G,[E],M));},createSubtask:async E=>{let{tasks:M,newTask:G}=Cl($,E);if(ye){let se=ye({...G,parentId:E});if((se instanceof Promise?await se:se)===false)return}de(M),Q&&Q({...G,parentId:E});},scrollToTask:E=>{let G=Ce.flattenTasks($).findIndex(se=>se.id===E);if(G!==-1&&Ot.current){let se=G*ia;Ot.current.scrollTo({top:se,behavior:"smooth"}),Ba.current&&Ba.current.scrollTo({top:se,behavior:"smooth"});}},highlightTask:(E,M=2e3)=>{},expandTask:E=>{de(M=>{let G=se=>se.map(pe=>pe.id===E?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:G(pe.subtasks)}:pe);return G(M)});},collapseTask:E=>{de(M=>{let G=se=>se.map(pe=>pe.id===E?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:G(pe.subtasks)}:pe);return G(M)});},expandAll:()=>{de(E=>{let M=G=>G.map(se=>({...se,isExpanded:true,subtasks:se.subtasks?M(se.subtasks):void 0}));return M(E)});},collapseAll:()=>{de(E=>{let M=G=>G.map(se=>({...se,isExpanded:false,subtasks:se.subtasks?M(se.subtasks):void 0}));return M(E)});},undo:Be,redo:Ze,canUndo:()=>et,canRedo:()=>Ue,clearHistory:ve,exportToPNG:async()=>{if(!P.current||!Ot.current||!Ba.current)throw new Error("Gantt container not found");let E=P.current,M=Ot.current.querySelector(".gantt-grid-scroll"),G=Ba.current,se=M?.scrollTop||0,pe=G.scrollTop,we=E.style.overflow,Tt=E.style.height;try{let tt=M?.querySelector(".gantt-taskgrid-content"),ha=G.querySelector("svg"),xt=tt?.scrollHeight||M?.scrollHeight||600,ba=ha?.getBoundingClientRect().height||G.scrollHeight,lo=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(xt,ba)+20;M&&(M.scrollTop=0),G.scrollTop=0,E.style.overflow="visible",E.style.height=`${lo}px`,await new Promise(Wr=>setTimeout(Wr,100));let Cr=await Zu(E,{backgroundColor:J.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Wr=>{let Lo=window.getComputedStyle(Wr),co=parseInt(Lo.zIndex,10);return !isNaN(co)&&co>=50||Lo.position==="fixed"}});return new Promise((Wr,Lo)=>{Cr.toBlob(co=>{co?Wr(co):Lo(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=we,E.style.height=Tt,M&&(M.scrollTop=se),G.scrollTop=pe;}},exportToPDF:async E=>{await Ce.exportToPDF($,E);},exportToExcel:async E=>{await Ce.exportToExcel($,E);},exportToJSON:()=>Ce.exportToJSON($),exportToCSV:()=>Ce.exportToCSV($),importFromJSON:E=>{let M=Ce.importFromJSON(E);de(M);},getTasks:()=>$,refresh:()=>{de(E=>[...E]);},clearAll:()=>{de([]);}}),[$,Be,Ze,et,Ue,ve,J,ia]);let Ra=useCallback(E=>{Fa(M=>M.map(G=>G.id===E?{...G,visible:!G.visible}:G));},[]),Aa=useCallback((E,M)=>{Fa(G=>G.map(se=>{if(se.id!==E)return se;let pe=se.minWidth??100,we=se.maxWidth??800,Tt=Math.max(pe,Math.min(we,M));return {...se,width:Tt}}));},[]),Oa=useCallback(E=>{de(M=>{let G=wl(M,E),se=pe=>{for(let we of pe){if(we.id===E){U.current.set(E,we.isExpanded??true);return}we.subtasks?.length&&se(we.subtasks);}};return se(G),yt(),G}),a.onTaskToggleExpand?.(E);},[a,yt]),wr=useCallback((E,M)=>{if(te&&te(E,M)===false)return;let se=Ce.findTaskById($,E)?.progress,pe=Tt=>Tt.map(tt=>tt.id===E?{...tt,...M}:tt.subtasks?{...tt,subtasks:pe(tt.subtasks)}:tt);de(pe($));let we=Ce.findTaskById(pe($),E);we&&(H?.(we),B?.(we),M.progress!==void 0&&se!==void 0&&M.progress!==se&&L?.(E,se,M.progress));},[$,H,te,B,L]),bg=useCallback(E=>{E.length!==0&&(z.current+=1,ee.current=true,de(M=>bl(M,E)),a.onTaskIndent?.(E[0]));},[a]),yg=useCallback(E=>{E.length!==0&&(z.current+=1,ee.current=true,de(M=>yl(M,E)),a.onTaskOutdent?.(E[0]));},[a]),vg=useCallback((E,M,G)=>{z.current+=1,ee.current=true,de(se=>Ru(se,E,M,G)),a.onTaskReparent?.(E,M,G);},[a]),xg=useCallback((E,M)=>{E.length!==0&&(z.current+=1,ee.current=true,de(G=>vl(G,E,M)),a.onTaskMove?.(E[0],M));},[a]),ti=useCallback(async E=>{let M=[];for(let G of E)X&&await Promise.resolve(X(G))===false||M.push(G);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(de(G=>xl(G,M)),M.forEach(G=>a.onTaskDelete?.(G))),me&&M.forEach(G=>me(G)));},[a,X,me]),kg=useCallback(E=>{a.onTaskDuplicate?E.forEach(M=>{let G=Ce.findTaskById($,M);G&&a.onTaskDuplicate(G);}):de(M=>xn(M,E).tasks);},[a,$]),wg=useCallback((E,M)=>{de(G=>{let{tasks:se,newTask:pe}=Bu(G,E,M);return ye&&ye(pe)===false?G:(a.onTaskCreate?.(pe.parentId,pe.position||0),Q?.(pe),se)});},[a,ye,Q]),Cg=useCallback((E,M)=>{de(G=>kl(G,E,M)),a.onTaskRename?.(E,M);},[a]),ai=useCallback(E=>{let{onTaskAddSubtask:M}=a;if(M){let G=ks($,E);if(G){M(G);return}}de(G=>{let{tasks:se}=Cl(G,E);return a.onTaskCreate?.(E,0),se});},[a,$]),Tg=useCallback((E,M,G)=>{let se=!E.startDate&&!E.endDate,pe=E.startDate?Math.round((M.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,we=ha=>ha.map(xt=>xt.id===E.id?{...xt,startDate:M,endDate:G,...E.segments&&{segments:E.segments}}:xt.subtasks?{...xt,subtasks:we(xt.subtasks)}:xt),Tt=we($);Tt=Ce.autoScheduleDependents(Tt,E.id,pe),de(Tt);let tt={...E,startDate:M,endDate:G};se&&a?.onTaskDateChange?a.onTaskDateChange(E,M,G):H?.(tt);},[$,H,a]),Ng=useCallback((E,M)=>{T?.(E,M),ke({isOpen:true,x:M.clientX,y:M.clientY,task:E});},[T]),Dg=useCallback((E,M)=>{let G=Ce.splitTask($,E.id,M);de(G),ke({isOpen:false,x:0,y:0,task:null});},[$]),Ad=useCallback(E=>{let M=Ce.findTaskById($,E.id)||E;A?.(M),ne||Ne(M);},[$,A,ne]),Ld=useCallback((E,M,G)=>{let se=new Map,pe=xt=>{xt.forEach(ba=>{ba.dependencies&&se.set(ba.id,ba.dependencies),ba.subtasks&&pe(ba.subtasks);});};pe(G);let we=se.get(M)||[];se.set(M,[...we,E]);let Tt=new Set,tt=new Set,ha=xt=>{if(!Tt.has(xt)){Tt.add(xt),tt.add(xt);let ba=se.get(xt)||[];for(let ar of ba){if(!Tt.has(ar)&&ha(ar))return true;if(tt.has(ar))return true}}return tt.delete(xt),false};return ha(M)},[]),Id=useCallback((E,M)=>{if(Ld(E.id,M,$)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
356
|
+
</Project>`,c=new Blob([i],{type:"application/xml;charset=utf-8;"}),d=document.createElement("a");d.href=URL.createObjectURL(c),d.download=a,d.click(),URL.revokeObjectURL(d.href);},calculateCriticalPath:e=>{let t=Ce.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,o=i=>{if(r.has(i.id))return;let c=i.startDate&&i.endDate?Ce.calculateDuration(i.startDate,i.endDate):0,d=0;if(i.dependencies&&i.dependencies.length>0)for(let f of i.dependencies){let v=t.find(k=>k.id===f);if(v){o(v);let k=r.get(f)?.ef||0;d=Math.max(d,k);}}let p=d+c;r.set(i.id,{es:d,ef:p});};a.forEach(o);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),n=new Map,l=i=>{if(n.has(i.id))return;let c=i.startDate&&i.endDate?Ce.calculateDuration(i.startDate,i.endDate):0,d=t.filter(v=>v.dependencies&&v.dependencies.includes(i.id)),p=s;if(d.length>0)for(let v of d){l(v);let k=n.get(v.id)?.ls||0;p=Math.min(p,k);}let f=p-c;n.set(i.id,{ls:f,lf:p});};a.forEach(l);let u=[];for(let i of a){let c=r.get(i.id),d=n.get(i.id);if(c&&d){let p=d.ls-c.es;Math.abs(p)<.01&&u.push(i.id);}}return u},calculateSlack:(e,t)=>{let a=Ce.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ce.calculateCriticalPath(e).includes(t))return 0;let o=Ce.getDependentTasks(e,t);if(o.length===0){let l=Ce.getLatestEndDate(e);if(!l)return null;let u=Ce.calculateDuration(a.endDate,l);return Math.max(0,u)}let s=o.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,u)=>l-u)[0];if(!s)return null;let n=Ce.calculateDuration(a.endDate,new Date(s));return Math.max(0,n)},isOnCriticalPath:(e,t)=>Ce.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a)=>{let r=Ce.findTaskById(e,t);if(!r||!r.endDate)return e;let o=Ce.getDependentTasks(e,t);if(o.length===0)return e;let s=[...e];for(let n of o){if(!n.startDate||!n.endDate)continue;let l=Ce.calculateDuration(n.startDate,n.endDate),u;a!==void 0?(u=new Date(n.startDate),u.setDate(u.getDate()+a)):(u=new Date(r.endDate),u.setDate(u.getDate()+1));let i=Ce.calculateEndDate(u,l),c=d=>d.map(p=>p.id===n.id?{...p,startDate:u,endDate:i}:p.subtasks?{...p,subtasks:c(p.subtasks)}:p);s=c(s),s=Ce.autoScheduleDependents(s,n.id,a);}return s},calculateCascadePreview:(e,t,a,r,o,s,n,l)=>{if(a===0)return [];let u=[],i=o.getTime(),c=1e3*60*60*24,d=Ce.findTaskById(e,t);if(!d||!d.endDate)return [];let p=(f,v,k=new Set)=>{if(k.has(f))return;k.add(f);let g=Ce.getDependentTasks(e,f);for(let y of g){if(!y.startDate||!y.endDate)continue;let h=r.findIndex(T=>T.id===y.id);if(h===-1)continue;let b=y.startDate.getTime(),D=(y.endDate.getTime()-b)/c,C=(b-i)/c*s,w=C+v*s,R=Math.max(D*s,s),F=l+h*n+12;u.push({taskId:y.id,taskName:y.name,originalX:C,previewX:w,width:R,y:F,rowIndex:h,daysDelta:v,color:y.color}),p(y.id,v,k);}};return p(t,a),u},splitTask:(e,t,a,r=3)=>{let o=Ce.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 n=new Date(a);n.setDate(n.getDate()+r);let l=new Date(o.endDate);l.setDate(l.getDate()+r);let u=[{startDate:new Date(o.startDate),endDate:s},{startDate:n,endDate:l}],i=c=>c.map(d=>d.id===o.id?{...d,endDate:l,segments:u}:d.subtasks?{...d,subtasks:i(d.subtasks)}:d);return i(e)}};function Ms({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:o,endDate:s,zoom:n,locale:l="en",templates:u,dependencyLineStyle:i="curved",onTaskClick:c,onTaskDblClick:d,onTaskContextMenu:p,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:k}){let y=eo(),[h,b]=useState([]),[x,D]=useState(null),[N,C]=useState(null),w=useRef(false),[R,F]=useState(new Set),[T,H]=useState(null),A=useCallback(V=>{if(N&&!w.current){let Y=V.target,me=false;for(;Y&&Y!==V.currentTarget;){if(Y.getAttribute?.("data-dependency-line")==="true"||Y.getAttribute?.("data-dependency-hover-overlay")==="true"){me=true;break}Y=Y.parentElement;}me||C(null);}},[N]),se=useCallback(V=>{D(V);},[]),S=Math.ceil((s.getTime()-o.getTime())/(1e3*60*60*24)),j=r==="day"?60:r==="week"?20:8,ie=S*j*n,Ae=V=>{let Y=new Date(Date.UTC(V.getFullYear(),V.getMonth(),V.getDate())),me=Y.getUTCDay()||7;Y.setUTCDate(Y.getUTCDate()+4-me);let Te=new Date(Date.UTC(Y.getUTCFullYear(),0,1));return Math.ceil(((Y.getTime()-Te.getTime())/864e5+1)/7)},L=V=>{let Y=V.getDay();return Y===0||Y===6},ge=useCallback(V=>{let Y=Math.round(V/(j*n)),me=new Date(o);return me.setDate(me.getDate()+Y),me},[o,j,n]),ee=useCallback((V,Y)=>{if(Y.startDate&&Y.endDate)return;let me=V.currentTarget.ownerSVGElement;if(!me)return;let Te=me.createSVGPoint();Te.x=V.clientX,Te.y=V.clientY;let Xe=Te.matrixTransform(me.getScreenCTM()?.inverse()),z=ge(Xe.x),Ne=new Date(z);Ne.setDate(Ne.getDate()+1),H(null),f?.(Y,z,Ne);},[ge,f]),Ke=useCallback((V,Y,me)=>{let Te=V.currentTarget.ownerSVGElement;if(!Te)return;let Xe=Te.createSVGPoint();Xe.x=V.clientX,Xe.y=V.clientY;let z=Xe.matrixTransform(Te.getScreenCTM()?.inverse()),Ne=ge(z.x),Fe=Math.round(z.x/(j*n))*j*n;H({taskId:Y.id,x:Fe,y:me*a+a/2,date:Ne});},[ge,j,n,a]),B=useCallback(()=>{H(null);},[]),te=useMemo(()=>{let V=Xe=>Xe.map(z=>{if(z.subtasks&&z.subtasks.length>0){let Ne=V(z.subtasks),Pe=Ne.filter(Fe=>Fe.startDate&&Fe.endDate);if(Pe.length>0){let Fe=Pe.map(le=>le.startDate.getTime()),J=Pe.map(le=>le.endDate.getTime()),I=new Date(Math.min(...Fe)),K=new Date(Math.max(...J));return {...z,subtasks:Ne,startDate:I,endDate:K}}return {...z,subtasks:Ne}}return z}),Y=(Xe,z=[])=>{let Ne=[...Xe].sort((Pe,Fe)=>(Pe.position??0)-(Fe.position??0));for(let Pe of Ne)z.push(Pe),Pe.subtasks&&Pe.subtasks.length>0&&(Pe.isExpanded===void 0||Pe.isExpanded)&&Y(Pe.subtasks,z);return z},me=V(e);return Y(me)},[e]),xe=useCallback(V=>{if(!V.startDate||!V.endDate)return {x:0,width:0};let Y=V.startDate.getTime(),me=V.endDate.getTime(),Te=o.getTime(),Xe=(Y-Te)/(1e3*60*60*24),z=(me-Y)/(1e3*60*60*24),Ne=Xe*j*n,Pe=Math.max(j*n,40),Fe=Math.max(z*j*n,Pe);return {x:Ne,width:Fe}},[o,j,n]),fe=useMemo(()=>te.filter(V=>V.startDate&&V.endDate).map(V=>{let{x:Y,width:me}=xe(V),Xe=te.findIndex(z=>z.id===V.id)*a+14;return {id:V.id,x:Y,y:Xe,width:me,height:24}}),[te,xe]),He=useCallback((V,Y,me)=>{if(!me||Y===0){b([]);return}let Te=Ce.calculateCascadePreview(e,V,Y,te,o,j*n,a,48);b(Te);},[e,te,o,j,n,a,48]),ve=useMemo(()=>{let V=[],Y=new Date(o);for(;Y<=s;){let Xe=(Y.getTime()-o.getTime())/864e5*j*n;if(r==="day")V.push({date:new Date(Y),label:Y.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Xe}),Y.setDate(Y.getDate()+1);else if(r==="week"){let z=Ae(Y);V.push({date:new Date(Y),label:`${y.labels.week} ${z}`,x:Xe}),Y.setDate(Y.getDate()+7);}else V.push({date:new Date(Y),label:Y.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Xe}),Y.setMonth(Y.getMonth()+1);}return V},[o,s,r,j,n,l,y.labels.week]),_e=useMemo(()=>(new Date().getTime()-o.getTime())/(1e3*60*60*24)*j*n,[o,j,n]),re=Math.max(te.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,style:{backgroundColor:t.bgPrimary},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(ie,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(ie,1e3),height:48,fill:t.bgGrid}),ve.map((V,Y)=>jsxs("g",{children:[Y>0&&jsx("line",{x1:V.x,y1:0,x2:V.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:V.x+8,y:48/2,fill:t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:V.label})]},`header-${Y}`)),_e>=0&&_e<=ie&&jsx("circle",{cx:_e,cy:38,r:6,fill:t.today,opacity:1})]})}),jsxs("svg",{width:Math.max(ie,1e3),height:re,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:A,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(ie,1e3),height:re,fill:t.bgPrimary}),ve.map((V,Y)=>{let me=ve[Y+1]?.x||ie,Te=L(V.date);return jsxs("g",{children:[Te&&jsx("rect",{x:V.x,y:0,width:me-V.x,height:te.length*a,fill:t.bgWeekend,opacity:1}),Y>0&&jsx("line",{x1:V.x,y1:0,x2:V.x,y2:te.length*a,stroke:t.border,strokeWidth:1,opacity:.1})]},Y)}),te.map((V,Y)=>{let me=V.startDate&&V.endDate;return jsxs("g",{children:[jsx("rect",{x:0,y:Y*a,width:ie,height:a,fill:Y%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-${V.id}`),!me&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:Y*a,width:ie,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Te=>ee(Te,V),onMouseMove:Te=>Ke(Te,V,Y),onMouseLeave:()=>{B();}},`clickable-${V.id}`),T&&T.taskId===V.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:T.x,y1:Y*a+4,x2:T.x,y2:Y*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:T.x,cy:T.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:T.x,cy:T.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${T.x}, ${Y*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:T.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!T||T.taskId!==V.id)&&jsx("text",{x:_e>0?_e:100,y:Y*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:y.labels.clickToSetDates},`placeholder-${V.id}`)]})]},`row-group-${V.id}`)}),te.map((V,Y)=>{if(!V.startDate||!V.endDate)return null;let{x:me,width:Te}=xe(V),Xe=Y*a+14,z=V.subtasks&&V.subtasks.length>0&&!V.isMilestone;if(V.isMilestone)return jsx(Es,{task:V,x:me+Te/2,y:Xe+12,theme:t,onClick:c},V.id);if(z){let Pe=Xe+10,Fe=5,J=t.taskBarPrimary,I=Te*(V.progress/100);return jsxs("g",{onClick:()=>c?.(V),onContextMenu:K=>{K.preventDefault(),K.stopPropagation(),p?.(V,K);},onMouseEnter:()=>{se({task:V,x:me,y:Pe,width:Te,height:8,showBelow:Pe<100});},onMouseLeave:()=>se(null),style:{cursor:"default"},children:[jsx("rect",{x:me,y:Xe,width:Te,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:me,y:Pe,width:Te,height:8,fill:J,opacity:.35,rx:2}),V.progress>0&&jsx("rect",{x:me,y:Pe,width:I,height:8,fill:J,opacity:1,rx:2,style:{pointerEvents:"none"}}),jsx("path",{d:`M ${me} ${Pe} L ${me+Fe} ${Pe} L ${me} ${Pe+8+Fe} Z`,fill:J,opacity:.9}),jsx("path",{d:`M ${me+Te-Fe} ${Pe} L ${me+Te} ${Pe} L ${me+Te} ${Pe+8+Fe} Z`,fill:J,opacity:.9}),Te>60&&jsx("text",{x:me+12,y:Pe+8/2,dominantBaseline:"middle",fill:t.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:V.name.length>Math.floor(Te/8)?`${V.name.substring(0,Math.floor(Te/8))}...`:V.name})]},V.id)}return jsx(Ds,{task:V,x:me,y:Xe,width:Te,theme:t,dayWidth:j*n,startDate:o,templates:u,onClick:c,onDoubleClick:d,onContextMenu:p,onDateChange:f,onDependencyCreate:v,allTaskPositions:fe,onDragMove:He,onHoverChange:se},V.id)}),te.map((V,Y)=>!V.dependencies||V.dependencies.length===0||!V.startDate||!V.endDate?null:V.dependencies.map(me=>{let Te=te.find(le=>le.id===me);if(!Te||!Te.startDate||!Te.endDate)return null;let Xe=te.findIndex(le=>le.id===me),z=xe(Te),Ne=xe(V),Pe=z.x+z.width,Fe=Xe*a+26,J=Ne.x,I=Y*a+26,K=`dep-${me}-${V.id}`;return R.has(K)?null:jsx(Dn,{x1:Pe,y1:Fe,x2:J,y2:I,theme:t,lineStyle:i,onDelete:()=>k?.(V.id,me),onHoverChange:le=>{w.current=le,le&&C({key:K,fromId:me,toId:V.id,exitX:Pe,exitY:Fe,enterX:J,enterY:I});}},K)})),h.map(V=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:V.previewX,y:V.y-48,width:V.width,height:32,rx:8,fill:V.color||t.accent,opacity:.3,stroke:t.accent,strokeWidth:2,strokeDasharray:"4 2"}),Math.abs(V.daysDelta)>0&&jsx("text",{x:V.previewX+V.width/2,y:V.y-48+16,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:V.daysDelta>0?`+${V.daysDelta}d`:`${V.daysDelta}d`})]},`cascade-preview-${V.taskId}`)),N&&jsx(Dn,{x1:N.exitX,y1:N.exitY,x2:N.enterX,y2:N.enterY,theme:t,lineStyle:i,onDelete:()=>{let V=N.key;C(null),w.current=false,F(Y=>new Set(Y).add(V)),k?.(N.toId,N.fromId);},hoverOverlayOnly:true,onHoverChange:V=>{w.current=V,V||C(null);}},`${N.key}-hover-overlay`),_e>=0&&_e<=ie&&jsx("line",{x1:_e,y1:0,x2:_e,y2:re,stroke:t.today,strokeWidth:1,opacity:1,style:{pointerEvents:"none"}}),x&&jsx(_u,{tooltipData:x,theme:t,locale:l==="es"?"es":"en"})]})]})}var Ny=['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"'],Ku=()=>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"})]}),Dy=()=>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"})}),Sy=()=>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"})}),Ey=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Py=()=>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 Ls({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:o,onTaskCreate:s,onTaskDelete:n,onDependencyCreate:l,onDependencyDelete:u}){let[i,c]=useState(false),[d,p]=useState(false),[f,v]=useState([]),[k,g]=useState(""),[y,h]=useState(false),[b,x]=useState(true),[D,N]=useState(""),[C,w]=useState(-1),[R,F]=useState(false),[T,H]=useState(0),A=useRef(null),se=useRef(null),S=useRef(null),j=useRef(null),{enabled:ie=true,placeholder:Ae='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:L="bottom-right",onCommand:ge,suggestions:ee=Ny,maxHistory:Ke=50,persistHistory:B,mentionableUsers:te=[]}=a,xe=B?.storageKey||"gantt-ai-history",fe=B?.maxMessages??5,He=te.filter(z=>{if(!D)return true;let Ne=D.toLowerCase();return z.name.toLowerCase().includes(Ne)||z.email&&z.email.toLowerCase().includes(Ne)}).slice(0,5),ve=useCallback(z=>{if(g(z),te.length===0)return;let Ne=A.current;if(!Ne)return;let Pe=Ne.selectionStart||z.length,Fe=z.slice(0,Pe),J=Fe.lastIndexOf("@");if(J>=0&&((J>0?Fe[J-1]:" ")===" "||J===0)){let K=Fe.slice(J+1);if(K.length<=40){N(K),w(J),F(true),H(0);return}}F(false),N(""),w(-1);},[te.length]),_e=useCallback(z=>{let Ne=k.slice(0,C),Pe=k.slice(C+1+D.length),Fe=`${Ne}@${z.name} ${Pe}`;g(Fe),F(false),N(""),w(-1),setTimeout(()=>A.current?.focus(),0);},[k,C,D]),re=useCallback(z=>{if(!R||He.length===0)return false;if(z.key==="ArrowDown")return z.preventDefault(),H(Ne=>Ne<He.length-1?Ne+1:0),true;if(z.key==="ArrowUp")return z.preventDefault(),H(Ne=>Ne>0?Ne-1:He.length-1),true;if(z.key==="Enter"||z.key==="Tab"){z.preventDefault();let Ne=He[T];return Ne&&_e(Ne),true}return z.key==="Escape"?(F(false),true):false},[R,He,T,_e]);useEffect(()=>{if(B?.enabled)try{let z=localStorage.getItem(xe);if(z){let Pe=JSON.parse(z).map(Fe=>({...Fe,timestamp:new Date(Fe.timestamp)}));v(Pe.slice(-fe));}}catch(z){console.warn("[GanttAIAssistant] Failed to load persisted history:",z);}},[B?.enabled,xe,fe]),useEffect(()=>{if(B?.enabled&&f.length>0)try{let z=f.filter(Ne=>!Ne.isLoading).slice(-fe);localStorage.setItem(xe,JSON.stringify(z));}catch(z){console.warn("[GanttAIAssistant] Failed to persist history:",z);}},[f,B?.enabled,xe,fe]),useEffect(()=>{se.current&&se.current.scrollIntoView({behavior:"smooth"});},[f]),useEffect(()=>{i&&!d&&A.current&&setTimeout(()=>A.current?.focus(),100);},[i,d]);let V=useCallback(z=>{if(z.success)switch(z.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":z.taskId&&z.updates&&o?.(z.taskId,z.updates);break;case "create_task":z.newTask&&s?.(z.newTask);break;case "delete_task":z.taskId&&n?.(z.taskId);break;case "link_tasks":z.dependencyFrom&&z.dependencyTo&&l?.(z.dependencyFrom,z.dependencyTo);break;case "unlink_tasks":z.taskId&&z.dependencyFrom&&u?.(z.taskId,z.dependencyFrom);break}},[o,s,n,l,u]),Y=useCallback(async z=>{if(!z.trim()||y)return;let Ne={id:`user-${Date.now()}`,role:"user",content:z,timestamp:new Date};v(Fe=>[...Fe.slice(-(Ke-1)),Ne]),g(""),x(false),h(true);let Pe={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};v(Fe=>[...Fe,Pe]);try{if(ge){let Fe=await ge(z,e);v(J=>{let I=J.filter(le=>!le.isLoading),K={id:`assistant-${Date.now()}`,role:"assistant",content:Fe.message,timestamp:new Date,command:Fe};return [...I,K]}),V(Fe);}else v(Fe=>[...Fe.filter(I=>!I.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(Fe){v(J=>[...J.filter(K=>!K.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${Fe instanceof Error?Fe.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[y,Ke,ge,e,V]),me=z=>{z.preventDefault(),Y(k);},Te=z=>{g(z),A.current?.focus();};if(useEffect(()=>{let z=Ne=>{(Ne.metaKey||Ne.ctrlKey)&&Ne.key==="k"&&(Ne.preventDefault(),c(Pe=>!Pe),i||p(false)),Ne.key==="Escape"&&i&&c(false);};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),useEffect(()=>{if(!i)return;let z=Pe=>{let Fe=Pe.target;S.current&&!S.current.contains(Fe)&&c(false);},Ne=setTimeout(()=>{document.addEventListener("mousedown",z);},100);return ()=>{clearTimeout(Ne),document.removeEventListener("mousedown",z);}},[i]),!ie)return null;let Xe={"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(wt,{children:[jsx(AnimatePresence,{children:!i&&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 ${Xe[L]} 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:()=>c(true),children:[jsx(Ku,{}),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:i&&jsxs(motion.div,{ref:S,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 ${Xe[L]} 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(Ku,{}),jsx("span",{className:"font-semibold",children:"Gantt AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>p(z=>!z),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Ey,{})}),jsx("button",{onClick:()=>c(false),className:"p-1.5 rounded-lg hover:bg-white/20 text-white/80 hover:text-white transition-colors",children:jsx(Sy,{})})]})]}),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:[f.length===0&&b&&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:ee.slice(0,4).map((z,Ne)=>jsx("button",{onClick:()=>Te(z),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:z.length>30?z.slice(0,30)+"...":z},Ne))})]}),f.map(z=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${z.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${z.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:z.role==="user"?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":t.bgSecondary,color:z.role==="user"?"white":t.textPrimary},children:[z.isLoading?jsx(Py,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:z.content}),z.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:z.command.success?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",color:z.command.success?"#10B981":"#EF4444"},children:[z.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:z.command.type.replace(/_/g," ")})]})]})},z.id)),jsx("div",{ref:se})]}),jsxs("form",{onSubmit:z=>{if(R&&He.length>0){z.preventDefault();return}me(z);},className:"p-3 border-t relative",style:{borderColor:t.border},children:[jsx(AnimatePresence,{children:R&&He.length>0&&jsx(motion.div,{ref:j,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:t.bgSecondary,border:`1px solid ${t.border}`,boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.25)"},children:He.map((z,Ne)=>jsxs("button",{type:"button",onClick:()=>_e(z),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:Ne===T?"rgba(59, 130, 246, 0.15)":"transparent",color:t.textPrimary},onMouseEnter:()=>H(Ne),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:"linear-gradient(135deg, #3B82F6 0%, #6366F1 100%)",color:"white"},children:z.name.split(" ").map(Pe=>Pe[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:z.name}),z.email&&jsx("div",{className:"text-xs truncate",style:{color:t.textSecondary},children:z.email})]})]},z.id))})}),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:A,type:"text",value:k,onChange:z=>ve(z.target.value),onKeyDown:z=>{re(z);},placeholder:Ae,disabled:y,className:"flex-1 bg-transparent text-sm outline-none",style:{color:t.textPrimary}}),jsx("button",{type:"submit",disabled:!k.trim()||y,className:"p-2 rounded-lg transition-all disabled:opacity-50",style:{background:k.trim()?"linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%)":"transparent",color:k.trim()?"white":t.textSecondary},children:jsx(Dy,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:t.textTertiary},children:"Press Enter to send \u2022 Esc to close"})]})]})})]})})]})}function qu(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),o=useRef(false),s=useCallback((i,c=true)=>{r(d=>{let p=typeof i=="function"?i(d.present):i;if(o.current)return {...d,present:p};if(!c)return {...d,present:p};let f=[...d.past,d.present];return f.length>t&&f.shift(),{past:f,present:p,future:[]}});},[t]),n=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let c=i.past[i.past.length-1],d=i.past.slice(0,i.past.length-1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:d,present:c,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let c=i.future[0],d=i.future.slice(1);return o.current=true,setTimeout(()=>{o.current=false;},0),{past:[...i.past,i.present],present:c,future:d}});},[]),u=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:n,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:u}}function Yu({undo:e,redo:t,canUndo:a,canRedo:r,enabled:o=true}){useEffect(()=>{if(!o)return;let s=n=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=l?n.metaKey:n.ctrlKey;if(u&&n.key==="z"&&!n.shiftKey&&a){n.preventDefault(),e();return}if(r){if(!l&&u&&n.key==="y"){n.preventDefault(),t();return}if(l&&u&&n.shiftKey&&n.key==="z"){n.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,o]);}var Ly={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ce.formatDate(e.startDate)} - ${Ce.formatDate(e.endDate)}`);let a=Ce.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=>Ce.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Xu(e){return {...Ly,...e}}var Hy=e=>{switch(e){case "compact":return 44;case "comfortable":return 52;case "spacious":return 60;default:return 52}},Qu=forwardRef(function({tasks:t,config:a={},onTasksChange:r},o){let{theme:s,timeScale:n="week",rowDensity:l="comfortable",showThemeSelector:u=true,showExportButton:i=true,availableUsers:c=[],templates:d,enableAutoCriticalPath:p=true,persistExpandedState:f,persistFilter:v,clearFiltersKey:k,aiAssistant:g,locale:y="en",customTranslations:h,showCreateTaskButton:b=false,createTaskLabel:x,onCreateTask:D,taskFilter:N,onTaskFilterChange:C,onThemeChange:w,onTaskClick:R,onTaskDblClick:F,onTaskContextMenu:T,onTaskUpdate:H,onProgressChange:A,onTaskEdit:se,onTaskAddSubtask:S,onTaskMarkIncomplete:j,onTaskSetInProgress:ie,onDependencyCreate:Ae,onDependencyDelete:L,onBeforeTaskAdd:ge,onAfterTaskAdd:ee,onBeforeTaskUpdate:Ke,onAfterTaskUpdate:B,onBeforeTaskDelete:te,onAfterTaskDelete:xe,permissions:fe}=a,ve=useContext(bs)?.theme,[_e,re]=useState(ve||s||"dark"),[V,Y]=useState(n),[me,Te]=useState(l),[Xe,z]=useState(1),Ne=useCallback(()=>v?typeof v=="string"?v:"gantt-filter-state":null,[v]),[Pe,Fe]=useState(()=>{if(!v)return "all";try{let E=typeof v=="string"?v:"gantt-filter-state",M=localStorage.getItem(E);if(M){let _=JSON.parse(M);if(_.taskFilter)return _.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),J=N??Pe,I=C??Fe,[K,le]=useState(()=>{if(!v)return false;try{let E=typeof v=="string"?v:"gantt-filter-state",M=localStorage.getItem(E);if(M){let _=JSON.parse(M);if(typeof _.hideCompleted=="boolean")return _.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=Ne();if(E)try{let M={taskFilter:J,hideCompleted:K};localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving filter state to localStorage:",M);}},[J,K,Ne]);let De=useRef(k);useEffect(()=>{if(De.current!==k&&k!==void 0){Fe("all"),le(false);let E=Ne();if(E)try{localStorage.removeItem(E);}catch(M){console.warn("[GanttBoard] Error clearing filter state from localStorage:",M);}}De.current=k;},[k,Ne]);let[je,ot]=useState(0),[ct,qe]=useState(false),[sa,G]=useState(null),[q,ke]=useState({isOpen:false,x:0,y:0,task:null}),[rt,Se]=useState(null),[Re,X]=useState(null);useEffect(()=>{ve&&ve!==_e&&re(ve);},[ve]),useEffect(()=>{s&&s!==_e&&re(s);},[s]);let Ye=useCallback(E=>{re(E),w?.(E);},[w]),{state:$,setState:de,undo:Oe,redo:et,canUndo:tt,canRedo:Ge,clearHistory:be}=qu(t,50),Ue=useCallback(()=>f?typeof f=="string"?f:"gantt-expanded-tasks":null,[f]),W=useRef(new Map),ce=useRef(false);if(!ce.current&&f){ce.current=true;let E=typeof f=="string"?f:"gantt-expanded-tasks";try{let M=localStorage.getItem(E);if(M){let _=JSON.parse(M);Array.isArray(_)&&(W.current=new Map(_));}}catch(M){console.warn("[GanttBoard] Error loading expanded state from localStorage:",M);}}let vt=useCallback(()=>{let E=Ue();if(E)try{let M=Array.from(W.current.entries());localStorage.setItem(E,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving expanded state to localStorage:",M);}},[Ue]),U=useRef(0),ae=useRef(false);useEffect(()=>{if(U.current>0){U.current-=1;return}let E=_=>{let ne=new Map;for(let pe of _){let we=pe.id;ne.get(we)||ne.set(we,pe);}return Array.from(ne.values())},M=_=>_.map(ne=>{let pe=W.current.get(ne.id),we=pe!==void 0?{...ne,isExpanded:pe}:ne;if(we.subtasks?.length){let Tt=E(we.subtasks);return {...we,subtasks:M(Tt)}}return we});if(W.current.size>0)de(M(t));else {let _=ne=>ne.map(pe=>pe.subtasks?.length?{...pe,subtasks:E(_(pe.subtasks))}:pe);de(_(t));}},[t,de]);let Le=useRef(t),dt=useRef(true);useEffect(()=>{if(dt.current){dt.current=false,Le.current=$;return}if(ae.current){ae.current=false,Le.current=$;return}if(!r)return;let E=JSON.stringify(Le.current),M=JSON.stringify($);E!==M&&(Le.current=$,r($));},[$,r]);let Ze=useMemo(()=>ul(y,h),[y,h]),qt=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}],[]),[ft,Fa]=useState(()=>qt(Ze));useEffect(()=>{Fa(E=>E.map(M=>({...M,label:Ze.columns[M.id==="name"?"taskName":M.id]||M.label})));},[Ze]);let Vt=useMemo(()=>ft.filter(M=>M.visible).reduce((M,_)=>M+_.width,0),[ft]),Ea=useRef(ft.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=ft.filter(ne=>ne.visible),M=E.map(ne=>ne.id).join(","),_=Ea.current;if(M!==_){let ne=E.some(we=>we.id!=="name"),pe=_.includes(",");ne?!pe&&ne&&G(null):G(null),Ea.current=M;}},[ft]);let Wr=60,Me=.6,Rt=useMemo(()=>{let M=Vt+Wr,_=typeof window<"u"?window.innerWidth*Me:800,ne=Math.max(M,_);return sa!==null?Math.max(200,Math.min(sa,ne)):Math.max(200,M)},[sa,Vt]),Ot=useRef(null),Ar=useRef(null),Ra=useRef(null),P=useRef(null),Z=useMemo(()=>wu(_e),[_e]),Ve=useMemo(()=>({theme:Z,themeName:_e}),[Z,_e]),We=useMemo(()=>Xu(d),[d]),Yt=useMemo(()=>{if(!p)return $;let E=Ce.calculateCriticalPath($),M=_=>_.map(ne=>({...ne,isCriticalPath:E.includes(ne.id),subtasks:ne.subtasks?M(ne.subtasks):void 0}));return M($)},[$,p]),Pa=useMemo(()=>{if(J==="all"&&!K)return Yt;let E=M=>{let _=[];for(let ne of M){let pe=ne.subtasks?.length?E(ne.subtasks):void 0,we=false;if(K)we=ne.progress<100;else switch(J){case "all":we=true;break;case "incomplete":we=ne.progress<100;break;case "in_progress":we=ne.progress>0&&ne.progress<100;break;case "completed":we=ne.progress===100;break}(we||pe&&pe.length>0)&&_.push({...ne,subtasks:pe});}return _};return E(Yt)},[Yt,J,K]),ia=Hy(me);Yu({undo:Oe,redo:et,canUndo:tt,canRedo:Ge,enabled:true}),useImperativeHandle(o,()=>({getTask:E=>Ce.findTaskById($,E),addTask:(E,M)=>{de(_=>{if(!M)return [..._,{...E,level:0}];let ne=pe=>pe.map(we=>we.id===M?{...we,subtasks:[...we.subtasks||[],{...E,parentId:M,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:ne(we.subtasks)}:we);return ne(_)});},updateTask:(E,M)=>{de(_=>{let ne=pe=>pe.map(we=>we.id===E?{...we,...M}:we.subtasks?{...we,subtasks:ne(we.subtasks)}:we);return ne(_)});},deleteTask:E=>{de(M=>{let _=ne=>ne.filter(pe=>pe.id===E?false:(pe.subtasks&&(pe.subtasks=_(pe.subtasks)),true));return _(M)});},deleteTasks:E=>{de(M=>Cl(M,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let M=Ce.findTaskById($,E);M&&a.onTaskDuplicate(M);}else de(M=>kn(M,[E]).tasks);},splitTask:(E,M,_=3)=>{de(ne=>Ce.splitTask(ne,E,M,_));},calculateEndDate:Ce.calculateEndDate,calculateDuration:Ce.calculateDuration,validateDependency:(E,M)=>!Ce.validateDependencies($,E,M),getAllTasks:()=>Ce.flattenTasks($),getTasksByStatus:E=>Ce.flattenTasks($).filter(M=>M.status===E),getTasksByParent:E=>E?Ce.findTaskById($,E)?.subtasks||[]:$.filter(_=>!_.parentId),getCriticalPath:()=>Ce.flattenTasks($).filter(E=>E.isCriticalPath),indentTask:E=>{de(M=>xl(M,[E]));},outdentTask:E=>{de(M=>kl(M,[E]));},moveTask:(E,M)=>{de(_=>wl(_,[E],M));},createSubtask:async E=>{let{tasks:M,newTask:_}=Dl($,E);if(ge){let ne=ge({..._,parentId:E});if((ne instanceof Promise?await ne:ne)===false)return}de(M),ee&&ee({..._,parentId:E});},scrollToTask:E=>{let _=Ce.flattenTasks($).findIndex(ne=>ne.id===E);if(_!==-1&&Ot.current){let ne=_*ia;Ot.current.scrollTo({top:ne,behavior:"smooth"}),Ra.current&&Ra.current.scrollTo({top:ne,behavior:"smooth"});}},highlightTask:(E,M=2e3)=>{},expandTask:E=>{de(M=>{let _=ne=>ne.map(pe=>pe.id===E?{...pe,isExpanded:true}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(M)});},collapseTask:E=>{de(M=>{let _=ne=>ne.map(pe=>pe.id===E?{...pe,isExpanded:false}:pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe);return _(M)});},expandAll:()=>{de(E=>{let M=_=>_.map(ne=>({...ne,isExpanded:true,subtasks:ne.subtasks?M(ne.subtasks):void 0}));return M(E)});},collapseAll:()=>{de(E=>{let M=_=>_.map(ne=>({...ne,isExpanded:false,subtasks:ne.subtasks?M(ne.subtasks):void 0}));return M(E)});},undo:Oe,redo:et,canUndo:()=>tt,canRedo:()=>Ge,clearHistory:be,exportToPNG:async()=>{if(!P.current||!Ot.current||!Ra.current)throw new Error("Gantt container not found");let E=P.current,M=Ot.current.querySelector(".gantt-grid-scroll"),_=Ra.current,ne=M?.scrollTop||0,pe=_.scrollTop,we=E.style.overflow,Tt=E.style.height;try{let at=M?.querySelector(".gantt-taskgrid-content"),ha=_.querySelector("svg"),kt=at?.scrollHeight||M?.scrollHeight||600,ba=ha?.getBoundingClientRect().height||_.scrollHeight,co=(E.querySelector('[class*="h-12"]')?.offsetHeight||48)+Math.max(kt,ba)+20;M&&(M.scrollTop=0),_.scrollTop=0,E.style.overflow="visible",E.style.height=`${co}px`,await new Promise(Gr=>setTimeout(Gr,100));let Cr=await Zu(E,{backgroundColor:Z.bgPrimary,scale:2,logging:!1,useCORS:!0,ignoreElements:Gr=>{let Io=window.getComputedStyle(Gr),uo=parseInt(Io.zIndex,10);return !isNaN(uo)&&uo>=50||Io.position==="fixed"}});return new Promise((Gr,Io)=>{Cr.toBlob(uo=>{uo?Gr(uo):Io(new Error("Failed to create blob from canvas"));},"image/png");})}finally{E.style.overflow=we,E.style.height=Tt,M&&(M.scrollTop=ne),_.scrollTop=pe;}},exportToPDF:async E=>{await Ce.exportToPDF($,E);},exportToExcel:async E=>{await Ce.exportToExcel($,E);},exportToJSON:()=>Ce.exportToJSON($),exportToCSV:()=>Ce.exportToCSV($),importFromJSON:E=>{let M=Ce.importFromJSON(E);de(M);},getTasks:()=>$,refresh:()=>{de(E=>[...E]);},clearAll:()=>{de([]);}}),[$,Oe,et,tt,Ge,be,Z,ia]);let Oa=useCallback(E=>{Fa(M=>M.map(_=>_.id===E?{..._,visible:!_.visible}:_));},[]),Aa=useCallback((E,M)=>{Fa(_=>_.map(ne=>{if(ne.id!==E)return ne;let pe=ne.minWidth??100,we=ne.maxWidth??800,Tt=Math.max(pe,Math.min(we,M));return {...ne,width:Tt}}));},[]),$a=useCallback(E=>{de(M=>{let _=Nl(M,E),ne=pe=>{for(let we of pe){if(we.id===E){W.current.set(E,we.isExpanded??true);return}we.subtasks?.length&&ne(we.subtasks);}};return ne(_),vt(),_}),a.onTaskToggleExpand?.(E);},[a,vt]),wr=useCallback((E,M)=>{if(Ke&&Ke(E,M)===false)return;let ne=Ce.findTaskById($,E)?.progress,pe=Tt=>Tt.map(at=>at.id===E?{...at,...M}:at.subtasks?{...at,subtasks:pe(at.subtasks)}:at);de(pe($));let we=Ce.findTaskById(pe($),E);we&&(H?.(we),B?.(we),M.progress!==void 0&&ne!==void 0&&M.progress!==ne&&A?.(E,ne,M.progress));},[$,H,Ke,B,A]),bg=useCallback(E=>{E.length!==0&&(U.current+=1,ae.current=true,de(M=>xl(M,E)),a.onTaskIndent?.(E[0]));},[a]),yg=useCallback(E=>{E.length!==0&&(U.current+=1,ae.current=true,de(M=>kl(M,E)),a.onTaskOutdent?.(E[0]));},[a]),vg=useCallback((E,M,_)=>{U.current+=1,ae.current=true,de(ne=>Ou(ne,E,M,_)),a.onTaskReparent?.(E,M,_);},[a]),xg=useCallback((E,M)=>{E.length!==0&&(U.current+=1,ae.current=true,de(_=>wl(_,E,M)),a.onTaskMove?.(E[0],M));},[a]),oi=useCallback(async E=>{let M=[];for(let _ of E)te&&await Promise.resolve(te(_))===false||M.push(_);M.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(M):(de(_=>Cl(_,M)),M.forEach(_=>a.onTaskDelete?.(_))),xe&&M.forEach(_=>xe(_)));},[a,te,xe]),kg=useCallback(E=>{a.onTaskDuplicate?E.forEach(M=>{let _=Ce.findTaskById($,M);_&&a.onTaskDuplicate(_);}):de(M=>kn(M,E).tasks);},[a,$]),wg=useCallback((E,M)=>{de(_=>{let{tasks:ne,newTask:pe}=Ru(_,E,M);return ge&&ge(pe)===false?_:(a.onTaskCreate?.(pe.parentId,pe.position||0),ee?.(pe),ne)});},[a,ge,ee]),Cg=useCallback((E,M)=>{de(_=>Tl(_,E,M)),a.onTaskRename?.(E,M);},[a]),ni=useCallback(E=>{let{onTaskAddSubtask:M}=a;if(M){let _=ws($,E);if(_){M(_);return}}de(_=>{let{tasks:ne}=Dl(_,E);return a.onTaskCreate?.(E,0),ne});},[a,$]),Tg=useCallback((E,M,_)=>{let ne=!E.startDate&&!E.endDate,pe=E.startDate?Math.round((M.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,we=ha=>ha.map(kt=>kt.id===E.id?{...kt,startDate:M,endDate:_,...E.segments&&{segments:E.segments}}:kt.subtasks?{...kt,subtasks:we(kt.subtasks)}:kt),Tt=we($);Tt=Ce.autoScheduleDependents(Tt,E.id,pe),de(Tt);let at={...E,startDate:M,endDate:_};ne&&a?.onTaskDateChange?a.onTaskDateChange(E,M,_):H?.(at);},[$,H,a]),Ng=useCallback((E,M)=>{T?.(E,M),ke({isOpen:true,x:M.clientX,y:M.clientY,task:E});},[T]),Dg=useCallback((E,M)=>{let _=Ce.splitTask($,E.id,M);de(_),ke({isOpen:false,x:0,y:0,task:null});},[$]),Ld=useCallback(E=>{let M=Ce.findTaskById($,E.id)||E;F?.(M),se||Se(M);},[$,F,se]),Id=useCallback((E,M,_)=>{let ne=new Map,pe=kt=>{kt.forEach(ba=>{ba.dependencies&&ne.set(ba.id,ba.dependencies),ba.subtasks&&pe(ba.subtasks);});};pe(_);let we=ne.get(M)||[];ne.set(M,[...we,E]);let Tt=new Set,at=new Set,ha=kt=>{if(!Tt.has(kt)){Tt.add(kt),at.add(kt);let ba=ne.get(kt)||[];for(let ar of ba){if(!Tt.has(ar)&&ha(ar))return true;if(at.has(ar))return true}}return at.delete(kt),false};return ha(M)},[]),Bd=useCallback((E,M)=>{if(Id(E.id,M,$)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
357
357
|
|
|
358
|
-
Task dependencies must flow in one direction only.`);return}let G=se=>se.map(pe=>{if(pe.id===M){let we=pe.dependencies||[];if(!we.includes(E.id))return {...pe,dependencies:[...we,E.id]}}return pe.subtasks?{...pe,subtasks:G(pe.subtasks)}:pe});de(G($)),Me?.(E.id,M);},[$,Me,Ld]),Bd=useCallback((E,M)=>{let G=se=>se.map(pe=>{if(pe.id===E&&pe.dependencies){let we=pe.dependencies.filter(Tt=>Tt!==M);return {...pe,dependencies:we}}return pe.subtasks?{...pe,subtasks:G(pe.subtasks)}:pe});de(G($)),F?.(E,M);},[$,F]),{startDate:Wn,endDate:Sg}=useMemo(()=>{let E=$.filter(we=>we.startDate&&we.endDate);if(E.length===0){let we=new Date,Tt=new Date(we);Tt.setDate(Tt.getDate()-30);let tt=new Date(we);return tt.setDate(tt.getDate()+60),{startDate:Tt,endDate:tt}}let M=E.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),G=new Date(Math.min(...M.map(we=>we.getTime()))),se=new Date(Math.max(...M.map(we=>we.getTime()))),pe=_==="day"?7:_==="week"?14:30;return G.setDate(G.getDate()-pe),se.setDate(se.getDate()+pe),{startDate:G,endDate:se}},[$,_]),Eg=useCallback(async()=>{if(!P.current||!Ot.current||!Ba.current)return;await new Promise(lo=>setTimeout(lo,200));let E=P.current,M=Ot.current.querySelector(".gantt-grid-scroll"),G=Ba.current,se=M?.scrollTop||0,pe=M?.scrollLeft||0,we=G.scrollTop,Tt=G.scrollLeft,tt=E.style.overflow,ha=E.style.height,xt=M?.style.overflow||"",ba=G.style.overflow,ar=E.style.width,Ao=G.style.width;try{let lo=M?.querySelector(".gantt-taskgrid-content"),Cr=G.querySelector("svg"),Wr=Cr?.getAttribute("height")?parseInt(Cr.getAttribute("height"),10):Cr?.getBoundingClientRect().height||0,Lo=lo?.scrollHeight||M?.scrollHeight||600,co=Math.max(Wr,G.scrollHeight),$d=Cr?.getAttribute("width")?parseInt(Cr.getAttribute("width"),10):Cr?.getBoundingClientRect().width||G.scrollWidth,Rg=E.querySelector('[class*="h-12"]')?.offsetHeight||48,oi=Math.max(Lo,co,Wr),ni=Rg+oi+50,si=(M?.offsetWidth||300)+$d+10;M&&(M.scrollTop=0,M.scrollLeft=0),G.scrollTop=0,G.scrollLeft=0,E.style.overflow="visible",E.style.height=`${ni}px`,E.style.width=`${si}px`,M&&(M.style.overflow="visible",M.style.height=`${oi+50}px`),G.style.overflow="visible",G.style.height=`${oi+50}px`,G.style.width=`${$d+10}px`,await new Promise(li=>setTimeout(li,150));let Og=await Zu(E,{backgroundColor:J.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:si,height:ni,windowWidth:si+100,windowHeight:ni+100,scrollX:0,scrollY:0,ignoreElements:li=>{let zd=window.getComputedStyle(li),Ud=parseInt(zd.zIndex,10);return !isNaN(Ud)&&Ud>=50||zd.position==="fixed"}}),ii=document.createElement("a");ii.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ii.href=Og.toDataURL("image/png"),ii.click();}finally{E.style.overflow=tt,E.style.height=ha,E.style.width=ar,M&&(M.style.overflow=xt,M.style.height="",M.scrollTop=se,M.scrollLeft=pe),G.style.overflow=ba,G.style.height="",G.style.width=Ao,G.scrollTop=we,G.scrollLeft=Tt;}},[J]),Pg=useCallback(async()=>{await Ce.exportToPDF($);},[$]),Mg=useCallback(async()=>{await Ce.exportToExcel($);},[$]),Fg=useCallback(()=>{let E=Ce.exportToCSV($),M=new Blob([E],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(M),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href);},[$]),Ag=useCallback(()=>{let E=Ce.exportToJSON($),M=new Blob([E],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(M),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href);},[$]),Lg=useCallback(()=>{Ce.exportToMSProject($,"Gantt Project","project.xml");},[$]),Ig=E=>{E.preventDefault(),je(true);},Fo=useRef(false),[ri,Rd]=useState(false),rn=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=Ba.current,M=Ot.current?.querySelector(".gantt-grid-scroll");if(!E||!M)return;let G=()=>{if(Fo.current)return;Fo.current=true;let tt=E.scrollTop;rt(tt),M.scrollTop=tt,requestAnimationFrame(()=>{Fo.current=false;});},se=()=>{if(Fo.current)return;Fo.current=true;let tt=M.scrollTop;rt(tt),E.scrollTop=tt,requestAnimationFrame(()=>{Fo.current=false;});},pe=tt=>{if(ct&&M){let xt=M.parentElement?.getBoundingClientRect()?.left||0,ba=tt.clientX-xt,ar=200,Ao=Vt+Hr,lo=window.innerWidth*Pe,Cr=Math.max(Ao,lo);ba>=ar&&ba<=Cr&&W(ba);}if(ri&&E){let ha=tt.clientX-rn.current.x,xt=tt.clientY-rn.current.y;E.scrollLeft=rn.current.scrollLeft-ha,E.scrollTop=rn.current.scrollTop-xt;}},we=()=>{je(false),Rd(false);},Tt=tt=>{if(tt.button!==0)return;let ha=tt.target;ha.closest("[data-task-bar]")||ha.closest("[data-dependency-line]")||ha.closest("button")||ha.closest('[role="button"]')||ha.tagName==="rect"&&ha.getAttribute("data-clickable")==="true"||(Rd(true),rn.current={x:tt.clientX,y:tt.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},tt.preventDefault());};return E.addEventListener("scroll",G),M.addEventListener("scroll",se),E.addEventListener("mousedown",Tt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",we),()=>{E.removeEventListener("scroll",G),M.removeEventListener("scroll",se),E.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",we);}},[ct,ri,Vt]);let Od=useRef(false),Bg=useRef(null);return useLayoutEffect(()=>{if(Od.current||$.length===0||!Ba.current)return;Od.current=true,Bg.current=Wn;let E=Ba.current,M=new Date,G=_==="day"?60:_==="week"?20:8,se=(M.getTime()-Wn.getTime())/(1e3*60*60*24),pe=E.clientWidth,Tt=se*G*qe-pe/2;se>=0&&pe>0&&(E.scrollLeft=Math.max(0,Tt));},[$.length,Wn,_,qe]),jsx(Ko.Provider,{value:Xe,children:jsx(pi.Provider,{value:He,children:jsxs("div",{ref:P,className:"flex flex-col h-full w-full",style:{backgroundColor:J.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(vs,{theme:J,timeScale:_,onTimeScaleChange:q,zoom:qe,onZoomChange:Se,currentTheme:Ve,onThemeChange:Ke,rowDensity:ge,onRowDensityChange:De,showThemeSelector:u,showCreateTaskButton:b&&fe?.canCreateTask!==false&&!fe?.canCreateSubtaskOnly,createTaskLabel:x,onCreateTask:D,taskFilter:ae,onTaskFilterChange:I,hideCompleted:j,onHideCompletedChange:le,onExportPNG:i?Eg:void 0,onExportPDF:i?Pg:void 0,onExportExcel:i?Mg:void 0,onExportCSV:i?Fg:void 0,onExportJSON:i?Ag:void 0,onExportMSProject:i?Lg:void 0}),jsxs("div",{ref:Ot,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Fr,className:"gantt-grid-scroll flex-shrink-0",style:{width:Rt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Cs,{tasks:Pa,theme:J,rowHeight:ia,availableUsers:c,templates:ze,onTaskClick:R,onTaskDblClick:Ad,onTaskContextMenu:T,onTaskToggle:Oa,scrollTop:_e,columns:gt,onToggleColumn:Ra,onColumnResize:Aa,onTaskUpdate:wr,onTaskIndent:bg,onTaskOutdent:yg,onTaskMove:xg,onMultiTaskDelete:ti,onTaskDuplicate:kg,onTaskCreate:wg,onTaskRename:Cg,onCreateSubtask:ai,onOpenTaskModal:R?E=>R(E):void 0,onDeleteRequest:(E,M)=>Y({taskId:E,taskName:M}),onTaskReparent:vg,scrollContainerRef:Fr})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:J.border,zIndex:15},onMouseDown:Ig}),jsx("div",{ref:Ba,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:ri?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ps,{tasks:Pa,theme:J,rowHeight:ia,timeScale:_,startDate:Wn,endDate:Sg,zoom:qe,locale:y,templates:ze,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:R,onTaskDblClick:Ad,onTaskContextMenu:Ng,onTaskDateChange:Tg,onDependencyCreate:Id,onDependencyDelete:Bd})})]}),K.task&&jsx(Yo,{isOpen:K.isOpen,x:K.x,y:K.y,theme:J,onClose:()=>ke({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=K.task;if(!E)return [];let M=Ce.findTaskById($,E.id)||E,G=M.subtasks&&M.subtasks.length>0,se=fe?.canCreateTask!==false,pe=fe?.canDeleteTask!==false;if(G){let xt=[],ba=fe?.canDuplicateTask!==false;return se&&xt.push({id:"addSubtask",label:Xe.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?S(M):ai(M.id);}}),ba&&xt.push({id:"duplicate",label:Xe.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(M):de(ar=>xn(ar,[M.id]).tasks),ke({isOpen:false,x:0,y:0,task:null});}}),pe&&(xt.length>0&&xt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),xt.push({id:"delete",label:Xe.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{Y({taskId:M.id,taskName:M.name});}})),xt}let we=fe?.canUpdateTask!==false,Tt=fe?.canDuplicateTask!==false,tt=[];return we&&tt.push({id:"edit",label:Xe.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{ne?ne(M):Ne(M);}}),se&&tt.push({id:"addSubtask",label:Xe.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?S(M):ai(M.id);}}),tt.length>0&&we&&tt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),we&&(tt.push({id:"markIncomplete",label:Xe.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{V?V(M):wr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"}),tt.push({id:"setInProgress",label:Xe.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{ie?ie(M):wr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"}),tt.push({id:"markComplete",label:Xe.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{wr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"})),(Tt||we&&M.startDate&&M.endDate)&&tt.length>0&&tt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Tt&&tt.push({id:"duplicate",label:Xe.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(M):de(xt=>xn(xt,[M.id]).tasks),ke({isOpen:false,x:0,y:0,task:null});}}),we&&M.startDate&&M.endDate&&tt.push({id:"split",label:Xe.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{let xt=M.startDate.getTime(),ba=M.endDate.getTime(),ar=xt+(ba-xt)/2,Ao=new Date(ar);Dg(M,Ao);}}),pe&&(tt.length>0&&tt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),tt.push({id:"delete",label:Xe.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{Y({taskId:M.id,taskName:M.name});}})),tt})()}),jsx(Ir,{task:at,isOpen:!!at,onClose:()=>Ne(null),onTaskUpdate:E=>{at&&(wr(at.id,E),Ne(null));},theme:Ve==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsx(AnimatePresence,{children:Ie&&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:()=>Y(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:J.bgSecondary,border:`1px solid ${J.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${J.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:J.textPrimary,fontFamily:"Inter, sans-serif"},children:[Xe.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:J.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:J.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:J.textPrimary},children:['"',Ie.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:J.bgPrimary,borderTop:`1px solid ${J.border}`},children:[jsx("button",{onClick:()=>Y(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:J.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=J.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{ti([Ie.taskId]),Y(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),g?.enabled&&jsx(Ms,{tasks:$,theme:J,config:g,onTasksUpdate:de,onTaskUpdate:wr,onTaskCreate:E=>{de(M=>[...M,E]);},onTaskDelete:E=>{ti([E]);},onDependencyCreate:(E,M)=>{let G=Ce.findTaskById($,E);G&&Id(G,M);},onDependencyDelete:Bd})]})})})});function Zy(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Qy(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var El=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Pl=[{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 rm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:p=[],onUploadAttachments:f,onDeleteAttachment:v}){let k=[...El,...i.filter(I=>!El.some(j=>j.id===I.id))],g=st[u]||st.dark,[y,h]=useState(false),[b,x]=useState(false),[D,N]=useState(false),[C,w]=useState(false),[R,A]=useState({top:0,left:0}),[T,H]=useState(null),[L,ne]=useState(new Date),[S,V]=useState({top:0,left:0}),[ie,Me]=useState(false),[F,ye]=useState([]),[Q,te]=useState(false),[B,X$1]=useState(""),me=useRef(null),fe=useRef(null),Ge=useRef(null),be=useRef(null),Ve=useRef(null),[re,_]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[q,ge]=useState({});useEffect(()=>{a?(_({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)&&Me(true)):(_({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Me(false),ye([]));},[a,e]),useEffect(()=>{let I=j=>{me.current&&!me.current.contains(j.target)&&h(false),fe.current&&!fe.current.contains(j.target)&&x(false),Ge.current&&!Ge.current.contains(j.target)&&N(false),be.current&&!be.current.contains(j.target)&&w(false);};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let De=()=>{let I={};return re.name.trim()||(I.name="El nombre es requerido"),re.startDate&&re.endDate&&re.startDate>re.endDate&&(I.endDate="La fecha de fin debe ser posterior a la de inicio"),ge(I),Object.keys(I).length===0},qe=async I=>{if(I.preventDefault(),!!De())try{let j=l==="create"&&F.length>0?{...re,pendingFiles:F}:re;await s(j),ye([]),t();}catch(j){console.error("Error submitting task:",j);}},Se=(I,j)=>{_(le=>{let Te={...le,[I]:j};if(I==="status"){let _e=j;_e==="todo"?Te.progress=0:_e==="in-progress"?(le.progress===0||le.progress===100)&&(Te.progress=50):_e==="completed"||_e==="closed"?Te.progress=100:(_e==="in-review"||_e==="review")&&(Te.progress=75);}if(I==="progress"){let _e=typeof j=="number"?j:parseInt(j,10);_e===100&&le.status!=="completed"?Te.status="completed":_e>0&&_e<100&&le.status==="todo"?Te.status="in-progress":_e===0&&le.status!=="todo"&&(Te.status="todo");}return Te}),q[I]&&ge(le=>{let Te={...le};return delete Te[I],Te});},ot=k.find(I=>I.id===re.status)??El[0],We=Pl.find(I=>I.id===re.priority)??Pl[1],Qe=ho.find(I=>I.value===re.color)??ho[0],ae={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.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","data-theme":u,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ot.color||g.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=g.hoverBg,I.currentTarget.style.color=g.textPrimary;},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent",I.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:qe,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:re.name,onChange:I=>Se("name",I.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),q.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),q.name]})]}),jsx("div",{children:jsx("textarea",{value:re.description||"",onChange:I=>Se("description",I.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:me,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ae,borderColor:ot.color,backgroundColor:`${ot.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:ot.color}}),jsx("span",{style:{color:ot.color},children:ot.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:ot.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:k.map(I=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{Se("status",I.id),h(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:I.color}}),I.title,re.status===I.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),jsxs("div",{ref:fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&x(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ae,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:We.color}}),jsx("span",{children:We.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.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-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Pl.map(I=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:j=>j.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:j=>j.currentTarget.style.backgroundColor="transparent",onClick:()=>{Se("priority",I.id),x(false);},children:[jsx("span",{children:I.icon}),I.label,re.priority===I.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),o.length>0&&jsxs("div",{ref:Ge,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ae,disabled:n,children:[re.assignees&&re.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:re.assignees.slice(0,3).map((I,j)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:I.color||g.accent,borderColor:g.bgSecondary},children:I.initials},j))}),re.assignees.length>3&&jsxs("span",{style:{color:g.textTertiary},children:["+",re.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:D&&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:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(I=>{let j=re.assignees?.some(le=>le.name===I.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=j?(re.assignees||[]).filter(Te=>Te.name!==I.name):[...re.assignees||[],{name:I.name,avatar:I.avatar,initials:I.name.split(" ").map(Te=>Te[0]).join("").toUpperCase().slice(0,2),color:g.accent}];Se("assignees",le);},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:g.accent},children:I.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:I.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:j&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},I.id)})})})]}),jsxs("div",{ref:be,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(C)w(false);else {if(be.current){let I=be.current.getBoundingClientRect(),j=window.innerHeight,le=120,_e=j-I.bottom<le?I.top-le-8:I.bottom+8;A({top:_e,left:I.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ae,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:re.color}}),jsx("span",{children:Qe.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsxs(kt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(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:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:I=>I.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:ho.slice(0,18).map(I=>{let j=re.color===I.value;return jsx("button",{type:"button",onClick:le=>{le.preventDefault(),le.stopPropagation(),Se("color",I.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:I.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:I.value,outline:j?`2px solid ${I.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},I.value)})})})})]})})]}),c.length>0||d?jsx(jr,{selectedTags:re.tags||[],availableTags:c,onChange:I=>Se("tags",I),onCreateTag:d,theme:g,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{ref:Ve,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(T==="start")H(null);else {if(Ve.current){let I=Ve.current.getBoundingClientRect(),j=window.innerHeight,le=320,_e=j-I.bottom<le?I.top-le-8:I.bottom+8;V({top:_e,left:I.left});}H("start"),ne(re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ae,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.startDate?re.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(T==="end")H(null);else {if(Ve.current){let I=Ve.current.getBoundingClientRect(),j=window.innerHeight,le=320,_e=j-I.bottom<le?I.top-le-8:I.bottom+8;V({top:_e,left:I.left});}H("end"),ne(re.endDate||re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ae,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.endDate?re.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:T&&jsxs(kt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(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:`${S.top}px`,left:`${S.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let I=new Date,j=new Date(I);j.setDate(I.getDate()+1);let le=new Date(I);le.setDate(I.getDate()+7);let Te=new Date(I);return Te.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:j},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:Te}].map((rt,ct)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:je=>je.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:je=>je.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(Se("startDate",rt.date),(!re.endDate||rt.date>re.endDate)&&Se("endDate",rt.date),H("end")):(Se("endDate",rt.date),(!re.startDate||rt.date<re.startDate)&&Se("startDate",rt.date),H(null));},children:rt.label},ct))})(),jsx("div",{style:{borderTop:`1px solid ${g.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:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{Se("startDate",void 0),Se("endDate",void 0),H(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:()=>ne(new Date(L.getFullYear(),L.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:L.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>ne(new Date(L.getFullYear(),L.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((I,j)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:I},j))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let I=L.getFullYear(),j=L.getMonth(),le=new Date(I,j,1).getDay(),Te=new Date(I,j+1,0).getDate(),_e=new Date,rt=[];for(let je=le-1;je>=0;je--)rt.push({day:new Date(I,j,-je).getDate(),date:new Date(I,j-1,new Date(I,j,-je).getDate()),isCurrentMonth:false});for(let je=1;je<=Te;je++)rt.push({day:je,date:new Date(I,j,je),isCurrentMonth:true});let ct=42-rt.length;for(let je=1;je<=ct;je++)rt.push({day:je,date:new Date(I,j+1,je),isCurrentMonth:false});return rt.map((je,sa)=>{let W=je.date.toDateString()===_e.toDateString(),K=re.startDate?.toDateString()===je.date.toDateString(),ke=re.endDate?.toDateString()===je.date.toDateString(),at=re.startDate&&re.endDate&&je.date>=re.startDate&&je.date<=re.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:je.isCurrentMonth?K||ke?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:K?"#3B82F6":ke?"#7C3AED":at?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:W&&!K&&!ke?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(Se("startDate",je.date),re.endDate&&je.date>re.endDate&&Se("endDate",je.date),H("end")):(Se("endDate",je.date),re.startDate&&je.date<re.startDate&&Se("startDate",je.date),H(null));},children:je.day},sa)})})()})]})]})]})})]}),q.endDate&&jsx("span",{className:"text-xs text-red-400",children:q.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:re.progress,onChange:I=>Se("progress",parseInt(I.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"}20`,color:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},children:[re.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>Me(!ie),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ie&&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("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:g.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:re.effortMinutes?Zy(re.effortMinutes):"",onChange:I=>{let j=Qy(I.target.value);Se("effortMinutes",j);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textPrimary,border:`1px solid ${g.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(f||p.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},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"})}),jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",l==="create"?F.length>0&&`(${F.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(Er,{cardId:"pending",attachments:F.map((I,j)=>({id:`pending-${j}`,cardId:"pending",name:I.name,size:I.size,type:I.type,url:URL.createObjectURL(I),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:I=>ye(j=>[...j,...I]),onDelete:I=>{let j=parseInt(I.replace("pending-",""),10);ye(le=>le.filter((Te,_e)=>_e!==j));},maxSizeMB:10,maxFiles:20}):jsx(Er,{cardId:a?.id||"new",attachments:p,onUpload:f&&a?.id?I=>f(a.id,I):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),l==="create"&&F.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[F.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),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:re.isMilestone,onChange:I=>Se("isMilestone",I.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),re.dependencies&&re.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:re.dependencies.map(I=>{let j=r.find(le=>le.id===I);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[j?.name||I.slice(0,8),jsx("button",{type:"button",onClick:()=>{let le=(re.dependencies||[]).filter(Te=>Te!==I);Se("dependencies",le);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},I)})}),jsxs("button",{type:"button",onClick:()=>{te(!Q),X$1("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Q&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{te(false),X$1("");}}),jsxs(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 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsx("input",{type:"text",value:B,onChange:I=>X$1(I.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(I=>I.id!==a?.id).filter(I=>B===""||I.name.toLowerCase().includes(B.toLowerCase())).map(I=>{let j=re.dependencies?.includes(I.id);return jsxs("button",{type:"button",onClick:()=>{let le=re.dependencies||[],Te;j?Te=le.filter(_e=>_e!==I.id):Te=[...le,I.id],Se("dependencies",Te);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:j?`${g.accent}10`:"transparent"},onMouseEnter:le=>{j||(le.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:le=>{le.currentTarget.style.backgroundColor=j?`${g.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:j?g.accent:"transparent",borderColor:j?g.accent:g.borderLight},children:j&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:I.name}),jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:I.id.slice(0,8)})]})]},I.id)}),r.filter(I=>I.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:I=>!n&&(I.currentTarget.style.opacity="0.9"),onMouseLeave:I=>!n&&(I.currentTarget.style.opacity="1"),children:n?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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var om=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
358
|
+
Task dependencies must flow in one direction only.`);return}let _=ne=>ne.map(pe=>{if(pe.id===M){let we=pe.dependencies||[];if(!we.includes(E.id))return {...pe,dependencies:[...we,E.id]}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});de(_($)),Ae?.(E.id,M);},[$,Ae,Id]),Rd=useCallback((E,M)=>{let _=ne=>ne.map(pe=>{if(pe.id===E&&pe.dependencies){let we=pe.dependencies.filter(Tt=>Tt!==M);return {...pe,dependencies:we}}return pe.subtasks?{...pe,subtasks:_(pe.subtasks)}:pe});de(_($)),L?.(E,M);},[$,L]),{startDate:Gn,endDate:Sg}=useMemo(()=>{let E=$.filter(we=>we.startDate&&we.endDate);if(E.length===0){let we=new Date,Tt=new Date(we);Tt.setDate(Tt.getDate()-30);let at=new Date(we);return at.setDate(at.getDate()+60),{startDate:Tt,endDate:at}}let M=E.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),_=new Date(Math.min(...M.map(we=>we.getTime()))),ne=new Date(Math.max(...M.map(we=>we.getTime()))),pe=V==="day"?7:V==="week"?14:30;return _.setDate(_.getDate()-pe),ne.setDate(ne.getDate()+pe),{startDate:_,endDate:ne}},[$,V]),Eg=useCallback(async()=>{if(!P.current||!Ot.current||!Ra.current)return;await new Promise(co=>setTimeout(co,200));let E=P.current,M=Ot.current.querySelector(".gantt-grid-scroll"),_=Ra.current,ne=M?.scrollTop||0,pe=M?.scrollLeft||0,we=_.scrollTop,Tt=_.scrollLeft,at=E.style.overflow,ha=E.style.height,kt=M?.style.overflow||"",ba=_.style.overflow,ar=E.style.width,Lo=_.style.width;try{let co=M?.querySelector(".gantt-taskgrid-content"),Cr=_.querySelector("svg"),Gr=Cr?.getAttribute("height")?parseInt(Cr.getAttribute("height"),10):Cr?.getBoundingClientRect().height||0,Io=co?.scrollHeight||M?.scrollHeight||600,uo=Math.max(Gr,_.scrollHeight),zd=Cr?.getAttribute("width")?parseInt(Cr.getAttribute("width"),10):Cr?.getBoundingClientRect().width||_.scrollWidth,Rg=E.querySelector('[class*="h-12"]')?.offsetHeight||48,ii=Math.max(Io,uo,Gr),li=Rg+ii+50,di=(M?.offsetWidth||300)+zd+10;M&&(M.scrollTop=0,M.scrollLeft=0),_.scrollTop=0,_.scrollLeft=0,E.style.overflow="visible",E.style.height=`${li}px`,E.style.width=`${di}px`,M&&(M.style.overflow="visible",M.style.height=`${ii+50}px`),_.style.overflow="visible",_.style.height=`${ii+50}px`,_.style.width=`${zd+10}px`,await new Promise(ui=>setTimeout(ui,150));let Og=await Zu(E,{backgroundColor:Z.bgPrimary,scale:2,logging:!1,useCORS:!0,allowTaint:!0,width:di,height:li,windowWidth:di+100,windowHeight:li+100,scrollX:0,scrollY:0,ignoreElements:ui=>{let Ud=window.getComputedStyle(ui),Hd=parseInt(Ud.zIndex,10);return !isNaN(Hd)&&Hd>=50||Ud.position==="fixed"}}),ci=document.createElement("a");ci.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,ci.href=Og.toDataURL("image/png"),ci.click();}finally{E.style.overflow=at,E.style.height=ha,E.style.width=ar,M&&(M.style.overflow=kt,M.style.height="",M.scrollTop=ne,M.scrollLeft=pe),_.style.overflow=ba,_.style.height="",_.style.width=Lo,_.scrollTop=we,_.scrollLeft=Tt;}},[Z]),Pg=useCallback(async()=>{await Ce.exportToPDF($);},[$]),Mg=useCallback(async()=>{await Ce.exportToExcel($);},[$]),Fg=useCallback(()=>{let E=Ce.exportToCSV($),M=new Blob([E],{type:"text/csv;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(M),_.download="gantt-chart.csv",_.click(),URL.revokeObjectURL(_.href);},[$]),Ag=useCallback(()=>{let E=Ce.exportToJSON($),M=new Blob([E],{type:"application/json;charset=utf-8;"}),_=document.createElement("a");_.href=URL.createObjectURL(M),_.download="gantt-chart.json",_.click(),URL.revokeObjectURL(_.href);},[$]),Lg=useCallback(()=>{Ce.exportToMSProject($,"Gantt Project","project.xml");},[$]),Ig=E=>{E.preventDefault(),qe(true);},Ao=useRef(false),[si,Od]=useState(false),on=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=Ra.current,M=Ot.current?.querySelector(".gantt-grid-scroll");if(!E||!M)return;let _=()=>{if(Ao.current)return;Ao.current=true;let at=E.scrollTop;ot(at),M.scrollTop=at,requestAnimationFrame(()=>{Ao.current=false;});},ne=()=>{if(Ao.current)return;Ao.current=true;let at=M.scrollTop;ot(at),E.scrollTop=at,requestAnimationFrame(()=>{Ao.current=false;});},pe=at=>{if(ct&&M){let kt=M.parentElement?.getBoundingClientRect()?.left||0,ba=at.clientX-kt,ar=200,Lo=Vt+Wr,co=window.innerWidth*Me,Cr=Math.max(Lo,co);ba>=ar&&ba<=Cr&&G(ba);}if(si&&E){let ha=at.clientX-on.current.x,kt=at.clientY-on.current.y;E.scrollLeft=on.current.scrollLeft-ha,E.scrollTop=on.current.scrollTop-kt;}},we=()=>{qe(false),Od(false);},Tt=at=>{if(at.button!==0)return;let ha=at.target;ha.closest("[data-task-bar]")||ha.closest("[data-dependency-line]")||ha.closest("button")||ha.closest('[role="button"]')||ha.tagName==="rect"&&ha.getAttribute("data-clickable")==="true"||(Od(true),on.current={x:at.clientX,y:at.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},at.preventDefault());};return E.addEventListener("scroll",_),M.addEventListener("scroll",ne),E.addEventListener("mousedown",Tt),document.addEventListener("mousemove",pe),document.addEventListener("mouseup",we),()=>{E.removeEventListener("scroll",_),M.removeEventListener("scroll",ne),E.removeEventListener("mousedown",Tt),document.removeEventListener("mousemove",pe),document.removeEventListener("mouseup",we);}},[ct,si,Vt]);let $d=useRef(false),Bg=useRef(null);return useLayoutEffect(()=>{if($d.current||$.length===0||!Ra.current)return;$d.current=true,Bg.current=Gn;let E=Ra.current,M=new Date,_=V==="day"?60:V==="week"?20:8,ne=(M.getTime()-Gn.getTime())/(1e3*60*60*24),pe=E.clientWidth,Tt=ne*_*Xe-pe/2;ne>=0&&pe>0&&(E.scrollLeft=Math.max(0,Tt));},[$.length,Gn,V,Xe]),jsx(qo.Provider,{value:Ze,children:jsx(hi.Provider,{value:Ve,children:jsxs("div",{ref:P,className:"flex flex-col h-full w-full",style:{backgroundColor:Z.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx(xs,{theme:Z,timeScale:V,onTimeScaleChange:Y,zoom:Xe,onZoomChange:z,currentTheme:_e,onThemeChange:Ye,rowDensity:me,onRowDensityChange:Te,showThemeSelector:u,showCreateTaskButton:b&&fe?.canCreateTask!==false&&!fe?.canCreateSubtaskOnly,createTaskLabel:x,onCreateTask:D,taskFilter:J,onTaskFilterChange:I,hideCompleted:K,onHideCompletedChange:le,onExportPNG:i?Eg:void 0,onExportPDF:i?Pg:void 0,onExportExcel:i?Mg:void 0,onExportCSV:i?Fg:void 0,onExportJSON:i?Ag:void 0,onExportMSProject:i?Lg:void 0}),jsxs("div",{ref:Ot,className:"flex-1 flex min-h-0",style:{overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Ar,className:"gantt-grid-scroll flex-shrink-0",style:{width:Rt,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Ts,{tasks:Pa,theme:Z,rowHeight:ia,availableUsers:c,templates:We,onTaskClick:R,onTaskDblClick:Ld,onTaskContextMenu:T,onTaskToggle:$a,scrollTop:je,columns:ft,onToggleColumn:Oa,onColumnResize:Aa,onTaskUpdate:wr,onTaskIndent:bg,onTaskOutdent:yg,onTaskMove:xg,onMultiTaskDelete:oi,onTaskDuplicate:kg,onTaskCreate:wg,onTaskRename:Cg,onCreateSubtask:ni,onOpenTaskModal:R?E=>R(E):void 0,onDeleteRequest:(E,M)=>X({taskId:E,taskName:M}),onTaskReparent:vg,scrollContainerRef:Ar})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-blue-500/50 transition-colors h-full",style:{width:1,backgroundColor:Z.border,zIndex:15},onMouseDown:Ig}),jsx("div",{ref:Ra,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:si?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ms,{tasks:Pa,theme:Z,rowHeight:ia,timeScale:V,startDate:Gn,endDate:Sg,zoom:Xe,locale:y,templates:We,dependencyLineStyle:a?.dependencyLineStyle,onTaskClick:R,onTaskDblClick:Ld,onTaskContextMenu:Ng,onTaskDateChange:Tg,onDependencyCreate:Bd,onDependencyDelete:Rd})})]}),q.task&&jsx(Yo,{isOpen:q.isOpen,x:q.x,y:q.y,theme:Z,onClose:()=>ke({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=q.task;if(!E)return [];let M=Ce.findTaskById($,E.id)||E,_=M.subtasks&&M.subtasks.length>0,ne=fe?.canCreateTask!==false,pe=fe?.canDeleteTask!==false;if(_){let kt=[],ba=fe?.canDuplicateTask!==false;return ne&&kt.push({id:"addSubtask",label:Ze.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?S(M):ni(M.id);}}),ba&&kt.push({id:"duplicate",label:Ze.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(M):de(ar=>kn(ar,[M.id]).tasks),ke({isOpen:false,x:0,y:0,task:null});}}),pe&&(kt.length>0&&kt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),kt.push({id:"delete",label:Ze.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{X({taskId:M.id,taskName:M.name});}})),kt}let we=fe?.canUpdateTask!==false,Tt=fe?.canDuplicateTask!==false,at=[];return we&&at.push({id:"edit",label:Ze.contextMenu?.editTask||"Edit Task",icon:Lt.Pencil,onClick:()=>{se?se(M):Se(M);}}),ne&&at.push({id:"addSubtask",label:Ze.contextMenu?.addSubtask||"Add Subtask",icon:Lt.Add,onClick:()=>{S?S(M):ni(M.id);}}),at.length>0&&we&&at.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),we&&(at.push({id:"markIncomplete",label:Ze.contextMenu?.markIncomplete||"Mark Incomplete",icon:Lt.MarkIncomplete,onClick:()=>{j?j(M):wr(M.id,{status:"todo",progress:0});},disabled:M.status==="todo"}),at.push({id:"setInProgress",label:Ze.contextMenu?.setInProgress||"Set In Progress",icon:Lt.SetInProgress,onClick:()=>{ie?ie(M):wr(M.id,{status:"in-progress"});},disabled:M.status==="in-progress"}),at.push({id:"markComplete",label:Ze.contextMenu?.markComplete||"Mark Complete",icon:Lt.MarkComplete,onClick:()=>{wr(M.id,{status:"completed",progress:100});},disabled:M.status==="completed"})),(Tt||we&&M.startDate&&M.endDate)&&at.length>0&&at.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Tt&&at.push({id:"duplicate",label:Ze.contextMenu?.duplicateTask||"Duplicate Task",icon:Lt.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(M):de(kt=>kn(kt,[M.id]).tasks),ke({isOpen:false,x:0,y:0,task:null});}}),we&&M.startDate&&M.endDate&&at.push({id:"split",label:Ze.contextMenu?.splitTask||"Split Task",icon:Lt.Split,onClick:()=>{let kt=M.startDate.getTime(),ba=M.endDate.getTime(),ar=kt+(ba-kt)/2,Lo=new Date(ar);Dg(M,Lo);}}),pe&&(at.length>0&&at.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),at.push({id:"delete",label:Ze.contextMenu?.deleteTask||"Delete Task",icon:Lt.Delete,onClick:()=>{X({taskId:M.id,taskName:M.name});}})),at})()}),jsx(Br,{task:rt,isOpen:!!rt,onClose:()=>Se(null),onTaskUpdate:E=>{rt&&(wr(rt.id,E),Se(null));},theme:_e==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:c,availableTasks:t}),jsx(AnimatePresence,{children:Re&&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:()=>X(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:Z.bgSecondary,border:`1px solid ${Z.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Z.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:Z.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ze.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="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:Z.textSecondary,fontFamily:"Inter, sans-serif"},children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Z.textPrimary},children:['"',Re.taskName,'"']}),"."]})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Z.bgPrimary,borderTop:`1px solid ${Z.border}`},children:[jsx("button",{onClick:()=>X(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Z.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=Z.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{oi([Re.taskId]),X(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"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),g?.enabled&&jsx(Ls,{tasks:$,theme:Z,config:g,onTasksUpdate:de,onTaskUpdate:wr,onTaskCreate:E=>{de(M=>[...M,E]);},onTaskDelete:E=>{oi([E]);},onDependencyCreate:(E,M)=>{let _=Ce.findTaskById($,E);_&&Bd(_,M);},onDependencyDelete:Rd})]})})})});function Zy(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Qy(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let o=t.match(/(\d+)m/);if(o&&o[1])return parseInt(o[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let n=t.match(/^(\d+)$/);return n&&n[1]?parseInt(n[1],10)*60:null}var Pl=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Ml=[{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 rm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:o=[],onSubmit:s,isLoading:n=false,mode:l=a?"edit":"create",theme:u="dark",customStatuses:i=[],availableTags:c=[],onCreateTag:d,attachments:p=[],onUploadAttachments:f,onDeleteAttachment:v}){let k=[...Pl,...i.filter(I=>!Pl.some(K=>K.id===I.id))],g=st[u]||st.dark,[y,h]=useState(false),[b,x]=useState(false),[D,N]=useState(false),[C,w]=useState(false),[R,F]=useState({top:0,left:0}),[T,H]=useState(null),[A,se]=useState(new Date),[S,j]=useState({top:0,left:0}),[ie,Ae]=useState(false),[L,ge]=useState([]),[ee,Ke]=useState(false),[B,te]=useState(""),xe=useRef(null),fe=useRef(null),He=useRef(null),ve=useRef(null),_e=useRef(null),[re,V]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],tags:[]}),[Y,me]=useState({});useEffect(()=>{a?(V({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)&&Ae(true)):(V({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#6366F1",assignees:[],dependencies:[],pendingFiles:[],tags:[]}),Ae(false),ge([]));},[a,e]),useEffect(()=>{let I=K=>{xe.current&&!xe.current.contains(K.target)&&h(false),fe.current&&!fe.current.contains(K.target)&&x(false),He.current&&!He.current.contains(K.target)&&N(false),ve.current&&!ve.current.contains(K.target)&&w(false);};return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[]);let Te=()=>{let I={};return re.name.trim()||(I.name="El nombre es requerido"),re.startDate&&re.endDate&&re.startDate>re.endDate&&(I.endDate="La fecha de fin debe ser posterior a la de inicio"),me(I),Object.keys(I).length===0},Xe=async I=>{if(I.preventDefault(),!!Te())try{let K=l==="create"&&L.length>0?{...re,pendingFiles:L}:re;await s(K),ge([]),t();}catch(K){console.error("Error submitting task:",K);}},z=(I,K)=>{V(le=>{let De={...le,[I]:K};if(I==="status"){let je=K;je==="todo"?De.progress=0:je==="in-progress"?(le.progress===0||le.progress===100)&&(De.progress=50):je==="completed"||je==="closed"?De.progress=100:(je==="in-review"||je==="review")&&(De.progress=75);}if(I==="progress"){let je=typeof K=="number"?K:parseInt(K,10);je===100&&le.status!=="completed"?De.status="completed":je>0&&je<100&&le.status==="todo"?De.status="in-progress":je===0&&le.status!=="todo"&&(De.status="todo");}return De}),Y[I]&&me(le=>{let De={...le};return delete De[I],De});},Ne=k.find(I=>I.id===re.status)??Pl[0],Pe=Ml.find(I=>I.id===re.priority)??Ml[1],Fe=bo.find(I=>I.value===re.color)??bo[0],J={backgroundColor:g.bgSecondary,border:`1px solid ${g.borderLight}`,color:g.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","data-theme":u,style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-5 py-3",style:{borderBottom:`1px solid ${g.border}`},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Ne.color||g.accent}}),jsx("span",{className:"text-sm font-medium",style:{color:g.textSecondary},children:l==="create"?"Nueva tarea":"Editar tarea"})]}),jsx("button",{onClick:t,className:"p-1.5 rounded-lg transition-colors",style:{color:g.textTertiary},onMouseEnter:I=>{I.currentTarget.style.backgroundColor=g.hoverBg,I.currentTarget.style.color=g.textPrimary;},onMouseLeave:I=>{I.currentTarget.style.backgroundColor="transparent",I.currentTarget.style.color=g.textTertiary;},disabled:n,children:jsx(X,{className:"w-4 h-4"})})]}),jsxs("form",{onSubmit:Xe,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:re.name,onChange:I=>z("name",I.target.value),className:"w-full text-lg font-medium bg-transparent border-none focus:outline-none focus:ring-0 placeholder:opacity-50",style:{color:g.textPrimary},placeholder:"Nombre de la tarea",disabled:n,autoFocus:true}),Y.name&&jsxs("p",{className:"mt-1 text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Y.name]})]}),jsx("div",{children:jsx("textarea",{value:re.description||"",onChange:I=>z("description",I.target.value),className:"w-full text-sm bg-transparent border-none focus:outline-none focus:ring-0 resize-none placeholder:opacity-40",style:{color:g.textSecondary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:n})}),jsx("div",{style:{borderTop:`1px solid ${g.borderLight}`}}),jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:xe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&h(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...J,borderColor:Ne.color,backgroundColor:`${Ne.color}15`},disabled:n,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Ne.color}}),jsx("span",{style:{color:Ne.color},children:Ne.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Ne.color}})]}),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-[140px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:k.map(I=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{z("status",I.id),h(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:I.color}}),I.title,re.status===I.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),jsxs("div",{ref:fe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&x(!b),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:J,disabled:n,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:Pe.color}}),jsx("span",{children:Pe.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.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-[130px] rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:Ml.map(I=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:K=>K.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{z("priority",I.id),x(false);},children:[jsx("span",{children:I.icon}),I.label,re.priority===I.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:g.accent}})]},I.id))})})]}),o.length>0&&jsxs("div",{ref:He,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&N(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:J,disabled:n,children:[re.assignees&&re.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:re.assignees.slice(0,3).map((I,K)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:I.color||g.accent,borderColor:g.bgSecondary},children:I.initials},K))}),re.assignees.length>3&&jsxs("span",{style:{color:g.textTertiary},children:["+",re.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:g.textTertiary}}),jsx("span",{style:{color:g.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:D&&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:g.bgPrimary,border:`1px solid ${g.border}`},children:o.map(I=>{let K=re.assignees?.some(le=>le.name===I.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:g.textPrimary},onMouseEnter:le=>le.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:le=>le.currentTarget.style.backgroundColor="transparent",onClick:()=>{let le=K?(re.assignees||[]).filter(De=>De.name!==I.name):[...re.assignees||[],{name:I.name,avatar:I.avatar,initials:I.name.split(" ").map(De=>De[0]).join("").toUpperCase().slice(0,2),color:g.accent}];z("assignees",le);},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:g.accent},children:I.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:I.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:K&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:g.accent}})})]},I.id)})})})]}),jsxs("div",{ref:ve,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!n)if(C)w(false);else {if(ve.current){let I=ve.current.getBoundingClientRect(),K=window.innerHeight,le=120,je=K-I.bottom<le?I.top-le-8:I.bottom+8;F({top:je,left:I.left});}w(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:J,disabled:n,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:re.color}}),jsx("span",{children:Fe.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:g.textTertiary}})]}),jsx(AnimatePresence,{children:C&&jsxs(wt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>w(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:`${R.top}px`,left:`${R.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:I=>I.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:bo.slice(0,18).map(I=>{let K=re.color===I.value;return jsx("button",{type:"button",onClick:le=>{le.preventDefault(),le.stopPropagation(),z("color",I.value),w(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:I.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:I.value,outline:K?`2px solid ${I.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},I.value)})})})})]})})]}),c.length>0||d?jsx(Kr,{selectedTags:re.tags||[],availableTags:c,onChange:I=>z("tags",I),onCreateTag:d,theme:g,disabled:n}):null]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Calendar,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{ref:_e,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(T==="start")H(null);else {if(_e.current){let I=_e.current.getBoundingClientRect(),K=window.innerHeight,le=320,je=K-I.bottom<le?I.top-le-8:I.bottom+8;j({top:je,left:I.left});}H("start"),se(re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...J,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.startDate?re.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:g.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!n&&!re.isMilestone)if(T==="end")H(null);else {if(_e.current){let I=_e.current.getBoundingClientRect(),K=window.innerHeight,le=320,je=K-I.bottom<le?I.top-le-8:I.bottom+8;j({top:je,left:I.left});}H("end"),se(re.endDate||re.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...J,opacity:re.isMilestone?.5:1,cursor:re.isMilestone?"not-allowed":"pointer"},disabled:n||re.isMilestone,children:re.endDate?re.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:T&&jsxs(wt,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>H(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:`${S.top}px`,left:`${S.left}px`,zIndex:99999,backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},onClick:I=>I.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${g.border}`},children:[(()=>{let I=new Date,K=new Date(I);K.setDate(I.getDate()+1);let le=new Date(I);le.setDate(I.getDate()+7);let De=new Date(I);return De.setDate(I.getDate()+14),[{label:"Hoy",date:I},{label:"Ma\xF1ana",date:K},{label:"Pr\xF3xima semana",date:le},{label:"2 semanas",date:De}].map((ot,ct)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:g.textPrimary},onMouseEnter:qe=>qe.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:qe=>qe.currentTarget.style.backgroundColor="transparent",onClick:()=>{T==="start"?(z("startDate",ot.date),(!re.endDate||ot.date>re.endDate)&&z("endDate",ot.date),H("end")):(z("endDate",ot.date),(!re.startDate||ot.date<re.startDate)&&z("startDate",ot.date),H(null));},children:ot.label},ct))})(),jsx("div",{style:{borderTop:`1px solid ${g.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:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",onClick:()=>{z("startDate",void 0),z("endDate",void 0),H(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:()=>se(new Date(A.getFullYear(),A.getMonth()-1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:g.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:g.textPrimary},children:A.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>se(new Date(A.getFullYear(),A.getMonth()+1)),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:g.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((I,K)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:g.textTertiary},children:I},K))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let I=A.getFullYear(),K=A.getMonth(),le=new Date(I,K,1).getDay(),De=new Date(I,K+1,0).getDate(),je=new Date,ot=[];for(let qe=le-1;qe>=0;qe--)ot.push({day:new Date(I,K,-qe).getDate(),date:new Date(I,K-1,new Date(I,K,-qe).getDate()),isCurrentMonth:false});for(let qe=1;qe<=De;qe++)ot.push({day:qe,date:new Date(I,K,qe),isCurrentMonth:true});let ct=42-ot.length;for(let qe=1;qe<=ct;qe++)ot.push({day:qe,date:new Date(I,K+1,qe),isCurrentMonth:false});return ot.map((qe,sa)=>{let G=qe.date.toDateString()===je.toDateString(),q=re.startDate?.toDateString()===qe.date.toDateString(),ke=re.endDate?.toDateString()===qe.date.toDateString(),rt=re.startDate&&re.endDate&&qe.date>=re.startDate&&qe.date<=re.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:qe.isCurrentMonth?q||ke?"#FFF":g.textPrimary:g.textTertiary,backgroundColor:q?"#3B82F6":ke?"#7C3AED":rt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:G&&!q&&!ke?"inset 0 0 0 1px #3B82F6":"none"},onClick:()=>{T==="start"?(z("startDate",qe.date),re.endDate&&qe.date>re.endDate&&z("endDate",qe.date),H("end")):(z("endDate",qe.date),re.startDate&&qe.date<re.startDate&&z("startDate",qe.date),H(null));},children:qe.day},sa)})})()})]})]})]})})]}),Y.endDate&&jsx("span",{className:"text-xs text-red-400",children:Y.endDate})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:"w-4 h-4",style:{color:g.textTertiary}}),jsxs("div",{className:"flex items-center gap-3 flex-1",children:[jsx("input",{type:"range",min:"0",max:"100",step:"5",value:re.progress,onChange:I=>z("progress",parseInt(I.target.value)),className:"flex-1 h-1.5 rounded-full appearance-none cursor-pointer",style:{backgroundColor:g.bgSecondary,accentColor:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},disabled:n}),jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full min-w-[45px] text-center",style:{backgroundColor:`${re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"}20`,color:re.progress<30?"#EF4444":re.progress<70?"#F59E0B":"#10B981"},children:[re.progress,"%"]})]})]}),jsxs("div",{children:[jsxs("button",{type:"button",onClick:()=>Ae(!ie),className:"flex items-center gap-2 text-xs w-full py-2 transition-colors",style:{color:g.textTertiary},children:[jsx(ChevronDown,{className:`w-3 h-3 transition-transform ${ie?"rotate-180":""}`}),"Opciones avanzadas"]}),jsx(AnimatePresence,{children:ie&&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("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:g.textTertiary},children:"Duraci\xF3n estimada"})]}),jsx("input",{type:"text",placeholder:"ej: 8 (=8h), 2h 30m, 1d",value:re.effortMinutes?Zy(re.effortMinutes):"",onChange:I=>{let K=Qy(I.target.value);z("effortMinutes",K);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textPrimary,border:`1px solid ${g.borderLight}`}}),jsx("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)"})]}),(f||p.length>0||l==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:g.textTertiary},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"})}),jsxs("span",{className:"text-xs",style:{color:g.textTertiary},children:["Adjuntos ",l==="create"?L.length>0&&`(${L.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(Er,{cardId:"pending",attachments:L.map((I,K)=>({id:`pending-${K}`,cardId:"pending",name:I.name,size:I.size,type:I.type,url:URL.createObjectURL(I),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:I=>ge(K=>[...K,...I]),onDelete:I=>{let K=parseInt(I.replace("pending-",""),10);ge(le=>le.filter((De,je)=>je!==K));},maxSizeMB:10,maxFiles:20}):jsx(Er,{cardId:a?.id||"new",attachments:p,onUpload:f&&a?.id?I=>f(a.id,I):void 0,onDelete:v,maxSizeMB:10,maxFiles:20}),l==="create"&&L.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:g.textTertiary},children:[L.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),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:re.isMilestone,onChange:I=>z("isMilestone",I.target.checked),className:"w-4 h-4 rounded",style:{accentColor:g.accent},disabled:n}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:g.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:g.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),re.dependencies&&re.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:re.dependencies.map(I=>{let K=r.find(le=>le.id===I);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${g.accent}20`,color:g.accent},children:[K?.name||I.slice(0,8),jsx("button",{type:"button",onClick:()=>{let le=(re.dependencies||[]).filter(De=>De!==I);z("dependencies",le);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:n,children:jsx(X,{className:"w-3 h-3"})})]},I)})}),jsxs("button",{type:"button",onClick:()=>{Ke(!ee),te("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:g.bgSecondary,color:g.textSecondary},disabled:n,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ke(false),te("");}}),jsxs(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 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:g.bgPrimary,border:`1px solid ${g.border}`},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${g.border}`},children:jsx("input",{type:"text",value:B,onChange:I=>te(I.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:g.bgSecondary,color:g.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(I=>I.id!==a?.id).filter(I=>B===""||I.name.toLowerCase().includes(B.toLowerCase())).map(I=>{let K=re.dependencies?.includes(I.id);return jsxs("button",{type:"button",onClick:()=>{let le=re.dependencies||[],De;K?De=le.filter(je=>je!==I.id):De=[...le,I.id],z("dependencies",De);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:K?`${g.accent}10`:"transparent"},onMouseEnter:le=>{K||(le.currentTarget.style.backgroundColor=g.hoverBg);},onMouseLeave:le=>{le.currentTarget.style.backgroundColor=K?`${g.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:K?g.accent:"transparent",borderColor:K?g.accent:g.borderLight},children:K&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:g.textPrimary},children:I.name}),jsx("span",{className:"text-[10px]",style:{color:g.textTertiary},children:I.id.slice(0,8)})]})]},I.id)}),r.filter(I=>I.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:g.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-3",style:{borderTop:`1px solid ${g.border}`},children:[jsx("button",{type:"button",onClick:t,className:"px-4 py-2 text-sm rounded-lg transition-colors",style:{color:g.textSecondary},onMouseEnter:I=>I.currentTarget.style.backgroundColor=g.hoverBg,onMouseLeave:I=>I.currentTarget.style.backgroundColor="transparent",disabled:n,children:"Cancelar"}),jsx("button",{type:"submit",disabled:n,className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:g.accent,color:"#FFF"},onMouseEnter:I=>!n&&(I.currentTarget.style.opacity="0.9"),onMouseLeave:I=>!n&&(I.currentTarget.style.opacity="1"),children:n?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:l==="create"?"Crear tarea":"Guardar"})})]})]})]})})]})})}var om=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
359
359
|
|
|
360
360
|
AVAILABLE COMMANDS:
|
|
361
361
|
1. move_task - Move a task to a different date
|
|
@@ -400,13 +400,13 @@ If ambiguous, ask for clarification in the message field.`;function nm(e){return
|
|
|
400
400
|
${sm(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",n=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${o} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${n}`}).join(`
|
|
401
401
|
`)}
|
|
402
402
|
|
|
403
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function sm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Ur(e,t){let a=sm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let u=l.name.toLowerCase();return n.every(i=>u.includes(i))})}function Ml(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 p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}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 f={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(f!==void 0){let v=new Date(r),k=v.getDay(),g=f-k;return g<=0&&(g+=7),v.setDate(v.getDate()+g),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 p=parseInt(s[1],10),f=s[2].toLowerCase(),v=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?v.setDate(v.getDate()+p):f==="week"||f==="semana"||f==="semanas"?v.setDate(v.getDate()+p*7):(f==="month"||f==="mes"||f==="meses")&&v.setMonth(v.getMonth()+p),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),f=parseInt(l[2],10)-1,v=parseInt(l[3],10);return new Date(v,f,p)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=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(i&&i[1]&&i[2]){let p=parseInt(i[1],10),f=u[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(v,f,p)}let c={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 p=c[d[1].toLowerCase()],f=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(v,p,f)}return null}function Fl(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 Al(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 im(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 lm(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 i=r[1].trim(),c=r[2].trim(),d=Ur(t,i),p=Ml(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(p);return v.setDate(v.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:v},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=Ur(t,i),p=Fl(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${p} days. New end date: ${f.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 i=s[1].trim(),c=s[2].trim(),d=Ur(t,i),p=Al(c);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),d=Ur(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=Ur(t,i),p=Ur(t,c);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),c=Ur(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function dm(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 ev(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 tv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Ls(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(p=>p.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Ls(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},l=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||l&&u&&Math.abs(u.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:u,progress:e.progress||0,status:ev(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:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function cm(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:tv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function um(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Ls(r,e,t))}var Ll={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},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"}},Il={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},Is={en:Ll,es:Il};function Bl(e){return Is[e]||Is.en}function Bs(e,t){let a=Bl(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}var Rl=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function mm(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function pm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let u=mm(e),i=Rl[0],c=Rl.find(f=>f.value===u)??i,d=c.icon,p=f=>{switch(mm(f)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Rl.map(f=>{let v=f.icon;return jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",u===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(v,{className:m("w-4 h-4",f.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(f.value)})]},f.value)})})]})}var Ol=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function fm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let u=Ol.find(c=>c.value===e)??Ol[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:m("w-4 h-4",u.color)}),jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:m("w-4 h-4",u.color)}),jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]}),jsx(ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Ol.map(c=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function $s(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function zs(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function xv(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function ym({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[l,u]=useState(false),[i,c]=useState(""),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&(u(false),c(""));};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]);let p=t.filter(g=>g.name.toLowerCase().includes(i.toLowerCase())||g.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...p].sort((g,y)=>{let h={light:0,moderate:1,heavy:2,overloaded:3},b=g.workload?.level??"light",x=y.workload?.level??"light";return h[b]-h[x]}):p,v=g=>e.some(y=>y.name===g),k=g=>{if(a)if(v(g.name))a(e.filter(y=>y.name!==g.name));else {let y={name:g.name,initials:$s(g.name),color:g.color||zs(g.name).replace("bg-","").replace("-500",""),avatar:g.avatarUrl};a([...e,y]);}};return s||!a?e.length===0?jsx("span",{className:m("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((g,y)=>jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!g.avatar&&zs(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,title:g.name,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||$s(g.name)},`${g.name}-${y}`)),e.length>3&&jsxs("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:g=>{g.stopPropagation(),u(!l);},className:m("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:m("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:m("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((g,y)=>jsx("div",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!g.avatar&&zs(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||$s(g.name)},`${g.name}-${y}`)),e.length>2&&jsxs("span",{className:m("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),l&&jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[n&&jsxs("div",{className:m("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-[#9CA3AF] border-white/10":"text-gray-500 border-gray-200"),children:[jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:i,onChange:g=>c(g.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:m("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:g=>g.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(g=>{let y=xv(g.workload,r);return jsxs("button",{onClick:h=>{h.stopPropagation(),k(g);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",g.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:y?.tooltip,children:[jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!g.avatarUrl&&zs(g.name)),children:g.avatarUrl?jsx("img",{src:g.avatarUrl,alt:g.name,className:"w-full h-full rounded-full object-cover"}):$s(g.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:g.name}),g.email&&jsx("div",{className:m("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:g.email})]}),n&&y&&jsxs("div",{className:m("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",y.color),children:[y.icon&&jsx(y.icon,{className:"w-3 h-3"}),y.label]}),v(g.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},g.id)})}),e.length>0&&jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((g,y)=>jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[g.name,jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==g.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${g.name}-${y}`))})]})]})}function km({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:u}){let[i,c]=useState(false),[d,p]=useState(o),[f,v]=useState(()=>{let C=o==="start"?e:t;if(C){let w=C instanceof Date?C:new Date(C);return new Date(w.getFullYear(),w.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),k=useRef(null),g=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let C=w=>{k.current&&!k.current.contains(w.target)&&c(false);};return i&&document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=C=>C?C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):u||"-",b=useCallback(()=>{let C=f.getFullYear(),w=f.getMonth(),R=new Date(C,w,1),T=new Date(C,w+1,0).getDate(),H=R.getDay(),L=[],S=new Date(C,w,0).getDate();for(let ie=H-1;ie>=0;ie--)L.push({date:new Date(C,w-1,S-ie),isCurrentMonth:false});for(let ie=1;ie<=T;ie++)L.push({date:new Date(C,w,ie),isCurrentMonth:true});let V=42-L.length;for(let ie=1;ie<=V;ie++)L.push({date:new Date(C,w+1,ie),isCurrentMonth:false});return L},[f]),x=C=>{if(r)o==="start"?a(C,y||void 0):a(g||void 0,C),c(false);else if(d==="start"){let w=y&&C>y?C:y;a(C,w||void 0),p("end");}else {let w=g&&C<g?C:g;a(w||void 0,C),c(false);}},D=()=>{let C=new Date,w=new Date(C);w.setDate(C.getDate()+1);let R=new Date(C);R.setDate(C.getDate()+((6-C.getDay()+7)%7||7));let A=new Date(C);A.setDate(C.getDate()+((1-C.getDay()+7)%7||7));let T=new Date(C);T.setDate(C.getDate()+(6-C.getDay()+7)%7+7);let H=new Date(C);H.setDate(C.getDate()+14);let L=new Date(C);return L.setDate(C.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:A,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:L,display:L.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let C=r&&o==="start"?g:y;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(C)})]})}let N=r&&o==="start"?g:y;return jsxs("div",{ref:k,className:"relative",children:[jsxs("button",{onClick:C=>{C.stopPropagation(),c(!i);let w=o==="start"?g:y;w&&v(new Date(w.getFullYear(),w.getMonth(),1));},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(N)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:C=>C.stopPropagation(),children:[jsxs("div",{className:m("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[D().map((C,w)=>jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(C.date),children:[jsx("span",{children:C.label}),jsx("span",{className:m("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:C.display})]},w)),jsx("div",{className:m("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(g||void 0,void 0):a(void 0,void 0),c(false);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:m("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:d==="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:m("font-medium",s?"text-white":"text-gray-900"),children:f.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>v(new Date),className:m("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()-1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()+1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),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(C=>jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:C},C))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:b().map((C,w)=>{let R=C.date.toDateString()===new Date().toDateString(),A=g?.toDateString()===C.date.toDateString(),T=y?.toDateString()===C.date.toDateString(),H=A||T,L=!r&&g&&y&&C.date>=g&&C.date<=y;return jsx("button",{onClick:()=>x(new Date(C.date)),className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!C.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),C.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",A&&"bg-[#3B82F6] text-white",T&&!A&&"bg-[#7C3AED] text-white",L&&!H&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!H&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:C.date.getDate()},w)})})]})]})]})]})}function Us({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let u=e?e instanceof Date?e:new Date(e):null;return jsx(km,{startDate:s==="start"?u:n||null,endDate:s==="end"?u:l||null,onChange:(p,f)=>{t&&t(s==="start"?p:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function en(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Hs(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[l,u]=useState(false),i=useRef(e),c=useRef([]);return useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,p=e,f=p-d,v=r/o;u(true);for(let k=1;k<=o;k++){let g=setTimeout(()=>{let y=k/o,h=1-Math.pow(1-y,3),b=Math.round(d+f*h);n(b),k===o&&(u(false),n(p));},v*k);c.current.push(g);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function wm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,l]=useState(0),u=useRef(null),i=useRef(null),c=useCallback(f=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(f),l(0);let v=Date.now();i.current=setInterval(()=>{let k=Date.now()-v,g=Math.min(k/a*100,100);l(g);},16),u.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),s(null),l(0);},a);},[a,e]),d=useCallback(()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:d}}function Nm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=en(),{displayValue:u,isAnimating:i}=Hs(e,{enabled:o,duration:300,steps:6}),c=p=>{if(r||!t)return;p.stopPropagation();let f=p.currentTarget.getBoundingClientRect(),v=p.clientX-f.left,k=Math.round(v/f.width*100),g=Math.max(0,Math.min(100,k));g!==e&&(t(g),s&&l());},d=u??e;return jsxs("div",{className:m("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-all duration-300",n&&(a?"bg-green-500/30":"bg-green-500/20")),children:[jsx("div",{onClick:c,className:m("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:m("h-full rounded-full transition-all",d===100?"bg-green-500":"bg-[#3B82F6]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxs("span",{className:m("text-xs w-8 text-right tabular-nums transition-all",a?"text-[#9CA3AF]":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function Em({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,u]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{u(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?c():p.key==="Escape"&&(u(e),n(false));};return o||!t?jsx("span",{className:m("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>u(p.target.value),onBlur:c,onKeyDown:d,onClick:p=>p.stopPropagation(),className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:m("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Fm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:u=true}){let[i,c]=useState(false),[d,p]=useState(e?.toString()||""),f=useRef(null),{isFlashing:v,triggerFlash:k}=en(),{displayValue:g,isAnimating:y}=Hs(e,{enabled:l&&!i});useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let x=parseFloat(d);if(!isNaN(x)){let D=x;o!==void 0&&(D=Math.max(o,D)),s!==void 0&&(D=Math.min(s,D)),D!==e&&(t?.(D),u&&k());}c(false);},b=x=>{x.key==="Enter"?h():x.key==="Escape"&&(p(e?.toString()||""),c(false));};return n||!t?jsx("span",{className:m("text-sm transition-all",a?"text-[#94A3B8]":"text-gray-500",y&&"font-medium"),children:g!==void 0?g:r}):i?jsx("input",{ref:f,type:"number",value:d,onChange:x=>p(x.target.value),onBlur:h,onKeyDown:b,onClick:x=>x.stopPropagation(),min:o,max:s,className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:x=>{x.stopPropagation(),c(true);},className:m("text-sm text-left w-full px-2 py-1 rounded transition-all duration-300",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",g===void 0&&(a?"text-[#6B7280]":"text-gray-400"),v&&(a?"bg-green-500/30":"bg-green-500/20"),y&&"font-medium scale-105"),children:g!==void 0?g:r})}function Am({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),u=useRef(null);return useEffect(()=>{let i=c=>{u.current&&!u.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:m("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("span",{className:m("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:m("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:m("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Im({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:u,startChange:i,cancelChange:c}=wm(t,{delay:s}),d=f=>{f.stopPropagation(),!r&&t&&(o?l?c():i(!e):t(!e));},p=l?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:m("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-all",p?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#0F1117]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${u/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:f=>{f.stopPropagation(),c();},className:m("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Om({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:m("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:m("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Uv(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function Hv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),u=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+u}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function To({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false}){let[u,i]=useState(false),[c,d]=useState(""),p=useRef(null),{isFlashing:f,triggerFlash:v}=en(),k=Uv(e,r);useEffect(()=>{u&&p.current&&(p.current.focus(),p.current.select());},[u]),useEffect(()=>{if(e){let h=Math.floor(e/60),b=e%60;h>0&&b>0?d(`${h}h ${b}m`):h>0?d(`${h}h`):d(`${b}m`);}else d("");},[e,u]);let g=()=>{let h=Hv(c);h!==e&&(t?.(h),n&&v()),i(false);},y=h=>{h.key==="Enter"?g():h.key==="Escape"&&i(false);};return l?jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-[#94A3B8]":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]}):s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:k})]}):u?jsx("input",{ref:p,type:"text",value:c,onChange:h=>d(h.target.value),onBlur:g,onKeyDown:y,onClick:h=>h.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:h=>{h.stopPropagation(),i(true);},className:m("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-all duration-300 overflow-hidden",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400",f&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(Clock,{className:m("w-3 h-3 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:"truncate",children:k})]})}function tx(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ax(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Gm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:u,onColumnSort:i,availableUsers:c=[]}){let d=useRef(null),p=r==="es"?Hm.es:Hm.en;if(useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&t();},h=b=>{b.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),l&&(y.push({id:"status",label:p.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let b=e.task.assignees||[],D=b.some(N=>N.name===h.name)?b.filter(N=>N.name!==h.name):[...b,{name:h.name,initials:tx(h.name),color:h.color||ax(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:D}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},v=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:p.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),y},k=e.type==="task"?f():v(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:d,style:g,className:m("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:k.map(y=>y.separator?jsx("div",{className:m("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsx(rx,{item:y,isDark:a},y.id):jsxs("button",{onClick:y.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:m(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function rx({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:m("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:m("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Hm={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var Xm={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},yx=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Zm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[u,i]=useState(""),[c,d]=useState(null),p=useRef(null),f=l==="es"?Jm.es:Jm.en;if(useLayoutEffect(()=>{if(!e||!p.current)return;let b=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),N=window.innerHeight-x.top-20;d(Math.max(300,N));};return requestAnimationFrame(b),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[e]),useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let x=N=>{p.current&&!p.current.contains(N.target)&&t();},D=N=>{N.key==="Escape"&&t();};document.addEventListener("mousedown",x),document.addEventListener("keydown",D),p._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let v=b=>f.columns[b]||b,k=b=>{if(b==="name")return;let x=a.map(D=>D.id===b?{...D,visible:!D.visible}:D);o(x);},g=(b,x)=>{let D=a.find(C=>C.type===b&&(!x||C.customFieldId===x));if(D){k(D.id);return}let N={id:x||b,type:b,label:x?r.find(C=>C.id===x)?.name||b:v(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:x};o([...a,N]);},y=yx.filter(b=>v(b).toLowerCase().includes(u.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(u.toLowerCase()));return jsxs("div",{ref:p,style:c?{maxHeight:`${c}px`}:void 0,className:m("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50 flex flex-col",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:m("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:m("font-medium",n?"text-white":"text-gray-900"),children:f.title}),jsx("button",{onClick:t,className:m("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:m("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:u,onChange:b=>i(b.target.value),placeholder:f.searchPlaceholder,className:m("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",onWheel:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.standardFields}),jsx("div",{className:"space-y-1",children:y.map(b=>{let x=a.find(C=>C.type===b&&!C.customFieldId),D=x?.visible??false,N=b==="name";return jsxs("button",{onClick:()=>{N||(x?k(x.id):g(b));},disabled:N,className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",N&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",D?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:D&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Xm[b]}),jsx("span",{className:n?"text-white":"text-gray-900",children:v(b)})]},b)})})]}),h.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.customFields}),jsx("div",{className:"space-y-1",children:h.map(b=>{let D=a.find(N=>N.customFieldId===b.id)?.visible??false;return jsxs("button",{onClick:()=>g(b.type,b.id),className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",D?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:D&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Xm[b.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]})]})]})}var Jm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Sx=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function tp({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,u]=useState("text"),[i,c]=useState([""]),d=o==="es"?ep.es:ep.en;useEffect(()=>{e&&(n(""),u("text"),c([""]));},[e]),useEffect(()=>{let g=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(y=>y.trim())),a(g),t();},f=()=>{c([...i,""]);},v=(g,y)=>{let h=[...i];h[g]=y,c(h);},k=g=>{i.length>1&&c(i.filter((y,h)=>h!==g));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:m("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:m("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:m("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:m("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:m("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:m("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:Sx.map(g=>jsxs("button",{onClick:()=>u(g.type),className:m("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsx("span",{className:m("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((g,y)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:g,onChange:h=>v(y,h.target.value),placeholder:`${d.option} ${y+1}`,className:m("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>k(y),className:m("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},y)),jsxs("button",{onClick:f,className:m("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:m("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var ep={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var op={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function np({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=useState(false),u=useRef(null),i=useRef(0),c=s==="es"?op.es:op.en;useEffect(()=>{if(!n)return;let f=k=>{Date.now()-i.current<100||u.current&&!u.current.contains(k.target)&&l(false);},v=k=>{k.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(v=>!v);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,p&&jsx("span",{className:m("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxs("div",{className:m("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:m("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:m("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(f=>{let v=e===f.value&&!t,k=()=>f.value==="all"?v?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",v&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m(v?f.color:"text-gray-400","flex-shrink-0"),children:k()}),jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),v&&jsx(Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsx("div",{className:m("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsx(EyeOff,{className:m("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Hx=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function dp(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(...dp(r.subtasks,t+1));return a}function cp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:u=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:p=true,showHierarchy:f=true,tableColumns:v,allowColumnCustomization:k=true,allowColumnResize:g=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:b,persistFilter:x=false,financialBlur:D}=t,N=Bs(c,d),C=i==="dark",w=useCallback(()=>{if(!x||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let W=localStorage.getItem(x);if(W){let K=JSON.parse(W);return {statusFilter:K.statusFilter||"all",hideCompleted:K.hideCompleted||!1}}}catch(W){console.error("Error loading persisted filter:",W);}return {statusFilter:"all",hideCompleted:false}},[x]),[R,A]=useState("startDate"),[T,H]=useState("asc"),[L,ne]=useState(""),[S,V]=useState(()=>w().statusFilter),[ie,Me]=useState(()=>w().hideCompleted),[F,ye]=useState(v||Hx),[Q,te]=useState(false),[B,X]=useState(false),[me,fe]=useState({isOpen:false,x:0,y:0,type:"task"}),[Ge,be]=useState(null),[Ve,re]=useState(0),[_,q]=useState(0),ge=useRef(null);useEffect(()=>{v&&ye(v);},[v]),useEffect(()=>{if(!(!x||typeof window>"u"))try{localStorage.setItem(x,JSON.stringify({statusFilter:S,hideCompleted:ie}));}catch(W){console.error("Error persisting filter state:",W);}},[x,S,ie]);let De=useMemo(()=>{let W=new Set;function K(ke){for(let at of ke)at.subtasks?.length&&(at.isExpanded!==false&&W.add(at.id),K(at.subtasks));}return K(e),W},[e]),qe=useMemo(()=>F.filter(W=>W.visible),[F]),Se=useCallback(W=>{a.onTaskToggleExpand?.(W);},[a]),ot=useCallback(W=>{R===W?H(K=>K==="asc"?"desc":"asc"):(A(W),H("asc")),a.onSortChange?.({column:W,direction:T==="asc"?"desc":"asc"});},[R,T,a]),We=useCallback(W=>{ye(W),a.onColumnsChange?.(W);},[a]),Qe=useCallback(W=>{let K=F.map(ke=>ke.id===W?{...ke,visible:false}:ke);We(K);},[F,We]),ae=useCallback((W,K)=>{A(W),H(K);},[]),I=useCallback((W,K,ke)=>{y&&(W.preventDefault(),fe({isOpen:true,x:W.clientX,y:W.clientY,type:K?"task":"header",task:K,columnId:ke}));},[y]),j=useCallback(()=>{fe(W=>({...W,isOpen:false}));},[]),le=useCallback((W,K)=>{if(!g)return;W.preventDefault(),W.stopPropagation();let ke=F.find(at=>at.id===K);ke&&(be(K),re(W.clientX),q(ke.width));},[F,g]);useEffect(()=>{if(!Ge)return;let W=ke=>{let at=ke.clientX-Ve,Ne=Math.max(50,_+at),Ie=F.map(Y=>Y.id===Ge?{...Y,width:Ne}:Y);ye(Ie);},K=()=>{Ge&&a.onColumnsChange?.(F),be(null);};return document.addEventListener("mousemove",W),document.addEventListener("mouseup",K),()=>{document.removeEventListener("mousemove",W),document.removeEventListener("mouseup",K);}},[Ge,Ve,_,F,a]);let Te=useCallback(async W=>{if(a.onCreateCustomField){let K={...W,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(K);}X(false);},[a]),_e=useCallback(W=>W.progress===100||W.status==="completed"?"completed":W.progress&&W.progress>0||W.status==="in-progress"?"in-progress":"todo",[]),rt=useMemo(()=>{let W=dp(e);if(L.trim()){let K=L.toLowerCase();W=W.filter(ke=>ke.name.toLowerCase().includes(K));}return S!=="all"&&(W=W.filter(K=>_e(K)===S)),ie&&(W=W.filter(K=>_e(K)!=="completed")),W.sort((K,ke)=>{let at,Ne;switch(R){case "name":at=K.name.toLowerCase(),Ne=ke.name.toLowerCase();break;case "startDate":at=K.startDate?.getTime()||0,Ne=ke.startDate?.getTime()||0;break;case "endDate":at=K.endDate?.getTime()||0,Ne=ke.endDate?.getTime()||0;break;case "progress":at=K.progress||0,Ne=ke.progress||0;break;case "status":at=K.status||"todo",Ne=ke.status||"todo";break;case "priority":let Ie={urgent:0,high:1,medium:2,low:3,none:4};at=Ie[K.priority]??4,Ne=Ie[ke.priority]??4;break;default:return 0}return at<Ne?T==="asc"?-1:1:at>Ne?T==="asc"?1:-1:0}),W},[e,L,S,ie,R,T,_e]),ct=useCallback((W,K)=>{let ke=Ie=>{a.onTaskUpdate?.({...W,...Ie});},at=Ie=>Ie?W.customFields?.find(Ke=>Ke.fieldId===Ie)?.value:void 0,Ne=(Ie,Y)=>{if(!Ie)return;let $=[...W.customFields||[]],de=$.findIndex(Be=>Be.fieldId===Ie);de>=0?$[de]={fieldId:Ie,value:Y}:$.push({fieldId:Ie,value:Y}),ke({customFields:$});};switch(K.type){case "name":return null;case "status":return jsx(pm,{value:W.status||(W.progress===100?"completed":W.progress&&W.progress>0?"in-progress":"todo"),onChange:Y=>{ke({status:Y,progress:Y==="completed"?100:Y==="in-progress"?50:0});},isDark:C,locale:c,translations:N.status});case "priority":return jsx(fm,{value:W.priority,onChange:Y=>ke({priority:Y}),isDark:C,locale:c});case "assignees":return jsx(ym,{value:W.assignees||[],availableUsers:l,onChange:Y=>ke({assignees:Y}),isDark:C,locale:c});case "startDate":return jsx(Us,{value:W.startDate,onChange:Y=>ke({startDate:Y}),isDark:C,locale:c,dateField:"start",startDate:W.startDate,endDate:W.endDate});case "endDate":return jsx(Us,{value:W.endDate,onChange:Y=>ke({endDate:Y}),isDark:C,locale:c,dateField:"end",startDate:W.startDate,endDate:W.endDate});case "progress":return jsx(Nm,{value:W.progress||0,onChange:Y=>{let Ke=Y===100?"completed":Y>0?"in-progress":"todo";ke({progress:Y,status:Ke});},isDark:C});case "tags":return jsx(Om,{value:W.tags||[],isDark:C});case "text":return jsx(Em,{value:at(K.customFieldId)||"",onChange:Y=>Ne(K.customFieldId,Y),isDark:C});case "number":return jsx(Fm,{value:at(K.customFieldId)||0,onChange:Y=>Ne(K.customFieldId,Y),isDark:C});case "date":let Ie=at(K.customFieldId);return jsx(Us,{value:Ie?new Date(Ie):void 0,onChange:Y=>Ne(K.customFieldId,Y),isDark:C,locale:c});case "dropdown":return jsx(Am,{value:at(K.customFieldId)||"",options:K.options||[],onChange:Y=>Ne(K.customFieldId,Y),isDark:C});case "checkbox":return jsx(Im,{value:at(K.customFieldId)||false,onChange:Y=>Ne(K.customFieldId,Y),isDark:C});case "estimatedTime":{let Y=W.status==="completed"||W.progress===100;return jsx(To,{value:W.estimatedTime,onChange:Ke=>ke({estimatedTime:Ke}),isDark:C,locale:c,disabled:Y})}case "quotedTime":{let Y=W.status==="completed"||W.progress===100,Ke=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsx(To,{value:W.quotedTime,onChange:$=>ke({quotedTime:$}),isDark:C,locale:c,disabled:Y,isBlurred:Ke})}case "elapsedTime":{let Y=W.status==="completed"||W.progress===100;return jsx(To,{value:W.elapsedTime,onChange:Ke=>ke({elapsedTime:Ke}),isDark:C,locale:c,disabled:Y})}case "effortMinutes":{let Y=W.status==="completed"||W.progress===100;return jsx(To,{value:W.effortMinutes,onChange:Ke=>ke({effortMinutes:Ke}),isDark:C,locale:c,disabled:Y})}case "timeLoggedMinutes":{let Y=W.status==="completed"||W.progress===100;return jsx(To,{value:W.timeLoggedMinutes,onChange:a.onLogTime?Ke=>{a.onLogTime?.(W,Ke);}:void 0,isDark:C,locale:c,placeholder:c==="es"?"Agregar":"Add",disabled:Y})}case "soldEffortMinutes":{let Y=W.status==="completed"||W.progress===100,Ke=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsx(To,{value:W.soldEffortMinutes,onChange:$=>ke({soldEffortMinutes:$}),isDark:C,locale:c,disabled:Y,isBlurred:Ke})}default:return jsx("span",{className:m("text-sm",C?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,C,c,l,N]),je=useCallback(W=>{let ke={name:N.columns.name,status:N.columns.status,priority:N.columns.priority,assignees:N.columns.assignees,startDate:N.columns.startDate,endDate:N.columns.endDate,progress:N.columns.progress,tags:N.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:N.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),quotedTime:N.columns.quotedTime||(c==="es"?"Ofertado":"Quoted"),elapsedTime:N.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent"),effortMinutes:N.columns.effortMinutes||(c==="es"?"Estimado":"Estimated"),timeLoggedMinutes:N.columns.timeLoggedMinutes||(c==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:N.columns.soldEffortMinutes||(c==="es"?"Ofertado":"Quoted")}[W.type]||W.label;return typeof ke=="string"?ke:String(ke||W.type)},[N,c]),sa=useMemo(()=>qe.reduce((W,K)=>W+K.width,0)+(k?48:0),[qe,k]);return r?jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,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:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[N.empty.noTasks,"..."]})]})}):o?jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,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:m("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,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:m("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:N.empty.noTasks}),jsx("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:N.empty.addFirstTask})]})}):jsxs("div",{ref:ge,className:m("flex-1 flex flex-col w-full h-full overflow-hidden",C?"bg-[#0F1117]":"bg-white",Ge&&"select-none",s),style:n,children:[jsx("div",{className:m("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:[jsx(np,{value:S,hideCompleted:ie,onChange:V,onHideCompletedChange:Me,isDark:C,locale:c}),jsxs("div",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[rt.length," ",N.pagination.tasks]}),p&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:m("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:L,onChange:W=>ne(W.target.value),placeholder:N.toolbar.searchPlaceholder,className:m("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")})]}),jsx("div",{className:"flex-1"}),h&&b&&jsxs(motion.button,{onClick:b,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-4 h-4"}),jsx("span",{children:N.toolbar.newTask})]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:sa},children:[jsxs("div",{className:m("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",C?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[qe.map(W=>jsxs("div",{className:m("relative flex items-center gap-2 px-4 py-3",C?"text-[#9CA3AF]":"text-gray-500"),style:{width:W.width,minWidth:W.minWidth},onContextMenu:K=>I(K,void 0,W.id),children:[W.sortable?jsxs("button",{onClick:()=>ot(W.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[je(W),jsx(ArrowUpDown,{className:m("w-3 h-3",R===W.id&&"text-[#3B82F6]")})]}):jsx("span",{children:je(W)}),g&&W.resizable&&jsx("div",{className:m("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",Ge===W.id&&"bg-[#3B82F6]"),onMouseDown:K=>le(K,W.id)})]},W.id)),k&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:W=>{W.stopPropagation(),te(K=>!K);},className:m("p-1.5 rounded-lg transition-colors",C?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Q&&(C?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(Zm,{isOpen:Q,onClose:()=>te(false),columns:F,customFields:u,onColumnsChange:We,onCreateCustomField:()=>{te(false),X(true);},isDark:C,locale:c})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:rt.map((W,K)=>{let ke=De.has(W.id),at=Math.min(K*.01,.2);return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:at},className:m("flex items-center border-b transition-colors",C?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(W),onDoubleClick:()=>a.onTaskDoubleClick?.(W),onContextMenu:Ne=>I(Ne,W),children:[qe.map(Ne=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Ne.width,minWidth:Ne.minWidth},children:Ne.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&W.level>0&&jsx("div",{style:{width:`${W.level*24}px`},className:"flex-shrink-0"}),f&&W.hasChildren&&jsx("button",{onClick:Ie=>{Ie.stopPropagation(),Se(W.id);},className:m("p-0.5 rounded flex-shrink-0",C?"hover:bg-white/10":"hover:bg-gray-200"),children:ke?jsx(ChevronDown,{className:m("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:m("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")})}),f&&!W.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("span",{className:m("truncate font-medium",C?"text-white":"text-gray-900",W.progress===100&&(C?"line-through text-[#6B7280]":"line-through text-gray-400")),children:W.name})]}):ct(W,Ne)},Ne.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},W.id)})}),rt.length===0&&L&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:m("w-12 h-12 mx-auto mb-4",C?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:m(C?"text-[#9CA3AF]":"text-gray-600"),children:N.empty.noResults})]})})]})}),jsx(Gm,{state:me,onClose:j,isDark:C,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Qe,onColumnSort:ae,availableUsers:l}),jsx(tp,{isOpen:B,onClose:()=>X(false),onSave:Te,isDark:C,locale:c})]})}var up=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],mp=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"}],pp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var ql={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"},Xl={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"},Jl={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"},Vs={dark:ql,light:Xl,neutral:Jl};function gp(e){return Vs[e]||Vs.dark}var Zl={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"}},Ql={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"}},_s={en:Zl,es:Ql};function Ln(e){return _s[e]||_s.en}function js(e,t){let a=Ln(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 fp(e){let t=Ln(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 hp(e,t=0,a=true){let r=Ln(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 kp(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 td(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 wp({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 Tp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:u=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:k,onTaskOpen:g,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,timerState:x,onLogTime:D,onUpdateEstimate:N,onUpdateSoldEffort:C,onStartTimer:w,onStopTimer:R,onDiscardTimer:A,blurFinancials:T=false}){let{theme:H="dark",locale:L="en",customTranslations:ne}=t,S=js(L,ne),V=H==="dark",[ie,Me]=useState(r||new Date),[F,ye]=useState(null),[Q,te]=useState(null),[B,X$1]=useState({}),me=4,fe=3,[Ge,be]=useState(null),[Ve,re]=useState(""),[_,q]=useState(void 0),[ge,De]=useState(null),[qe,Se]=useState(false),[ot,We]=useState(false),[Qe,ae]=useState(null),[I,j]=useState(false),[le,Te]=useState(new Date),_e=useCallback(()=>{Me(new Date(ie.getFullYear(),ie.getMonth()-1,1));},[ie]),rt=useCallback(()=>{Me(new Date(ie.getFullYear(),ie.getMonth()+1,1));},[ie]),ct=useCallback(()=>{Me(new Date);},[]),je=useMemo(()=>{let K=ie.getFullYear(),ke=ie.getMonth(),at=new Date(K,ke,1),Ne=new Date(K,ke+1,0),Ie=at.getDay(),Y=Ne.getDate(),Ke=kp(e),$=new Date;$.setHours(0,0,0,0);let de=[],Be=Ie,Ze=new Date(K,ke,0).getDate();for(let Ue=Be-1;Ue>=0;Ue--){let ve=new Date(K,ke-1,Ze-Ue);de.push({date:ve,isCurrentMonth:false,isToday:false,isWeekend:ve.getDay()===0||ve.getDay()===6,events:Ke.filter($e=>td(ve,$e)).map($e=>({id:$e.id,title:$e.name,start:$e.startDate,end:$e.endDate,task:$e}))});}for(let Ue=1;Ue<=Y;Ue++){let ve=new Date(K,ke,Ue),$e=ve.getTime()===$.getTime();de.push({date:ve,isCurrentMonth:true,isToday:$e,isWeekend:ve.getDay()===0||ve.getDay()===6,events:Ke.filter(U=>td(ve,U)).map(U=>({id:U.id,title:U.name,start:U.startDate,end:U.endDate,task:U}))});}let et=42-de.length;for(let Ue=1;Ue<=et;Ue++){let ve=new Date(K,ke+1,Ue);de.push({date:ve,isCurrentMonth:false,isToday:false,isWeekend:ve.getDay()===0||ve.getDay()===6,events:Ke.filter($e=>td(ve,$e)).map($e=>({id:$e.id,title:$e.name,start:$e.startDate,end:$e.endDate,task:$e}))});}return de},[ie,e]),sa=L==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],W=ie.toLocaleDateString(L==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#0F1117]":"bg-white",n),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:m("text-sm",V?"text-[#9CA3AF]":"text-gray-600"),children:[S.labels.noEvents,"..."]})]})}):s?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#0F1117]":"bg-white",n),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:m("text-lg font-semibold mb-2",V?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:m("text-sm",V?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:m("flex-1 flex items-center justify-center",V?"bg-[#0F1117]":"bg-white",n),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(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:m("text-lg font-semibold mb-2",V?"text-white":"text-gray-900"),children:S.labels.noEvents}),jsx("p",{className:m("text-sm",V?"text-[#9CA3AF]":"text-gray-600"),children:S.labels.newTask})]})}):jsxs("div",{className:m("flex-1 flex flex-col w-full h-full overflow-auto",V?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsx("div",{className:m("flex-shrink-0 px-6 py-4 border-b",V?"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:m("text-xl font-semibold capitalize",V?"text-white":"text-gray-900"),children:W}),jsx("button",{onClick:ct,className:m("px-3 py-1.5 text-sm rounded-lg transition-colors",V?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:S.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:_e,className:m("p-2 rounded-lg transition-colors",V?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:m("w-5 h-5",V?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:rt,className:m("p-2 rounded-lg transition-colors",V?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:m("w-5 h-5",V?"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:sa.map(K=>jsx("div",{className:m("py-2 text-center text-xs font-medium uppercase",V?"text-[#9CA3AF]":"text-gray-500"),children:K},K))}),jsx("div",{className:m("grid grid-cols-7 auto-rows-min gap-px rounded-lg",V?"bg-[#2D2D2D]":"bg-gray-300"),children:je.map((K,ke)=>{let at=K.date.getDay()===0||K.date.getDay()===6;return jsxs("div",{className:m("min-h-[120px] p-2 transition-colors flex flex-col relative group",V?at?"bg-[#1C1F26]":K.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":at?"bg-gray-100":K.isCurrentMonth?"bg-white":"bg-gray-50",K.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Ne=B[ke]||me,Ie=K.events.slice(0,Ne),Y=K.events.length-Ne;return jsxs("div",{className:"space-y-1 flex-1",children:[Ie.map(Ke=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{ye(Ke.task),a.onEventClick?.(Ke),g?.(Ke.task.id);},whileHover:{scale:1.02},className:m("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Ke.task.progress===100?V?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":V?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(wp,{task:Ke.task}),jsx("span",{className:"truncate",children:Ke.title})]})},Ke.id)),Y>0&&jsxs("button",{onClick:Ke=>{Ke.stopPropagation(),X$1($=>({...$,[ke]:Ne+fe}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",V?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",Y," ",L==="es"?"M\xC1S":"MORE"]}),Ne>me&&K.events.length>me&&jsx("button",{onClick:Ke=>{Ke.stopPropagation(),X$1($=>({...$,[ke]:me}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",V?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:L==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Ne=ke>=28,Ie=ke%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),Ge===ke?be(null):(be(ke),re(""),q(void 0),De(null),ae(null),Se(false),We(false),j(false),Te(K.date));},className:m("w-5 h-5 rounded flex items-center justify-center transition-all",Ge===ke?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",V?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:m("w-3.5 h-3.5 transition-transform",Ge===ke&&"rotate-45")})}),jsx(AnimatePresence,{children:Ge===ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{be(null),re(""),q(void 0),De(null),ae(null),Se(false),We(false),j(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Ne?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ne?-5:5,scale:.95},transition:{duration:.12},className:m("absolute w-[320px] rounded-lg shadow-2xl z-50",Ne?"bottom-full mb-1":"top-full mt-1",Ie?"right-0":"left-0",V?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>{Y.stopPropagation(),Se(false),We(false),j(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:Ve,onChange:Y=>re(Y.target.value),placeholder:L==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:m("w-full bg-transparent text-sm outline-none placeholder:opacity-40",V?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:Y=>{if(Y.key==="Enter"&&Ve.trim()){let Ke=t.availableUsers?.find(de=>de.id===ge),$=Qe||K.date;a.onTaskCreate?.({name:Ve.trim(),startDate:$,endDate:$,priority:_,assignees:Ke?[Ke]:void 0}),re(""),q(void 0),De(null),ae(null),be(null);}Y.key==="Escape"&&(be(null),re(""),q(void 0),De(null),ae(null));}})}),jsxs("div",{className:m("px-2.5 py-2 flex items-center justify-between border-t",V?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),Se(!qe),We(false);},className:m("p-1 rounded transition-colors",_?_==="urgent"||_==="high"?"text-red-400 bg-red-500/20":_==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":V?"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:qe&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",V?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[{id:"urgent",label:L==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:L==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:L==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:L==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:L==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(Y=>jsxs("button",{onClick:()=>{q(Y.id),Se(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",V?"hover:bg-white/5":"hover:bg-gray-50",_===Y.id&&(V?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",Y.color)}),jsx("span",{className:V?"text-white":"text-gray-900",children:Y.label})]},Y.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:Y=>{Y.stopPropagation(),j(!I),Se(false),We(false),Te(Qe||K.date);},className:m("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Qe?"bg-[#7C3AED]/20 text-[#7C3AED]":V?"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"}),(Qe||K.date).toLocaleDateString(L==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:I&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",V?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsx("div",{className:m("w-40 py-2 border-r",V?"border-white/10":"border-gray-200"),children:(()=>{let Y=new Date,Ke=new Date(Y);Ke.setDate(Y.getDate()+1);let $=new Date(Y);$.setDate(Y.getDate()+((6-Y.getDay()+7)%7||7));let de=new Date(Y);de.setDate(Y.getDate()+((1-Y.getDay()+7)%7||7));let Be=new Date(Y);Be.setDate(Y.getDate()+14);let Ze=new Date(Y);return Ze.setDate(Y.getDate()+28),[{label:L==="es"?"Hoy":"Today",date:Y,display:Y.toLocaleDateString(L==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:L==="es"?"Ma\xF1ana":"Tomorrow",date:Ke,display:Ke.toLocaleDateString(L==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:L==="es"?"Este fin de semana":"This weekend",date:$,display:L==="es"?"s\xE1b.":"sat."},{label:L==="es"?"Pr\xF3xima semana":"Next week",date:de,display:L==="es"?"lun.":"mon."},{label:L==="es"?"2 semanas":"2 weeks",date:Be,display:Be.toLocaleDateString(L==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:L==="es"?"4 semanas":"4 weeks",date:Ze,display:Ze.toLocaleDateString(L==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ue,ve)=>jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",V?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{ae(Ue.date),j(false);},children:[jsx("span",{children:Ue.label}),jsx("span",{className:m("text-[10px]",V?"text-[#6B7280]":"text-gray-400"),children:Ue.display})]},ve))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:m("text-xs font-medium",V?"text-white":"text-gray-900"),children:le.toLocaleDateString(L==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>Te(new Date),className:m("px-1.5 py-0.5 rounded text-[10px] transition-colors",V?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:L==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Te(new Date(le.getFullYear(),le.getMonth()-1)),className:m("p-0.5 rounded",V?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>Te(new Date(le.getFullYear(),le.getMonth()+1)),className:m("p-0.5 rounded",V?"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:(L==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(Y=>jsx("div",{className:m("w-6 h-6 flex items-center justify-center text-[10px]",V?"text-[#6B7280]":"text-gray-400"),children:Y},Y))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Y=le.getFullYear(),Ke=le.getMonth(),$=new Date(Y,Ke,1).getDay(),de=new Date(Y,Ke+1,0).getDate(),Be=new Date(Y,Ke,0).getDate(),Ze=new Date,et=[];for(let ve=$-1;ve>=0;ve--)et.push({dayNum:Be-ve,isCurrentMonth:false,date:new Date(Y,Ke-1,Be-ve)});for(let ve=1;ve<=de;ve++)et.push({dayNum:ve,isCurrentMonth:true,date:new Date(Y,Ke,ve)});let Ue=42-et.length;for(let ve=1;ve<=Ue;ve++)et.push({dayNum:ve,isCurrentMonth:false,date:new Date(Y,Ke+1,ve)});return et.map((ve,$e)=>{let U=ve.date.toDateString()===Ze.toDateString(),ce=(Qe||K.date).toDateString()===ve.date.toDateString();return jsx("button",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!ve.isCurrentMonth&&(V?"text-[#4B5563]":"text-gray-300"),ve.isCurrentMonth&&(V?"text-white":"text-gray-900"),U&&"ring-1 ring-[#3B82F6]",ce&&"bg-[#7C3AED] text-white",!ce&&(V?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{ae(ve.date),j(false);},children:ve.dayNum},$e)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:Y=>{Y.stopPropagation(),We(!ot),Se(false);},className:m("p-1 rounded transition-colors",ge?"text-[#7C3AED] bg-[#7C3AED]/20":V?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:ge?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(Y=>Y.id===ge)?.color||"#7C3AED"},children:t.availableUsers?.find(Y=>Y.id===ge)?.initials||t.availableUsers?.find(Y=>Y.id===ge)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:ot&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",V?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:Y=>Y.stopPropagation(),children:[jsxs("button",{onClick:()=>{De(null),We(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",V?"hover:bg-white/5":"hover:bg-gray-50",!ge&&(V?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("w-5 h-5 rounded-full flex items-center justify-center",V?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:V?"text-[#9CA3AF]":"text-gray-500",children:L==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(Y=>jsxs("button",{onClick:()=>{De(Y.id),We(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",V?"hover:bg-white/5":"hover:bg-gray-50",ge===Y.id&&(V?"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:Y.color||"#7C3AED"},children:Y.initials||Y.name?.slice(0,2).toUpperCase()}),jsx("span",{className:V?"text-white":"text-gray-900",children:Y.name})]},Y.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:m("px-3 py-2 text-xs",V?"text-[#6B7280]":"text-gray-400"),children:L==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(Ve.trim()){let Y=t.availableUsers?.find($=>$.id===ge),Ke=Qe||K.date;a.onTaskCreate?.({name:Ve.trim(),startDate:Ke,endDate:Ke,priority:_,assignees:Y?[Y]:void 0}),re(""),q(void 0),De(null),ae(null),be(null);}},disabled:!Ve.trim(),className:m("px-2.5 py-1 rounded text-xs font-medium transition-colors",Ve.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":V?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:L==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:m("text-sm font-medium",K.isToday?"text-[#3B82F6]":K.isCurrentMonth?V?"text-white":"text-gray-900":V?"text-[#6B7280]":"text-gray-400"),children:K.date.getDate()})]})]},ke)})})]})}),jsx(Ir,{task:F,isOpen:!!F,onClose:()=>ye(null),onTaskUpdate:K=>{a.onTaskUpdate?.(K),ye(K);},theme:H==="dark"?"dark":"light",locale:L,availableUsers:t.availableUsers?.map(K=>({id:K.id,name:K.name,avatar:K.avatar,initials:K.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:u,onCreateTag:i,attachments:F?c?.get(F.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:kp(e).filter(K=>K.id!==F?.id),comments:d?.filter(K=>K.taskId===F?.id).map(K=>({...K,createdAt:K.createdAt instanceof Date?K.createdAt:new Date(K.createdAt),updatedAt:K.updatedAt instanceof Date?K.updatedAt:K.updatedAt?new Date(K.updatedAt):void 0})),onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:k,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:N,onSoldEffortUpdate:C,onTimerStart:w,onTimerStop:R,onTimerDiscard:A,blurFinancials:T}),jsx(AnimatePresence,{children:Q&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>te(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:m("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",V?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between",V?"border-white/10":"border-gray-200"),children:[jsx("span",{className:m("font-medium",V?"text-white":"text-gray-900"),children:Q.date.toLocaleDateString(L==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>te(null),className:m("p-1 rounded",V?"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:Q.events.map(K=>jsxs("button",{onClick:()=>{te(null),ye(K.task),g?.(K.task.id);},className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",V?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(wp,{task:K.task}),jsx("span",{className:m("text-sm truncate flex-1",V?"text-white":"text-gray-900"),children:K.title}),K.task.priority==="high"||K.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},K.id))})]})]})})]})}var ad={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"},rd={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"},od={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"},Ks={dark:ad,light:rd,neutral:od};function Np(e){return Ks[e]||Ks.dark}function Jx({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[u,i]=useState(false),c=useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=useMemo(()=>{let f=c.length,v=new Set(c.flatMap(y=>y.assignedUserIds||[])).size,k=c.map(y=>y.priority).filter(Boolean),g=new Set(c.flatMap(y=>y.labels||[])).size;return {totalCards:f,uniqueAssignees:v,priorities:k,labels:g}},[c]),p=()=>{o?.(e.id);};return jsxs("div",{className:m("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,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:m("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"]})]}),u&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:f=>{f.stopPropagation(),n?.(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:c.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:c.map(f=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsx("h4",{children:f.title}),f.description&&jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Sp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Bn(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 Rn(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 Ep(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 Pp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let u=useMemo(()=>({...Sp,...n}),[n]),[i,c]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let x=b.timestamp.toISOString().split("T")[0],D=h.get(x);D?D.push(b):h.set(x,[b]);}),Array.from(h.entries()).sort((b,x)=>x[0].localeCompare(b[0])).map(([b,x])=>({date:new Date(b),events:x.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:f,uniqueTypes:v}=useMemo(()=>{let h=new Set,b=new Set;return e.forEach(x=>{h.add(x.userId),b.add(x.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),k=h=>{c(b=>{let x=new Set(b);return x.has(h)?x.delete(h):x.add(h),x});},g=h=>{let x=new Date().getTime()-h.getTime(),D=Math.floor(x/6e4),N=Math.floor(x/36e5),C=Math.floor(x/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:C<7?`${C}d ago`:h.toLocaleDateString()},y=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:m("history-timeline-empty",l),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:m("history-timeline",u.compact&&"compact",l),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:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxs("option",{value:h,children:[Rn(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),f.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),y>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((b,x)=>{let D=i.has(b.id),N=s===b.id,C=Ep(b.type);return jsxs("div",{"data-event-id":b.id,className:m("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(b),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:C},children:u.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Rn(b.type)})}),x<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:C}})]}),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:[u.showAvatars&&b.userAvatar&&jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsx("span",{className:"history-timeline-event-action",children:Bn(b)})]})]}),jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),k(b.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([w,R])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},w)),b.metadata&&Object.keys(b.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(b.metadata).map(([w,R])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},w))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function Fp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:u,className:i}){let c=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:m("history-replay-empty",i),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:m("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&Rn(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Bn(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:f=>l(parseInt(f.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((f,v)=>jsx("div",{className:m("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>l(v),title:Bn(f)},f.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:n,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:c.map(f=>jsxs("button",{className:m("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>u(f),children:[f,"x"]},f))})]}),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(f=>jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxs("div",{className:m("history-replay-start",i),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 nd(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 sd(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 Ap(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 Lp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function r2(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(c=>{let d=a/2,p=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(f=>{if(c.id===f.id)return;let v=c.x-f.x,k=c.y-f.y,g=Math.sqrt(v*v+k*k)||1,y=o.chargeStrength*i/(g*g);c.vx+=v/g*y,c.vy+=k/g*y;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),p=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!p)return;let f=p.x-d.x,v=p.y-d.y,k=Math.sqrt(f*f+v*v)||1,g=(k-o.linkDistance)/k*o.forceStrength*i;d.vx+=f*g,d.vy+=v*g,p.vx-=f*g,p.vy-=v*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Ip({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:u}){let i=useRef(null),[c,d]=useState([]),[p,f]=useState(null),[v,k]=useState(null),[g,y]=useState(null),[h,b]=useState(1),[x,D]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let L=r2(e,t,a.width,a.height,a,150);d(L);},[e,t,a]);let N=useCallback((L,ne)=>{a.enableDragging&&(ne.stopPropagation(),f(L));},[a.enableDragging]),C=useCallback(L=>{if(!p||!i.current)return;let S=i.current.getBoundingClientRect(),V=(L.clientX-S.left-x.x)/h,ie=(L.clientY-S.top-x.y)/h;d(Me=>Me.map(F=>F.id===p?{...F,x:V,y:ie,fx:V,fy:ie}:F));},[p,h,x]),w=useCallback(()=>{f(null);},[]),R=useCallback((L,ne)=>{ne.stopPropagation(),l?.({type:"node-click",node:L,position:{x:ne.clientX,y:ne.clientY}});},[l]),A=useCallback((L,ne)=>{ne.stopPropagation(),l?.({type:"edge-click",edge:L,position:{x:ne.clientX,y:ne.clientY}});},[l]),T=useCallback(L=>{let ne=c.find(S=>S.id===L);return ne?{x:ne.x,y:ne.y}:{x:0,y:0}},[c]),H=useCallback(L=>{if(L.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return L.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let ne=L.card.priority;return ne==="URGENT"?"#ef4444":ne==="HIGH"?"#f59e0b":ne==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return L.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:m("relationships-graph-empty",u),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:m("relationships-graph",u),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:n.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:n.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:()=>b(L=>Math.min(L+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(L=>Math.max(L-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),D({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:nd(L)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Ap(L)," ",sd(L)]})]},L))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:C,onMouseUp:w,onMouseLeave:w,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(L=>{let ne=T(typeof L.source=="string"?L.source:L.source.id),S=T(typeof L.target=="string"?L.target:L.target.id),V=Lp(L.type),ie=g===L.id,Me=L.onCriticalPath;return jsxs("g",{className:m("relationships-graph-edge",ie&&"hovered",Me&&"critical"),onMouseEnter:()=>y(L.id),onMouseLeave:()=>y(null),onClick:F=>A(L,F),children:[jsx("line",{x1:ne.x,y1:ne.y,x2:S.x,y2:S.y,stroke:nd(L.type),strokeWidth:Me?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ie?1:.6,markerEnd:V?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ie&&jsx("text",{x:(ne.x+S.x)/2,y:(ne.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:sd(L.type)})]},L.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(L=>{let ne=v===L.id,S=L.onCriticalPath;return jsxs("g",{className:m("relationships-graph-node",ne&&"hovered",S&&"critical"),transform:`translate(${L.x}, ${L.y})`,onMouseDown:V=>N(L.id,V),onMouseEnter:()=>k(L.id),onMouseLeave:()=>k(null),onClick:V=>R(L,V),children:[jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:H(L),stroke:S?"#fbbf24":"#ffffff",strokeWidth:S?3:2,opacity:ne?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 Op({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[l,u]=useState(false),[i,c]=useState(null),[d,p]=useState(null),f=useRef(null),v=l||o;useEffect(()=>{e&&f.current&&f.current.focus();},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&!v&&k();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let k=()=>{v||(n(""),c(null),p(null),t());},g=async()=>{if(!(!s.trim()||v)){u(true),c(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{u(false);}}},y=()=>{d&&(a(d),k());};return e?jsxs(kt,{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-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:h=>h.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:k,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((h,b)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),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((h,b)=>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:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),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:f,value:s,onChange:h=>n(h.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."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),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((h,b)=>jsx("button",{onClick:()=>n(h),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:h},b))})]})]})}),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:k,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:y,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:g,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 id={"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 n2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},s2={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 i2(e,t,a){let r=id[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function On(e){return `$${e.toFixed(4)}`}var ld=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=i2(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,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),u=a.reduce((d,p)=>d+p.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?u/r:0,successRate:r>0?l.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,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(c=>c.timestamp>=n).length,u=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:u,percentUsed:i,isExceeded:l>=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)}},So=new ld;function Up({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(So.getStats()),[s,n]=useState(So.checkLimit(a));if(useEffect(()=>{if(!e)return;let u=setInterval(()=>{o(So.getStats()),n(So.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let l=So.getRecentOperations(5);return jsxs(kt,{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:u=>u.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:On(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(([u,i])=>{let c=r.costsByFeature[u]||0,d=r.totalOperations>0?i/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:u.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:On(c)})]})]}),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}%`}})})]},u)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:On(u.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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 Gp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[u,i]=useState(""),[c,d]=useState(""),[p,f]=useState(false),[v,k]=useState(null),[g,y]=useState(null),[h,b]=useState(null),x=useRef(null),D=p||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let A=T=>{T.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[e,D]);let N=()=>{D||(l(""),i(""),d(""),k(null),y(null),b(null),t());},C=async()=>{if(!(!n.trim()||D)){f(true),k(null),y(null),b(null);try{let A=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:c||void 0});y(A.tasks.tasks),b({from_cache:A.from_cache,tokens_used:A.tokens_used,mock_mode:A.mock_mode,similarity:A.similarity,tokens_saved:A.tokens_saved});}catch(A){k(A instanceof Error?A.message:"Failed to generate tasks");}finally{f(false);}}},w=()=>{g&&(a(g),N());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(kt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),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:A=>A.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:N,disabled:D,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:g?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:[h?.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"}),h?.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 (",R,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.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:[g.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((A,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:["#",T+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:A.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"})]}),A.start," \u2192 ",A.end]}),jsxs("span",{children:[A.duration," days"]}),A.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",A.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${A.priority==="high"?"bg-red-500/20 text-red-400":A.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:A.priority})]})},A.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:x,value:n,onChange:A=>l(A.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:D}),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:u,onChange:A=>i(A.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:D})]}),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:c,onChange:A=>d(A.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:D})]})]}),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((A,T)=>jsx("button",{onClick:()=>l(A),disabled:D,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:A},T))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:D&&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:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsx("button",{onClick:w,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:C,disabled:!n.trim()||D,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:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Xs({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(g=>{t&&jn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=useCallback(async(g,y,h)=>{r(b=>{let x=b.cards.find(A=>A.id===g);if(!x)return b;let D=x.columnId,N={...x,columnId:y,position:h},C=b.cards.map(A=>A.id===g?N:A),w=b.columns.map(A=>{if(A.id===D)return {...A,cardIds:A.cardIds.filter(T=>T!==g)};if(A.id===y){let T=C.filter(H=>H.columnId===y).sort((H,L)=>H.position-L.position);return {...A,cardIds:T.map(H=>H.id)}}return A}),R={...b,cards:C,columns:w};return o(R),R});},[o]),n=useCallback(async(g,y)=>{r(h=>{let b=h.cards.map(D=>D.id===g?{...D,...y}:D),x={...h,cards:b};return o(x),x});},[o]),l=useCallback(async g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y},x=h.columns.map(N=>N.id===g.columnId?{...N,cardIds:[...N.cardIds,y]}:N),D={...h,cards:[...h.cards,b],columns:x};return o(D),D});},[o]),u=useCallback(async g=>{r(y=>{let h=y.cards.find(N=>N.id===g);if(!h)return y;let b=y.cards.filter(N=>N.id!==g),x=y.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(C=>C!==g)}:N),D={...y,cards:b,columns:x};return o(D),D});},[o]),i=useCallback(async g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y,cardIds:[]},x={...h,columns:[...h.columns,b]};return o(x),x});},[o]),c=useCallback(async(g,y)=>{r(h=>{let b=h.columns.map(D=>D.id===g?{...D,...y}:D),x={...h,columns:b};return o(x),x});},[o]),d=useCallback(async g=>{r(y=>{let h=y.cards.filter(D=>D.columnId!==g),b=y.columns.filter(D=>D.id!==g),x={...y,cards:h,columns:b};return o(x),x});},[o]),p=useCallback(g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),y},[l]),f=useCallback(g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),y},[i]),v=useCallback(()=>{r(g=>{let y={...g,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:u,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:f,deleteCard:u,deleteColumn:d,clearBoard:v}}}function _p({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Xs({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(u,i,c={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(d=>d.columnId===u).length,...c});},addColumn:(u,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:u,position:i??c+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:n}}var $n={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Kp={by:"none",order:"asc"};function Yp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...$n,...e}),[s,n]=useState({...Kp,...t}),l=useCallback(k=>{o(g=>({...g,...k}));},[]),u=useCallback(k=>{n(g=>({...g,...k}));},[]),i=useCallback(()=>{o($n),n(Kp);},[]),c=useCallback(()=>{a&&o({...$n,assignees:[a]});},[a]),d=useCallback(()=>{o({...$n,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...$n,priorities:["HIGH","URGENT"]});},[]),f=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(k=>{let g=[...k];if(r.search){let y=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),x=String(y.getDate()).padStart(2,"0"),D=`${h}-${b}-${x}`;g=g.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let C=N.endDate||N.dueDate;if(!C)return false;let w;if(typeof C=="string")w=C.split("T")[0]||C;else {let R=C.getUTCFullYear(),A=String(C.getUTCMonth()+1).padStart(2,"0"),T=String(C.getUTCDate()).padStart(2,"0");w=`${R}-${A}-${T}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let R=new Date(D+"T00:00:00"),A=new Date(w+"T00:00:00"),T=new Date(R);return T.setDate(T.getDate()+7),A>=R&&A<=T;case "custom":if(r.dateRange){let H=typeof C=="string"?new Date(C):C;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(g=g.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&g.sort((y,h)=>{let b=0;switch(s.by){case "created":let x=y.createdAt?new Date(y.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;b=x-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},C=N[y.priority||"LOW"],w=N[h.priority||"LOW"];b=C-w;break;case "dueDate":let R=y.endDate||y.dueDate,A=h.endDate||h.dueDate;if(!R)return 1;if(!A)return -1;let T=typeof R=="string"?new Date(R).getTime():R.getTime(),H=typeof A=="string"?new Date(A).getTime():A.getTime();b=T-H;break;case "title":b=y.title.localeCompare(h.title);break;case "estimate":let L=y.estimatedTime||0,ne=h.estimatedTime||0;b=L-ne;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:u,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:p,applyFilters:v,hasActiveFilters:f}}var Xp,Jp;if(typeof window<"u")try{let e=Gn("ai");Xp=e.generateObject,Jp=e.generateText;}catch{}function Zp(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(Xp&&Jp&&e.apiKey),n=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(p){let f=p instanceof Error?p:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),l=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(p){let f=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(f),f}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("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(p){let f=p instanceof Error?p:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=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(p){let f=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),c=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(p){let f=p instanceof Error?p:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function cd(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Qp(e){let{cards:t}=e,[a,r]=cd(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=p.ctrlKey||p.metaKey,v=p.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let k=t.find(y=>y.id===d),g=t.find(y=>y.id===a.lastSelectedCardId);if(k&&g&&k.columnId===g.columnId){let y=t.filter(w=>w.columnId===k.columnId).sort((w,R)=>w.position-R.position),h=y.findIndex(w=>w.id===a.lastSelectedCardId),b=y.findIndex(w=>w.id===d),[x,D]=h<b?[h,b]:[b,h],N=y.slice(x,D+1).map(w=>w.id),C=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:C,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:u,toggleCard:i,getSelectedCards:c}}var eg={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function tg(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...eg,...a}),[a]),[s,n]=useState([]),l=useCallback((k,g,y,h,b)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:g,columnId:y,strategy:h,color:b,isExpanded:true,position:s.filter(D=>D.columnId===y).length,createdAt:new Date};n(D=>[...D,x]);},[o.minCardsPerStack,s]),u=useCallback(k=>{n(g=>g.filter(y=>y.id!==k));},[]),i=useCallback(k=>{n(g=>g.map(y=>y.id===k?{...y,isExpanded:!y.isExpanded}:y));},[]),c=useCallback((k,g)=>{n(y=>y.map(h=>h.id===k&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=useCallback((k,g)=>{n(y=>y.map(h=>{if(h.id===k){let b=h.cardIds.filter(x=>x!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=useCallback(k=>s.filter(g=>g.columnId===k).sort((g,y)=>g.position-y.position),[s]),f=useCallback(async k=>{let g=t.filter(D=>D.columnId===k);if(g.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;g.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(D);});}),h.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(C=>C.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let b=new Map;g.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(D);});}),b.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(C=>C.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(g.forEach(D=>{D.priority&&(x.has(D.priority)||x.set(D.priority,[]),x.get(D.priority).push(D));}),x.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let C={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";y.push({stack:{title:`${C} ${N} Priority`,cardIds:D.map(w=>w.id),columnId:k,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of g){let C=(await r.findSimilar(D,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(C.length>=o.minCardsPerStack-1){let w=[D.id,...C.map(A=>A.card.id)],R=C.reduce((A,T)=>A+T.similarity,0)/C.length;y.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${C.length+1} similar tasks`,confidence:R});}}return y.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),v=useCallback(k=>{l(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let y=await f(g),h=y[0];y.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:l,deleteStack:u,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:p,getSuggestions:f,applySuggestion:v,config:o}}var ag=createContext(null);function rg({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(u=>{let{Column:i}=Gn("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=Gn("@libxai/core");n.set(u.id,new i(u));});let l=null;if(t?.board){let{Board:u}=Gn("@libxai/core");l=new u(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(ag.Provider,{value:{store:o},children:e})}function Js(){let e=useContext(ag);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Un(){let e=Js(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(h=>{e.updateBoard(h);},[e]),u=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,b)=>{e.updateColumn(h,b);},[e]),c=useCallback(h=>{e.deleteColumn(h);},[e]),d=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),f=useCallback((h,b)=>{e.updateCard(h,b);},[e]),v=useCallback(h=>{e.deleteCard(h);},[e]),k=useCallback((h,b,x)=>{e.moveCard(h,b,x);},[e]),g=useCallback(h=>e.getCard(h),[e]),y=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:u,updateColumn:i,deleteColumn:c,getColumn:d,addCard:p,updateCard:f,deleteCard:v,moveCard:k,getCard:g,getCardsByColumn:y}}function ng(e){let{cards:t}=Un();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 sg(e="position",t="asc"){let{cards:a}=Un();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=u-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var Zs=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Gd.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 n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{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(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},T2=new Zs;function lg({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:u}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:o,children:jsx("div",{style:f,children:d.map(v=>{let k=e[v.index];if(!k)return null;let g=u?u(k,v.index):v.index,y={position:"absolute",top:n?0:v.start,left:n?v.start:0,width:n?v.size:"100%",height:n?"100%":v.size};return jsx("div",{style:y,"data-index":v.index,children:r(k,v.index)},g)})})})}function dg(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 ug({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:u,horizontal:i=true}){let c=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),f={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:c,style:f,className:s,children:jsx("div",{style:v,children:p.map(k=>{let g=e[k.index];if(!g)return null;let y=u?u(g,k.index):k.index,h={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsx("div",{style:h,"data-index":k.index,children:o(g,k.index)},y)})})})}function mg(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 pg(e,t=10){return e>t}var gd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},fd={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},hd={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},bd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},yd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},vd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},xd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},kd={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)"},wd={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)"},Cd={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Td={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}},Nd={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}},Qs={spacing:gd,borderRadius:fd,fontSize:hd,fontWeight:bd,lineHeight:yd,zIndex:vd,duration:xd,easing:kd,shadows:wd,opacity:Cd,kanban:Td,gantt:Nd};function gg(e,t,a){return e[t]??a}function Dd(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)?Dd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function S2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Sd(e="asakaa"){let t=Dd(Qs),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=S2(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
403
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function sm(e){let t=[],a=r=>{for(let o of r)t.push(o),o.subtasks?.length&&a(o.subtasks);};return a(e),t}function Hr(e,t){let a=sm(e),r=t.toLowerCase().trim(),o=a.find(l=>l.name.toLowerCase()===r);if(o)return o;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let n=r.split(/\s+/);return a.find(l=>{let u=l.name.toLowerCase();return n.every(i=>u.includes(i))})}function Fl(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 p=new Date(r);return p.setDate(p.getDate()+1),p}if(a==="yesterday"||a==="ayer"){let p=new Date(r);return p.setDate(p.getDate()-1),p}if(a==="next week"||a==="la pr\xF3xima semana"){let p=new Date(r);return p.setDate(p.getDate()+7),p}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 f={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(f!==void 0){let v=new Date(r),k=v.getDay(),g=f-k;return g<=0&&(g+=7),v.setDate(v.getDate()+g),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 p=parseInt(s[1],10),f=s[2].toLowerCase(),v=new Date(r);return f==="day"||f==="d\xEDa"||f==="dias"?v.setDate(v.getDate()+p):f==="week"||f==="semana"||f==="semanas"?v.setDate(v.getDate()+p*7):(f==="month"||f==="mes"||f==="meses")&&v.setMonth(v.getMonth()+p),v}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let l=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(l&&l[1]&&l[2]&&l[3]){let p=parseInt(l[1],10),f=parseInt(l[2],10)-1,v=parseInt(l[3],10);return new Date(v,f,p)}let u={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},i=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(i&&i[1]&&i[2]){let p=parseInt(i[1],10),f=u[i[2].toLowerCase()],v=i[3]?parseInt(i[3],10):r.getFullYear();if(f!==void 0)return new Date(v,f,p)}let c={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 p=c[d[1].toLowerCase()],f=parseInt(d[2],10),v=d[3]?parseInt(d[3],10):r.getFullYear();if(p!==void 0)return new Date(v,p,f)}return null}function Al(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 Ll(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 im(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 lm(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 i=r[1].trim(),c=r[2].trim(),d=Hr(t,i),p=Fl(c);if(!d)return {type:"move_task",taskName:i,message:`Could not find a task named "${i}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!p)return {type:"move_task",taskId:d.id,taskName:d.name,message:`Could not parse the date "${c}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let f=d.startDate&&d.endDate?Math.round((d.endDate.getTime()-d.startDate.getTime())/(1e3*60*60*24)):1,v=new Date(p);return v.setDate(v.getDate()+f),{type:"move_task",taskId:d.id,taskName:d.name,updates:{startDate:p,endDate:v},message:`Moved "${d.name}" to ${p.toLocaleDateString()}.`,success:true}}let o=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),c=o[2].trim(),d=Hr(t,i),p=Al(c);if(!d)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!d.endDate)return {type:"resize_task",taskId:d.id,taskName:d.name,message:`Could not parse the duration "${c}".`,success:false,error:"Invalid duration"};let f=new Date(d.endDate);return f.setDate(f.getDate()+p),{type:"resize_task",taskId:d.id,taskName:d.name,updates:{endDate:f},message:`Extended "${d.name}" by ${p} days. New end date: ${f.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 i=s[1].trim(),c=s[2].trim(),d=Hr(t,i),p=Ll(c);return d?p===null?{type:"set_progress",taskId:d.id,taskName:d.name,message:`Could not parse the progress value "${c}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:d.id,taskName:d.name,updates:{progress:p},message:`Set "${d.name}" progress to ${p}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let n=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),c=n[2].trim(),d=Hr(t,i);return d?{type:"rename_task",taskId:d.id,taskName:d.name,updates:{name:c},message:`Renamed "${d.name}" to "${c}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let l=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]&&l[2]){let i=l[1].trim(),c=l[2].trim(),d=Hr(t,i),p=Hr(t,c);return d?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:d.id,dependencyTo:p.id,message:`Linked "${d.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:c,message:`Could not find a task named "${c}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let u=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(u&&u[1]){let i=u[1].trim(),c=Hr(t,i);return c?{type:"delete_task",taskId:c.id,taskName:c.name,message:`Deleted "${c.name}".`,success:true}:{type:"delete_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}return null}function dm(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 ev(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 tv(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Rs(e,t=[],a=[]){let r=e.assignedUserIds?.map(c=>{let d=a.find(p=>p.id===c);return d?{name:d.name,initials:d.initials,color:d.color}:null}).filter(c=>c!==null),o=t.filter(c=>c.metadata?.parentCardId===e.id).map(c=>Rs(c,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(c=>c.type==="finish-to-start").map(c=>c.taskId));let n=c=>{if(c)return typeof c=="string"?new Date(c):c},l=n(e.startDate),u=n(e.endDate),i=e.metadata?.isMilestone===true||l&&u&&Math.abs(u.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:u,progress:e.progress||0,status:ev(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:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function cm(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:tv(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function um(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Rs(r,e,t))}var Il={columns:{name:"Task Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",tags:"Tags"},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"}},Bl={columns:{name:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",tags:"Etiquetas"},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"}},Os={en:Il,es:Bl};function Rl(e){return Os[e]||Os.en}function $s(e,t){let a=Rl(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}var Ol=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-blue-500"},{value:"completed",icon:CheckCircle2,color:"text-green-500"}];function mm(e){let t=e?.toLowerCase()||"todo";return t==="inprogress"||t==="in-progress"||t==="in_progress"?"in-progress":t==="completed"||t==="done"||t==="complete"?"completed":"todo"}function pm({value:e,onChange:t,isDark:a,translations:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let f=v=>{l.current&&!l.current.contains(v.target)&&n(false);};return s&&document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[s]);let u=mm(e),i=Ol[0],c=Ol.find(f=>f.value===u)??i,d=c.icon,p=f=>{switch(mm(f)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(d,{className:m("w-4 h-4 flex-shrink-0",c.color)}),jsx("span",{className:m("text-sm whitespace-nowrap",a?"text-[#94A3B8]":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:Ol.map(f=>{let v=f.icon;return jsxs("button",{onClick:k=>{k.stopPropagation(),t(f.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",u===f.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx(v,{className:m("w-4 h-4",f.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(f.value)})]},f.value)})})]})}var $l=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-red-500",bg:"bg-red-500"},{value:"high",label:{en:"High",es:"Alta"},color:"text-orange-500",bg:"bg-orange-500"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-yellow-500",bg:"bg-yellow-500"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-blue-500",bg:"bg-blue-500"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function fm({value:e="none",onChange:t,isDark:a,locale:r,disabled:o=false}){let[s,n]=useState(false),l=useRef(null);useEffect(()=>{let c=d=>{l.current&&!l.current.contains(d.target)&&n(false);};return s&&document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[s]);let u=$l.find(c=>c.value===e)??$l[4],i=r==="es"?"es":"en";return o||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:m("w-4 h-4",u.color)}),jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:c=>{c.stopPropagation(),n(!s);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Flag,{className:m("w-4 h-4",u.color)}),jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500"),children:u.label[i]}),jsx(ChevronDown,{className:m("w-3 h-3",a?"text-[#6B7280]":"text-gray-400")})]}),s&&jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:$l.map(c=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(c.value),n(false);},className:m("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",e===c.value&&(a?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("w-2 h-2 rounded-full",c.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:c.label[i]})]},c.value))})]})}function Hs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Ws(e){let t=["bg-blue-500","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-teal-500"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-blue-500"}function xv(e,t){if(!e)return null;let a=Math.round(e.assignedHoursThisWeek/e.weeklyCapacity*100);switch(e.level){case "light":return {color:t?"text-green-400 bg-green-500/20":"text-green-600 bg-green-100",icon:null,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "moderate":return {color:t?"text-yellow-400 bg-yellow-500/20":"text-yellow-600 bg-yellow-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "heavy":return {color:t?"text-orange-400 bg-orange-500/20":"text-orange-600 bg-orange-100",icon:Clock,label:`${a}%`,tooltip:`${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`};case "overloaded":return {color:t?"text-red-400 bg-red-500/20":"text-red-600 bg-red-100",icon:AlertTriangle,label:`${a}%`,tooltip:`SOBRECARGADO: ${e.assignedHoursThisWeek}h / ${e.weeklyCapacity}h - ${e.activeTasks} tareas`}}}function ym({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:o,disabled:s=false,showWorkloadIndicators:n=true}){let[l,u]=useState(false),[i,c]=useState(""),d=useRef(null);useEffect(()=>{let g=y=>{d.current&&!d.current.contains(y.target)&&(u(false),c(""));};return l&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[l]);let p=t.filter(g=>g.name.toLowerCase().includes(i.toLowerCase())||g.email?.toLowerCase().includes(i.toLowerCase())),f=n?[...p].sort((g,y)=>{let h={light:0,moderate:1,heavy:2,overloaded:3},b=g.workload?.level??"light",x=y.workload?.level??"light";return h[b]-h[x]}):p,v=g=>e.some(y=>y.name===g),k=g=>{if(a)if(v(g.name))a(e.filter(y=>y.name!==g.name));else {let y={name:g.name,initials:Hs(g.name),color:g.color||Ws(g.name).replace("bg-","").replace("-500",""),avatar:g.avatarUrl};a([...e,y]);}};return s||!a?e.length===0?jsx("span",{className:m("text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((g,y)=>jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0F1117]":"border-white",!g.avatar&&Ws(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,title:g.name,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Hs(g.name)},`${g.name}-${y}`)),e.length>3&&jsxs("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#374151] border-[#0F1117] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:g=>{g.stopPropagation(),u(!l);},className:m("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:m("w-4 h-4",r?"text-[#6B7280]":"text-gray-400")}),jsx(Plus,{className:m("w-3 h-3",r?"text-[#6B7280]":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((g,y)=>jsx("div",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0F1117]":"border-white",!g.avatar&&Ws(g.name)),style:g.color&&!g.avatar?{backgroundColor:g.color}:void 0,children:g.avatar?jsx("img",{src:g.avatar,alt:g.name,className:"w-full h-full rounded-full object-cover"}):g.initials||Hs(g.name)},`${g.name}-${y}`)),e.length>2&&jsxs("span",{className:m("text-xs ml-1",r?"text-[#9CA3AF]":"text-gray-500"),children:["+",e.length-2]})]})}),l&&jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-lg shadow-lg border w-72",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:[n&&jsxs("div",{className:m("px-3 py-2 text-xs border-b flex items-center gap-3",r?"text-[#9CA3AF] border-white/10":"text-gray-500 border-gray-200"),children:[jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-green-500"}),o==="es"?"Ligera":"Light"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-yellow-500"}),o==="es"?"Moderada":"Moderate"]}),jsxs("span",{className:"flex items-center gap-1",children:[jsx("span",{className:"w-2 h-2 rounded-full bg-red-500"}),o==="es"?"Alta":"Heavy"]})]}),jsx("div",{className:"p-2 border-b",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:jsx("input",{type:"text",value:i,onChange:g=>c(g.target.value),placeholder:o==="es"?"Buscar usuario...":"Search user...",className:m("w-full px-3 py-1.5 text-sm rounded border outline-none",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),onClick:g=>g.stopPropagation()})}),jsx("div",{className:"max-h-48 overflow-y-auto py-1",children:f.length===0?jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"No se encontraron usuarios":"No users found"}):f.map(g=>{let y=xv(g.workload,r);return jsxs("button",{onClick:h=>{h.stopPropagation(),k(g);},className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",g.workload?.level==="overloaded"&&(r?"bg-red-500/5":"bg-red-50")),title:y?.tooltip,children:[jsx("div",{className:m("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white",!g.avatarUrl&&Ws(g.name)),children:g.avatarUrl?jsx("img",{src:g.avatarUrl,alt:g.name,className:"w-full h-full rounded-full object-cover"}):Hs(g.name)}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:r?"text-white":"text-gray-900",children:g.name}),g.email&&jsx("div",{className:m("text-xs",r?"text-[#6B7280]":"text-gray-400"),children:g.email})]}),n&&y&&jsxs("div",{className:m("flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",y.color),children:[y.icon&&jsx(y.icon,{className:"w-3 h-3"}),y.label]}),v(g.name)&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},g.id)})}),e.length>0&&jsx("div",{className:"p-2 border-t flex flex-wrap gap-1",style:{borderColor:r?"rgba(255,255,255,0.1)":"#E5E7EB"},children:e.map((g,y)=>jsxs("span",{className:m("inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full",r?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:[g.name,jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(b=>b.name!==g.name));},className:"hover:text-red-500",children:jsx(X,{className:"w-3 h-3"})})]},`${g.name}-${y}`))})]})]})}function km({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:o="end",isDark:s,locale:n,disabled:l=false,placeholder:u}){let[i,c]=useState(false),[d,p]=useState(o),[f,v]=useState(()=>{let C=o==="start"?e:t;if(C){let w=C instanceof Date?C:new Date(C);return new Date(w.getFullYear(),w.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),k=useRef(null),g=e?e instanceof Date?e:new Date(e):null,y=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let C=w=>{k.current&&!k.current.contains(w.target)&&c(false);};return i&&document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),useEffect(()=>{i&&p(r?o:"start");},[i,r,o]);let h=C=>C?C.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):u||"-",b=useCallback(()=>{let C=f.getFullYear(),w=f.getMonth(),R=new Date(C,w,1),T=new Date(C,w+1,0).getDate(),H=R.getDay(),A=[],S=new Date(C,w,0).getDate();for(let ie=H-1;ie>=0;ie--)A.push({date:new Date(C,w-1,S-ie),isCurrentMonth:false});for(let ie=1;ie<=T;ie++)A.push({date:new Date(C,w,ie),isCurrentMonth:true});let j=42-A.length;for(let ie=1;ie<=j;ie++)A.push({date:new Date(C,w+1,ie),isCurrentMonth:false});return A},[f]),x=C=>{if(r)o==="start"?a(C,y||void 0):a(g||void 0,C),c(false);else if(d==="start"){let w=y&&C>y?C:y;a(C,w||void 0),p("end");}else {let w=g&&C<g?C:g;a(w||void 0,C),c(false);}},D=()=>{let C=new Date,w=new Date(C);w.setDate(C.getDate()+1);let R=new Date(C);R.setDate(C.getDate()+((6-C.getDay()+7)%7||7));let F=new Date(C);F.setDate(C.getDate()+((1-C.getDay()+7)%7||7));let T=new Date(C);T.setDate(C.getDate()+(6-C.getDay()+7)%7+7);let H=new Date(C);H.setDate(C.getDate()+14);let A=new Date(C);return A.setDate(C.getDate()+28),[{label:n==="es"?"Hoy":"Today",date:C,display:C.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Ma\xF1ana":"Tomorrow",date:w,display:w.toLocaleDateString(n==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:n==="es"?"Este fin de semana":"This weekend",date:R,display:n==="es"?"s\xE1b.":"sat."},{label:n==="es"?"Pr\xF3xima semana":"Next week",date:F,display:n==="es"?"lun.":"mon."},{label:n==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:T,display:T.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"2 semanas":"2 weeks",date:H,display:H.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:n==="es"?"4 semanas":"4 weeks",date:A,display:A.toLocaleDateString(n==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let C=r&&o==="start"?g:y;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(C)})]})}let N=r&&o==="start"?g:y;return jsxs("div",{ref:k,className:"relative",children:[jsxs("button",{onClick:C=>{C.stopPropagation(),c(!i);let w=o==="start"?g:y;w&&v(new Date(w.getFullYear(),w.getMonth(),1));},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx(Calendar,{className:m("w-4 h-4",s?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm",s?"text-[#94A3B8]":"text-gray-500"),children:h(N)})]}),i&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>c(false)}),jsxs("div",{className:m("absolute z-50 top-full left-0 mt-1 rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:C=>C.stopPropagation(),children:[jsxs("div",{className:m("w-44 py-2 border-r",s?"border-white/10":"border-gray-200"),children:[D().map((C,w)=>jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>x(C.date),children:[jsx("span",{children:C.label}),jsx("span",{className:m("text-xs",s?"text-[#6B7280]":"text-gray-400"),children:C.display})]},w)),jsx("div",{className:m("border-t mt-2 pt-2",s?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?o==="start"?a(void 0,y||void 0):a(g||void 0,void 0):a(void 0,void 0),c(false);},className:m("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:n==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:m("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:d==="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:m("font-medium",s?"text-white":"text-gray-900"),children:f.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>v(new Date),className:m("p-1 rounded text-sm transition-colors",s?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:n==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()-1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>v(new Date(f.getFullYear(),f.getMonth()+1)),className:m("p-1 rounded",s?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:m("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),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(C=>jsx("div",{className:m("w-8 h-8 flex items-center justify-center text-xs",s?"text-[#6B7280]":"text-gray-400"),children:C},C))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:b().map((C,w)=>{let R=C.date.toDateString()===new Date().toDateString(),F=g?.toDateString()===C.date.toDateString(),T=y?.toDateString()===C.date.toDateString(),H=F||T,A=!r&&g&&y&&C.date>=g&&C.date<=y;return jsx("button",{onClick:()=>x(new Date(C.date)),className:m("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!C.isCurrentMonth&&(s?"text-[#4B5563]":"text-gray-300"),C.isCurrentMonth&&(s?"text-white":"text-gray-900"),R&&"ring-2 ring-[#3B82F6]",F&&"bg-[#3B82F6] text-white",T&&!F&&"bg-[#7C3AED] text-white",A&&!H&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!H&&(s?"hover:bg-white/10":"hover:bg-gray-100")),children:C.date.getDate()},w)})})]})]})]})]})}function Gs({value:e,onChange:t,isDark:a,locale:r,disabled:o=false,dateField:s="end",startDate:n,endDate:l}){let u=e?e instanceof Date?e:new Date(e):null;return jsx(km,{startDate:s==="start"?u:n||null,endDate:s==="end"?u:l||null,onChange:(p,f)=>{t&&t(s==="start"?p:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:o||!t,placeholder:"-"})}function tn(e=600){let[t,a]=useState(false),r=useRef(null),o=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:o}}function Vs(e,t={}){let{enabled:a=true,duration:r=400,steps:o=8}=t,[s,n]=useState(e),[l,u]=useState(false),i=useRef(e),c=useRef([]);return useEffect(()=>{if(c.current.forEach(clearTimeout),c.current=[],!a||e===i.current||e===void 0){n(e),i.current=e;return}let d=i.current??0,p=e,f=p-d,v=r/o;u(true);for(let k=1;k<=o;k++){let g=setTimeout(()=>{let y=k/o,h=1-Math.pow(1-y,3),b=Math.round(d+f*h);n(b),k===o&&(u(false),n(p));},v*k);c.current.push(g);}return i.current=e,()=>{c.current.forEach(clearTimeout),c.current=[];}},[e,a,r,o]),{displayValue:s,isAnimating:l}}function wm(e,t={}){let{delay:a=1500,onCancel:r}=t,[o,s]=useState(null),[n,l]=useState(0),u=useRef(null),i=useRef(null),c=useCallback(f=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(f),l(0);let v=Date.now();i.current=setInterval(()=>{let k=Date.now()-v,g=Math.min(k/a*100,100);l(g);},16),u.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(f),s(null),l(0);},a);},[a,e]),d=useCallback(()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{u.current&&clearTimeout(u.current),i.current&&clearInterval(i.current);},[]),{pendingValue:o,isPending:o!==null,progress:n,startChange:c,cancelChange:d}}function Nm({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:o=true,enableSaveFlash:s=true}){let{isFlashing:n,triggerFlash:l}=tn(),{displayValue:u,isAnimating:i}=Vs(e,{enabled:o,duration:300,steps:6}),c=p=>{if(r||!t)return;p.stopPropagation();let f=p.currentTarget.getBoundingClientRect(),v=p.clientX-f.left,k=Math.round(v/f.width*100),g=Math.max(0,Math.min(100,k));g!==e&&(t(g),s&&l());},d=u??e;return jsxs("div",{className:m("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-all duration-300",n&&(a?"bg-green-500/30":"bg-green-500/20")),children:[jsx("div",{onClick:c,className:m("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/10":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:m("h-full rounded-full transition-all",d===100?"bg-green-500":"bg-[#3B82F6]",i&&"transition-none"),style:{width:`${d}%`}})}),jsxs("span",{className:m("text-xs w-8 text-right tabular-nums transition-all",a?"text-[#9CA3AF]":"text-gray-500",i&&"font-medium scale-105"),children:[d,"%"]})]})}function Em({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:o=false}){let[s,n]=useState(false),[l,u]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{u(e);},[e]);let c=()=>{l!==e&&t?.(l),n(false);},d=p=>{p.key==="Enter"?c():p.key==="Escape"&&(u(e),n(false));};return o||!t?jsx("span",{className:m("text-sm truncate",a?"text-[#94A3B8]":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>u(p.target.value),onBlur:c,onKeyDown:d,onClick:p=>p.stopPropagation(),className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),n(true);},className:m("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-[#6B7280]":"text-gray-400")),children:e||r})}function Fm({value:e,onChange:t,isDark:a,placeholder:r="-",min:o,max:s,disabled:n=false,enableSlotMachine:l=true,enableSaveFlash:u=true}){let[i,c]=useState(false),[d,p]=useState(e?.toString()||""),f=useRef(null),{isFlashing:v,triggerFlash:k}=tn(),{displayValue:g,isAnimating:y}=Vs(e,{enabled:l&&!i});useEffect(()=>{i&&f.current&&(f.current.focus(),f.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let x=parseFloat(d);if(!isNaN(x)){let D=x;o!==void 0&&(D=Math.max(o,D)),s!==void 0&&(D=Math.min(s,D)),D!==e&&(t?.(D),u&&k());}c(false);},b=x=>{x.key==="Enter"?h():x.key==="Escape"&&(p(e?.toString()||""),c(false));};return n||!t?jsx("span",{className:m("text-sm transition-all",a?"text-[#94A3B8]":"text-gray-500",y&&"font-medium"),children:g!==void 0?g:r}):i?jsx("input",{ref:f,type:"number",value:d,onChange:x=>p(x.target.value),onBlur:h,onKeyDown:b,onClick:x=>x.stopPropagation(),min:o,max:s,className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white":"bg-white border-[#3B82F6] text-gray-900")}):jsx("button",{onClick:x=>{x.stopPropagation(),c(true);},className:m("text-sm text-left w-full px-2 py-1 rounded transition-all duration-300",a?"text-[#94A3B8] hover:bg-white/10":"text-gray-500 hover:bg-gray-100",g===void 0&&(a?"text-[#6B7280]":"text-gray-400"),v&&(a?"bg-green-500/30":"bg-green-500/20"),y&&"font-medium scale-105"),children:g!==void 0?g:r})}function Am({value:e,options:t=[],onChange:a,isDark:r,placeholder:o="-",disabled:s=false}){let[n,l]=useState(false),u=useRef(null);return useEffect(()=>{let i=c=>{u.current&&!u.current.contains(c.target)&&l(false);};return n&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[n]),s||!a?jsx("span",{className:m("text-sm",r?"text-[#94A3B8]":"text-gray-500"),children:e||o}):jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!n);},className:m("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("span",{className:m("text-sm flex-1 text-left truncate",r?"text-[#94A3B8]":"text-gray-500",!e&&(r?"text-[#6B7280]":"text-gray-400")),children:e||o}),jsx(ChevronDown,{className:m("w-3 h-3 flex-shrink-0",r?"text-[#6B7280]":"text-gray-400")})]}),n&&jsx("div",{className:m("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1F2937] border-white/10":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:m("px-3 py-2 text-sm",r?"text-[#6B7280]":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:c=>{c.stopPropagation(),a(i),l(false);},className:m("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/10":"hover:bg-gray-100",e===i&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#3B82F6]"})]},i))})]})}function Im({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:o=true,confirmDelay:s=1500}){let{pendingValue:n,isPending:l,progress:u,startChange:i,cancelChange:c}=wm(t,{delay:s}),d=f=>{f.stopPropagation(),!r&&t&&(o?l?c():i(!e):t(!e));},p=l?n:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:d,disabled:r||!t,className:m("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-all",p?"bg-[#3B82F6] border-[#3B82F6]":a?"border-[#4B5563] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",l&&"ring-2 ring-offset-1",l&&p&&"ring-green-500/50",l&&!p&&"ring-red-500/50",l&&(a?"ring-offset-[#0F1117]":"ring-offset-white")),children:[l&&jsx("svg",{className:"absolute inset-0 w-full h-full -rotate-90",viewBox:"0 0 20 20",children:jsx("circle",{cx:"10",cy:"10",r:"8",fill:"none",stroke:p?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${u/100*50.26} 50.26`,className:"transition-all duration-100"})}),l?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):p?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),l&&jsx("button",{onClick:f=>{f.stopPropagation(),c();},className:m("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function Om({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:m("text-sm",t?"text-[#6B7280]":"text-gray-400"),children:"-"});let r=e.slice(0,a),o=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-xs rounded-full",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.1)":"#F3F4F6",color:s.color||(t?"#9CA3AF":"#6B7280")},children:s.name},s.id)),o>0&&jsxs("span",{className:m("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-500"),children:["+",o]})]})}function Uv(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function Hv(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let l=parseInt(a[1],10),u=parseInt(a[2],10);return l*60+u}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),u=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+u}let o=t.match(/^(\d+\.?\d*)\s*h$/);if(o&&o[1])return Math.round(parseFloat(o[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let n=parseFloat(t);return isNaN(n)?null:Math.round(n*60)}function No({value:e,onChange:t,isDark:a,locale:r="en",placeholder:o,disabled:s=false,enableSaveFlash:n=true,isBlurred:l=false}){let[u,i]=useState(false),[c,d]=useState(""),p=useRef(null),{isFlashing:f,triggerFlash:v}=tn(),k=Uv(e,r);useEffect(()=>{u&&p.current&&(p.current.focus(),p.current.select());},[u]),useEffect(()=>{if(e){let h=Math.floor(e/60),b=e%60;h>0&&b>0?d(`${h}h ${b}m`):h>0?d(`${h}h`):d(`${b}m`);}else d("");},[e,u]);let g=()=>{let h=Hv(c);h!==e&&(t?.(h),n&&v()),i(false);},y=h=>{h.key==="Enter"?g():h.key==="Escape"&&i(false);};return l?jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-[#94A3B8]":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]}):s||!t?jsxs("div",{className:"flex items-center gap-1.5",children:[e!=null&&e>0&&jsx(Clock,{className:m("w-3.5 h-3.5 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("text-sm",a?"text-[#94A3B8]":"text-gray-500",(!e||e===0)&&(a?"text-[#6B7280]":"text-gray-400")),children:k})]}):u?jsx("input",{ref:p,type:"text",value:c,onChange:h=>d(h.target.value),onBlur:g,onKeyDown:y,onClick:h=>h.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:m("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/5 border-[#3B82F6] text-white placeholder:text-[#6B7280]":"bg-white border-[#3B82F6] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:h=>{h.stopPropagation(),i(true);},className:m("flex items-center gap-1 text-sm text-left w-full px-1.5 py-1 rounded transition-all duration-300 overflow-hidden",a?"hover:bg-white/10":"hover:bg-gray-100",e!=null&&e>0?a?"text-[#94A3B8]":"text-gray-600":a?"text-[#6B7280]":"text-gray-400",f&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(Clock,{className:m("w-3 h-3 flex-shrink-0",a?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:"truncate",children:k})]})}function tx(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function ax(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function Gm({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:o,onTaskDuplicate:s,onTaskDelete:n,onTaskUpdate:l,onColumnHide:u,onColumnSort:i,availableUsers:c=[]}){let d=useRef(null),p=r==="es"?Hm.es:Hm.en;if(useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&t();},h=b=>{b.key==="Escape"&&t();};return document.addEventListener("mousedown",y),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",h);}},[t]),!e.isOpen)return null;let f=()=>{if(!e.task)return [];let y=[];return o&&y.push({id:"edit",label:p.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{o(e.task),t();}}),y.push({id:"sep1",label:"",icon:null,separator:true}),l&&(y.push({id:"status",label:p.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:p.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{l({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-blue-500"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),y.push({id:"priority",label:p.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:p.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{l({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:p.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{l({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:p.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{l({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:p.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-blue-500"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),c.length>0&&y.push({id:"assign",label:p.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:c.slice(0,5).map(h=>({id:`assign-${h.id}`,label:h.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-blue-500",children:h.name.charAt(0).toUpperCase()}),onClick:()=>{let b=e.task.assignees||[],D=b.some(N=>N.name===h.name)?b.filter(N=>N.name!==h.name):[...b,{name:h.name,initials:tx(h.name),color:h.color||ax(h.name),avatar:h.avatarUrl}];l({...e.task,assignees:D}),t();}}))})),y.push({id:"sep2",label:"",icon:null,separator:true}),s&&y.push({id:"duplicate",label:p.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),n&&y.push({id:"delete",label:p.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{n(e.task.id),t();}}),y},v=()=>{if(!e.columnId)return [];let y=[];return i&&(y.push({id:"sort-asc",label:p.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),y.push({id:"sort-desc",label:p.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),u&&e.columnId!=="name"&&(y.push({id:"sep-hide",label:"",icon:null,separator:true}),y.push({id:"hide",label:p.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{u(e.columnId),t();}})),y},k=e.type==="task"?f():v(),g={position:"fixed",left:e.x,top:e.y,zIndex:9999};return jsx("div",{ref:d,style:g,className:m("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:k.map(y=>y.separator?jsx("div",{className:m("my-1 h-px",a?"bg-white/10":"bg-gray-200")},y.id):y.submenu?jsx(rx,{item:y,isDark:a},y.id):jsxs("button",{onClick:y.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/10":"hover:bg-gray-100",y.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:m(y.danger?"text-red-500":a?"text-[#9CA3AF]":"text-gray-400"),children:y.icon}),y.label]},y.id))})}function rx({item:e,isDark:t}){let[a,r]=useState(false),o=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{o.current&&clearTimeout(o.current),r(true);},onMouseLeave:()=>{o.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:m("w-4 h-4",t?"text-[#6B7280]":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:m("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:m("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-[#9CA3AF]":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Hm={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",delete:"Delete",todo:"To Do",inProgress:"In Progress",completed:"Completed",urgent:"Urgent",high:"High",medium:"Medium",low:"Low",sortAsc:"Sort A \u2192 Z",sortDesc:"Sort Z \u2192 A",hideColumn:"Hide column"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",delete:"Eliminar",todo:"Pendiente",inProgress:"En Progreso",completed:"Completado",urgent:"Urgente",high:"Alta",medium:"Media",low:"Baja",sortAsc:"Ordenar A \u2192 Z",sortDesc:"Ordenar Z \u2192 A",hideColumn:"Ocultar columna"}};var Xm={name:jsx(Type,{className:"w-4 h-4"}),status:jsx(CircleDot,{className:"w-4 h-4"}),priority:jsx(Flag,{className:"w-4 h-4"}),assignees:jsx(Users,{className:"w-4 h-4"}),startDate:jsx(Calendar,{className:"w-4 h-4"}),endDate:jsx(CalendarCheck,{className:"w-4 h-4"}),progress:jsx(BarChart,{className:"w-4 h-4"}),tags:jsx(Tag,{className:"w-4 h-4"}),estimatedTime:jsx(Clock,{className:"w-4 h-4"}),quotedTime:jsx(FileText,{className:"w-4 h-4"}),elapsedTime:jsx(Timer,{className:"w-4 h-4"}),effortMinutes:jsx(Clock,{className:"w-4 h-4"}),timeLoggedMinutes:jsx(Timer,{className:"w-4 h-4"}),soldEffortMinutes:jsx(FileText,{className:"w-4 h-4"}),text:jsx(Type,{className:"w-4 h-4"}),number:jsx(Hash,{className:"w-4 h-4"}),date:jsx(Calendar,{className:"w-4 h-4"}),dropdown:jsx(ChevronDown,{className:"w-4 h-4"}),checkbox:jsx(CheckSquare,{className:"w-4 h-4"})},yx=["name","status","priority","assignees","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes"];function Zm({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:o,onCreateCustomField:s,isDark:n,locale:l}){let[u,i]=useState(""),[c,d]=useState(null),p=useRef(null),f=l==="es"?Jm.es:Jm.en;if(useLayoutEffect(()=>{if(!e||!p.current)return;let b=()=>{if(!p.current)return;let x=p.current.getBoundingClientRect(),N=window.innerHeight-x.top-20;d(Math.max(300,N));};return requestAnimationFrame(b),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[e]),useEffect(()=>{if(!e)return;let b=setTimeout(()=>{let x=N=>{p.current&&!p.current.contains(N.target)&&t();},D=N=>{N.key==="Escape"&&t();};document.addEventListener("mousedown",x),document.addEventListener("keydown",D),p._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(b),p._cleanup&&p._cleanup();}},[e,t]),!e)return null;let v=b=>f.columns[b]||b,k=b=>{if(b==="name")return;let x=a.map(D=>D.id===b?{...D,visible:!D.visible}:D);o(x);},g=(b,x)=>{let D=a.find(C=>C.type===b&&(!x||C.customFieldId===x));if(D){k(D.id);return}let N={id:x||b,type:b,label:x?r.find(C=>C.id===x)?.name||b:v(b),width:120,visible:true,sortable:true,resizable:true,customFieldId:x};o([...a,N]);},y=yx.filter(b=>v(b).toLowerCase().includes(u.toLowerCase())),h=r.filter(b=>b.name.toLowerCase().includes(u.toLowerCase()));return jsxs("div",{ref:p,style:c?{maxHeight:`${c}px`}:void 0,className:m("absolute right-0 top-full mt-1 w-72 rounded-lg shadow-xl border z-50 flex flex-col",n?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:m("flex items-center justify-between px-4 py-3 border-b",n?"border-white/10":"border-gray-200"),children:[jsx("h3",{className:m("font-medium",n?"text-white":"text-gray-900"),children:f.title}),jsx("button",{onClick:t,className:m("p-1 rounded",n?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:m("w-4 h-4",n?"text-[#9CA3AF]":"text-gray-400")})})]}),jsx("div",{className:"p-3",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:m("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",n?"text-[#6B7280]":"text-gray-400")}),jsx("input",{type:"text",value:u,onChange:b=>i(b.target.value),placeholder:f.searchPlaceholder,className:m("w-full pl-9 pr-3 py-2 text-sm rounded-lg border outline-none",n?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain",onWheel:b=>b.stopPropagation(),children:[jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.standardFields}),jsx("div",{className:"space-y-1",children:y.map(b=>{let x=a.find(C=>C.type===b&&!C.customFieldId),D=x?.visible??false,N=b==="name";return jsxs("button",{onClick:()=>{N||(x?k(x.id):g(b));},disabled:N,className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100",N&&"opacity-50 cursor-not-allowed"),children:[jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",D?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:D&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Xm[b]}),jsx("span",{className:n?"text-white":"text-gray-900",children:v(b)})]},b)})})]}),h.length>0&&jsxs("div",{className:"px-3 pb-2",children:[jsx("h4",{className:m("text-xs font-medium uppercase tracking-wider mb-2",n?"text-[#6B7280]":"text-gray-400"),children:f.customFields}),jsx("div",{className:"space-y-1",children:h.map(b=>{let D=a.find(N=>N.customFieldId===b.id)?.visible??false;return jsxs("button",{onClick:()=>g(b.type,b.id),className:m("w-full flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors",n?"hover:bg-white/10":"hover:bg-gray-100"),children:[jsx("div",{className:m("w-5 h-5 rounded border flex items-center justify-center",D?"bg-[#3B82F6] border-[#3B82F6]":n?"border-[#4B5563]":"border-gray-300"),children:D&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:n?"text-[#9CA3AF]":"text-gray-400",children:Xm[b.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{className:n?"text-white":"text-gray-900",children:b.name})]},b.id)})})]})]})]})}var Jm={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",assignees:"Assignees",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",effortMinutes:"Estimated",timeLoggedMinutes:"Time Logged",soldEffortMinutes:"Quoted",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",assignees:"Asignados",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Tiempo",effortMinutes:"Estimado",timeLoggedMinutes:"Tiempo Registrado",soldEffortMinutes:"Ofertado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var Sx=[{type:"text",icon:jsx(Type,{className:"w-5 h-5"})},{type:"number",icon:jsx(Hash,{className:"w-5 h-5"})},{type:"date",icon:jsx(Calendar,{className:"w-5 h-5"})},{type:"dropdown",icon:jsx(ChevronDown,{className:"w-5 h-5"})},{type:"checkbox",icon:jsx(CheckSquare,{className:"w-5 h-5"})}];function tp({isOpen:e,onClose:t,onSave:a,isDark:r,locale:o}){let[s,n]=useState(""),[l,u]=useState("text"),[i,c]=useState([""]),d=o==="es"?ep.es:ep.en;useEffect(()=>{e&&(n(""),u("text"),c([""]));},[e]),useEffect(()=>{let g=y=>{y.key==="Escape"&&t();};return e&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[e,t]);let p=()=>{if(!s.trim())return;let g={name:s.trim(),type:l};l==="dropdown"&&(g.options=i.filter(y=>y.trim())),a(g),t();},f=()=>{c([...i,""]);},v=(g,y)=>{let h=[...i];h[g]=y,c(h);},k=g=>{i.length>1&&c(i.filter((y,h)=>h!==g));};return e?jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[jsx("div",{className:"absolute inset-0 bg-black/50",onClick:t}),jsxs("div",{className:m("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsxs("div",{className:m("flex items-center justify-between px-6 py-4 border-b",r?"border-white/10":"border-gray-200"),children:[jsx("h2",{className:m("text-lg font-semibold",r?"text-white":"text-gray-900"),children:d.title}),jsx("button",{onClick:t,className:m("p-1 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(X,{className:m("w-5 h-5",r?"text-[#9CA3AF]":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldName}),jsx("input",{type:"text",value:s,onChange:g=>n(g.target.value),placeholder:d.fieldNamePlaceholder,className:m("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:Sx.map(g=>jsxs("button",{onClick:()=>u(g.type),className:m("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===g.type?"border-[#3B82F6] bg-[#3B82F6]/10":r?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-400",children:g.icon}),jsx("span",{className:m("text-xs",l===g.type?"text-[#3B82F6]":r?"text-[#9CA3AF]":"text-gray-500"),children:d.types[g.type]})]},g.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:m("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:d.options}),jsxs("div",{className:"space-y-2",children:[i.map((g,y)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:g,onChange:h=>v(y,h.target.value),placeholder:`${d.option} ${y+1}`,className:m("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#3B82F6]/30",r?"bg-white/5 border-white/10 text-white placeholder:text-[#6B7280]":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>k(y),className:m("p-2 rounded-lg transition-colors",r?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},y)),jsxs("button",{onClick:f,className:m("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#3B82F6] hover:bg-white/10":"text-blue-600 hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),d.addOption]})]})]})]}),jsxs("div",{className:m("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-white/10":"border-gray-200"),children:[jsx("button",{onClick:t,className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-[#9CA3AF] hover:bg-white/10":"text-gray-600 hover:bg-gray-100"),children:d.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:m("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#3B82F6] text-white hover:bg-[#2563EB]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:d.create})]})]})]}):null}var ep={en:{title:"Create Custom Field",fieldName:"Field Name",fieldNamePlaceholder:"Enter field name...",fieldType:"Field Type",options:"Options",option:"Option",addOption:"Add option",cancel:"Cancel",create:"Create Field",types:{text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox"}},es:{title:"Crear Campo Personalizado",fieldName:"Nombre del Campo",fieldNamePlaceholder:"Ingresa el nombre...",fieldType:"Tipo de Campo",options:"Opciones",option:"Opci\xF3n",addOption:"Agregar opci\xF3n",cancel:"Cancelar",create:"Crear Campo",types:{text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla"}}};var op={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To Do / Pending",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En Progreso",toDo:"Por Hacer / Pendiente",hideCompleted:"Ocultar Tareas Completadas"}};function np({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:o,locale:s}){let[n,l]=useState(false),u=useRef(null),i=useRef(0),c=s==="es"?op.es:op.en;useEffect(()=>{if(!n)return;let f=k=>{Date.now()-i.current<100||u.current&&!u.current.contains(k.target)&&l(false);},v=k=>{k.key==="Escape"&&l(false);};return document.addEventListener("mousedown",f),document.addEventListener("keydown",v),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",v);}},[n]);let d=[{value:"all",label:c.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}),color:"text-[#3B82F6]"},{value:"completed",label:c.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:c.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-blue-500"},{value:"todo",label:c.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:f=>{f.stopPropagation(),n||(i.current=Date.now()),l(v=>!v);},className:m("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium transition-colors border",o?"border-white/10 hover:bg-white/10 text-white":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(o?"bg-[#3B82F6]/20 border-[#3B82F6]/50 text-[#3B82F6]":"bg-blue-50 border-blue-200 text-blue-600"),n&&(o?"bg-white/10":"bg-gray-100")),children:[jsx(Filter,{className:"w-4 h-4"}),c.filters,p&&jsx("span",{className:m("w-2 h-2 rounded-full",o?"bg-[#3B82F6]":"bg-blue-500")})]}),n&&jsxs("div",{className:m("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",o?"bg-[#0F1117] border-white/10":"bg-white border-gray-200"),children:[jsx("div",{className:m("px-4 py-3 border-b",o?"border-white/10":"border-gray-200"),children:jsx("span",{className:m("text-xs font-medium uppercase tracking-wider",o?"text-[#6B7280]":"text-gray-400"),children:c.filterByStatus})}),jsx("div",{className:"py-2",children:d.map(f=>{let v=e===f.value&&!t,k=()=>f.value==="all"?v?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#3B82F6] bg-[#3B82F6]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):f.icon;return jsxs("button",{onClick:()=>{a(f.value),r(false),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",v&&(o?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m(v?f.color:"text-gray-400","flex-shrink-0"),children:k()}),jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:f.label}),v&&jsx(Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]},f.value)})}),jsx("div",{className:m("my-2 mx-4 h-px",o?"bg-white/10":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let f=!t;r(f),f&&a("all"),l(false);},className:m("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",o?"hover:bg-white/10":"hover:bg-gray-100",t&&(o?"bg-white/5":"bg-gray-50")),children:[jsx(EyeOff,{className:m("w-4 h-4 flex-shrink-0",t?o?"text-[#3B82F6]":"text-blue-500":o?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:m("flex-1 text-left whitespace-nowrap",o?"text-white":"text-gray-900"),children:c.hideCompleted}),t&&jsx(Check,{className:m("w-4 h-4 flex-shrink-0",o?"text-[#3B82F6]":"text-blue-500")})]})})]})]})}var Hx=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true}];function dp(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(...dp(r.subtasks,t+1));return a}function cp({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:o,className:s,style:n,availableUsers:l=[],customFields:u=[]}){let{theme:i="dark",locale:c="en",customTranslations:d,showSearch:p=true,showHierarchy:f=true,tableColumns:v,allowColumnCustomization:k=true,allowColumnResize:g=true,enableContextMenu:y=true,showCreateTaskButton:h=false,onCreateTask:b,persistFilter:x=false,financialBlur:D}=t,N=$s(c,d),C=i==="dark",w=useCallback(()=>{if(!x||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let G=localStorage.getItem(x);if(G){let q=JSON.parse(G);return {statusFilter:q.statusFilter||"all",hideCompleted:q.hideCompleted||!1}}}catch(G){console.error("Error loading persisted filter:",G);}return {statusFilter:"all",hideCompleted:false}},[x]),[R,F]=useState("startDate"),[T,H]=useState("asc"),[A,se]=useState(""),[S,j]=useState(()=>w().statusFilter),[ie,Ae]=useState(()=>w().hideCompleted),[L,ge]=useState(v||Hx),[ee,Ke]=useState(false),[B,te]=useState(false),[xe,fe]=useState({isOpen:false,x:0,y:0,type:"task"}),[He,ve]=useState(null),[_e,re]=useState(0),[V,Y]=useState(0),me=useRef(null);useEffect(()=>{v&&ge(v);},[v]),useEffect(()=>{if(!(!x||typeof window>"u"))try{localStorage.setItem(x,JSON.stringify({statusFilter:S,hideCompleted:ie}));}catch(G){console.error("Error persisting filter state:",G);}},[x,S,ie]);let Te=useMemo(()=>{let G=new Set;function q(ke){for(let rt of ke)rt.subtasks?.length&&(rt.isExpanded!==false&&G.add(rt.id),q(rt.subtasks));}return q(e),G},[e]),Xe=useMemo(()=>L.filter(G=>G.visible),[L]),z=useCallback(G=>{a.onTaskToggleExpand?.(G);},[a]),Ne=useCallback(G=>{R===G?H(q=>q==="asc"?"desc":"asc"):(F(G),H("asc")),a.onSortChange?.({column:G,direction:T==="asc"?"desc":"asc"});},[R,T,a]),Pe=useCallback(G=>{ge(G),a.onColumnsChange?.(G);},[a]),Fe=useCallback(G=>{let q=L.map(ke=>ke.id===G?{...ke,visible:false}:ke);Pe(q);},[L,Pe]),J=useCallback((G,q)=>{F(G),H(q);},[]),I=useCallback((G,q,ke)=>{y&&(G.preventDefault(),fe({isOpen:true,x:G.clientX,y:G.clientY,type:q?"task":"header",task:q,columnId:ke}));},[y]),K=useCallback(()=>{fe(G=>({...G,isOpen:false}));},[]),le=useCallback((G,q)=>{if(!g)return;G.preventDefault(),G.stopPropagation();let ke=L.find(rt=>rt.id===q);ke&&(ve(q),re(G.clientX),Y(ke.width));},[L,g]);useEffect(()=>{if(!He)return;let G=ke=>{let rt=ke.clientX-_e,Se=Math.max(50,V+rt),Re=L.map(X=>X.id===He?{...X,width:Se}:X);ge(Re);},q=()=>{He&&a.onColumnsChange?.(L),ve(null);};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",q),()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",q);}},[He,_e,V,L,a]);let De=useCallback(async G=>{if(a.onCreateCustomField){let q={...G,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(q);}te(false);},[a]),je=useCallback(G=>G.progress===100||G.status==="completed"?"completed":G.progress&&G.progress>0||G.status==="in-progress"?"in-progress":"todo",[]),ot=useMemo(()=>{let G=dp(e);if(A.trim()){let q=A.toLowerCase();G=G.filter(ke=>ke.name.toLowerCase().includes(q));}return S!=="all"&&(G=G.filter(q=>je(q)===S)),ie&&(G=G.filter(q=>je(q)!=="completed")),G.sort((q,ke)=>{let rt,Se;switch(R){case "name":rt=q.name.toLowerCase(),Se=ke.name.toLowerCase();break;case "startDate":rt=q.startDate?.getTime()||0,Se=ke.startDate?.getTime()||0;break;case "endDate":rt=q.endDate?.getTime()||0,Se=ke.endDate?.getTime()||0;break;case "progress":rt=q.progress||0,Se=ke.progress||0;break;case "status":rt=q.status||"todo",Se=ke.status||"todo";break;case "priority":let Re={urgent:0,high:1,medium:2,low:3,none:4};rt=Re[q.priority]??4,Se=Re[ke.priority]??4;break;default:return 0}return rt<Se?T==="asc"?-1:1:rt>Se?T==="asc"?1:-1:0}),G},[e,A,S,ie,R,T,je]),ct=useCallback((G,q)=>{let ke=Re=>{a.onTaskUpdate?.({...G,...Re});},rt=Re=>Re?G.customFields?.find(Ye=>Ye.fieldId===Re)?.value:void 0,Se=(Re,X)=>{if(!Re)return;let $=[...G.customFields||[]],de=$.findIndex(Oe=>Oe.fieldId===Re);de>=0?$[de]={fieldId:Re,value:X}:$.push({fieldId:Re,value:X}),ke({customFields:$});};switch(q.type){case "name":return null;case "status":return jsx(pm,{value:G.status||(G.progress===100?"completed":G.progress&&G.progress>0?"in-progress":"todo"),onChange:X=>{ke({status:X,progress:X==="completed"?100:X==="in-progress"?50:0});},isDark:C,locale:c,translations:N.status});case "priority":return jsx(fm,{value:G.priority,onChange:X=>ke({priority:X}),isDark:C,locale:c});case "assignees":return jsx(ym,{value:G.assignees||[],availableUsers:l,onChange:X=>ke({assignees:X}),isDark:C,locale:c});case "startDate":return jsx(Gs,{value:G.startDate,onChange:X=>ke({startDate:X}),isDark:C,locale:c,dateField:"start",startDate:G.startDate,endDate:G.endDate});case "endDate":return jsx(Gs,{value:G.endDate,onChange:X=>ke({endDate:X}),isDark:C,locale:c,dateField:"end",startDate:G.startDate,endDate:G.endDate});case "progress":return jsx(Nm,{value:G.progress||0,onChange:X=>{let Ye=X===100?"completed":X>0?"in-progress":"todo";ke({progress:X,status:Ye});},isDark:C});case "tags":return jsx(Om,{value:G.tags||[],isDark:C});case "text":return jsx(Em,{value:rt(q.customFieldId)||"",onChange:X=>Se(q.customFieldId,X),isDark:C});case "number":return jsx(Fm,{value:rt(q.customFieldId)||0,onChange:X=>Se(q.customFieldId,X),isDark:C});case "date":let Re=rt(q.customFieldId);return jsx(Gs,{value:Re?new Date(Re):void 0,onChange:X=>Se(q.customFieldId,X),isDark:C,locale:c});case "dropdown":return jsx(Am,{value:rt(q.customFieldId)||"",options:q.options||[],onChange:X=>Se(q.customFieldId,X),isDark:C});case "checkbox":return jsx(Im,{value:rt(q.customFieldId)||false,onChange:X=>Se(q.customFieldId,X),isDark:C});case "estimatedTime":{let X=G.status==="completed"||G.progress===100;return jsx(No,{value:G.estimatedTime,onChange:Ye=>ke({estimatedTime:Ye}),isDark:C,locale:c,disabled:X})}case "quotedTime":{let X=G.status==="completed"||G.progress===100,Ye=D?.enabled&&(!D.columns||D.columns.includes("quotedTime"));return jsx(No,{value:G.quotedTime,onChange:$=>ke({quotedTime:$}),isDark:C,locale:c,disabled:X,isBlurred:Ye})}case "elapsedTime":{let X=G.status==="completed"||G.progress===100;return jsx(No,{value:G.elapsedTime,onChange:Ye=>ke({elapsedTime:Ye}),isDark:C,locale:c,disabled:X})}case "effortMinutes":{let X=G.status==="completed"||G.progress===100;return jsx(No,{value:G.effortMinutes,onChange:Ye=>ke({effortMinutes:Ye}),isDark:C,locale:c,disabled:X})}case "timeLoggedMinutes":{let X=G.status==="completed"||G.progress===100;return jsx(No,{value:G.timeLoggedMinutes,onChange:a.onLogTime?Ye=>{a.onLogTime?.(G,Ye);}:void 0,isDark:C,locale:c,placeholder:c==="es"?"Agregar":"Add",disabled:X})}case "soldEffortMinutes":{let X=G.status==="completed"||G.progress===100,Ye=D?.enabled&&(!D.columns||D.columns.includes("soldEffortMinutes"));return jsx(No,{value:G.soldEffortMinutes,onChange:$=>ke({soldEffortMinutes:$}),isDark:C,locale:c,disabled:X,isBlurred:Ye})}default:return jsx("span",{className:m("text-sm",C?"text-[#94A3B8]":"text-gray-500"),children:"-"})}},[a,C,c,l,N]),qe=useCallback(G=>{let ke={name:N.columns.name,status:N.columns.status,priority:N.columns.priority,assignees:N.columns.assignees,startDate:N.columns.startDate,endDate:N.columns.endDate,progress:N.columns.progress,tags:N.columns.tags||(c==="es"?"Etiquetas":"Tags"),estimatedTime:N.columns.estimatedTime||(c==="es"?"Estimado":"Estimated"),quotedTime:N.columns.quotedTime||(c==="es"?"Ofertado":"Quoted"),elapsedTime:N.columns.elapsedTime||(c==="es"?"Tiempo":"Time Spent"),effortMinutes:N.columns.effortMinutes||(c==="es"?"Estimado":"Estimated"),timeLoggedMinutes:N.columns.timeLoggedMinutes||(c==="es"?"Tiempo":"Time Logged"),soldEffortMinutes:N.columns.soldEffortMinutes||(c==="es"?"Ofertado":"Quoted")}[G.type]||G.label;return typeof ke=="string"?ke:String(ke||G.type)},[N,c]),sa=useMemo(()=>Xe.reduce((G,q)=>G+q.width,0)+(k?48:0),[Xe,k]);return r?jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,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:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[N.empty.noTasks,"..."]})]})}):o?jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,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:m("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:typeof o=="string"?o:o.message})]})]})}):e.length===0?jsx("div",{className:m("flex-1 flex items-center justify-center",C?"bg-[#0F1117]":"bg-white",s),style:n,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:m("text-lg font-semibold mb-2",C?"text-white":"text-gray-900"),children:N.empty.noTasks}),jsx("p",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:N.empty.addFirstTask})]})}):jsxs("div",{ref:me,className:m("flex-1 flex flex-col w-full h-full overflow-hidden",C?"bg-[#0F1117]":"bg-white",He&&"select-none",s),style:n,children:[jsx("div",{className:m("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:[jsx(np,{value:S,hideCompleted:ie,onChange:j,onHideCompletedChange:Ae,isDark:C,locale:c}),jsxs("div",{className:m("text-sm",C?"text-[#9CA3AF]":"text-gray-600"),children:[ot.length," ",N.pagination.tasks]}),p&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:m("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:A,onChange:G=>se(G.target.value),placeholder:N.toolbar.searchPlaceholder,className:m("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")})]}),jsx("div",{className:"flex-1"}),h&&b&&jsxs(motion.button,{onClick:b,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-4 h-4"}),jsx("span",{children:N.toolbar.newTask})]})]})}),jsx("div",{className:"flex-1 overflow-auto",children:jsxs("div",{style:{minWidth:sa},children:[jsxs("div",{className:m("flex-shrink-0 flex items-center border-b text-xs font-medium uppercase tracking-wider sticky top-0 z-10",C?"border-white/10 bg-[#0F1117]":"border-gray-200 bg-gray-50"),children:[Xe.map(G=>jsxs("div",{className:m("relative flex items-center gap-2 px-4 py-3",C?"text-[#9CA3AF]":"text-gray-500"),style:{width:G.width,minWidth:G.minWidth},onContextMenu:q=>I(q,void 0,G.id),children:[G.sortable?jsxs("button",{onClick:()=>Ne(G.id),className:"flex items-center gap-1 hover:text-[#3B82F6]",children:[qe(G),jsx(ArrowUpDown,{className:m("w-3 h-3",R===G.id&&"text-[#3B82F6]")})]}):jsx("span",{children:qe(G)}),g&&G.resizable&&jsx("div",{className:m("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#3B82F6]",He===G.id&&"bg-[#3B82F6]"),onMouseDown:q=>le(q,G.id)})]},G.id)),k&&jsxs("div",{className:"relative flex items-center justify-center px-3 py-3",children:[jsx("button",{onClick:G=>{G.stopPropagation(),Ke(q=>!q);},className:m("p-1.5 rounded-lg transition-colors",C?"hover:bg-white/10 text-[#9CA3AF] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ee&&(C?"bg-white/10":"bg-gray-200")),title:c==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-4 h-4"})}),jsx(Zm,{isOpen:ee,onClose:()=>Ke(false),columns:L,customFields:u,onColumnsChange:Pe,onCreateCustomField:()=>{Ke(false),te(true);},isDark:C,locale:c})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:ot.map((G,q)=>{let ke=Te.has(G.id),rt=Math.min(q*.01,.2);return jsxs(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:rt},className:m("flex items-center border-b transition-colors",C?"border-white/5 hover:bg-white/5":"border-gray-100 hover:bg-gray-50"),onClick:()=>a.onTaskClick?.(G),onDoubleClick:()=>a.onTaskDoubleClick?.(G),onContextMenu:Se=>I(Se,G),children:[Xe.map(Se=>jsx("div",{className:"flex items-center px-4 py-3 min-h-[52px]",style:{width:Se.width,minWidth:Se.minWidth},children:Se.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[f&&G.level>0&&jsx("div",{style:{width:`${G.level*24}px`},className:"flex-shrink-0"}),f&&G.hasChildren&&jsx("button",{onClick:Re=>{Re.stopPropagation(),z(G.id);},className:m("p-0.5 rounded flex-shrink-0",C?"hover:bg-white/10":"hover:bg-gray-200"),children:ke?jsx(ChevronDown,{className:m("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")}):jsx(ChevronRight,{className:m("w-4 h-4",C?"text-[#9CA3AF]":"text-gray-400")})}),f&&!G.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsx("span",{className:m("truncate font-medium",C?"text-white":"text-gray-900",G.progress===100&&(C?"line-through text-[#6B7280]":"line-through text-gray-400")),children:G.name})]}):ct(G,Se)},Se.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},G.id)})}),ot.length===0&&A&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:m("w-12 h-12 mx-auto mb-4",C?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:m(C?"text-[#9CA3AF]":"text-gray-600"),children:N.empty.noResults})]})})]})}),jsx(Gm,{state:xe,onClose:K,isDark:C,locale:c,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Fe,onColumnSort:J,availableUsers:l}),jsx(tp,{isOpen:B,onClose:()=>te(false),onSave:De,isDark:C,locale:c})]})}var up=[{id:"name",type:"name",label:"Name",width:300,visible:true,sortable:true,resizable:true},{id:"status",type:"status",label:"Status",width:140,visible:true,sortable:true,resizable:true},{id:"priority",type:"priority",label:"Priority",width:100,visible:false,sortable:true,resizable:true},{id:"assignees",type:"assignees",label:"Assignees",width:150,visible:false,sortable:false,resizable:true},{id:"startDate",type:"startDate",label:"Start Date",width:120,visible:true,sortable:true,resizable:true},{id:"endDate",type:"endDate",label:"End Date",width:120,visible:true,sortable:true,resizable:true},{id:"progress",type:"progress",label:"Progress",width:100,visible:true,sortable:true,resizable:true},{id:"tags",type:"tags",label:"Tags",width:150,visible:false,sortable:false,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Time Logged",width:100,visible:false,sortable:true,resizable:true},{id:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true}],mp=[{type:"name",labelKey:"columns.name",icon:"Type"},{type:"status",labelKey:"columns.status",icon:"CircleDot"},{type:"priority",labelKey:"columns.priority",icon:"Flag"},{type:"assignees",labelKey:"columns.assignees",icon:"Users"},{type:"startDate",labelKey:"columns.startDate",icon:"Calendar"},{type:"endDate",labelKey:"columns.endDate",icon:"CalendarCheck"},{type:"progress",labelKey:"columns.progress",icon:"BarChart"},{type:"tags",labelKey:"columns.tags",icon:"Tag"},{type:"effortMinutes",labelKey:"columns.effortMinutes",icon:"Clock"},{type:"timeLoggedMinutes",labelKey:"columns.timeLoggedMinutes",icon:"Timer"},{type:"soldEffortMinutes",labelKey:"columns.soldEffortMinutes",icon:"FileText"}],pp=[{type:"text",labelKey:"customFields.text",icon:"Type"},{type:"number",labelKey:"customFields.number",icon:"Hash"},{type:"date",labelKey:"customFields.date",icon:"Calendar"},{type:"dropdown",labelKey:"customFields.dropdown",icon:"ChevronDown"},{type:"checkbox",labelKey:"customFields.checkbox",icon:"CheckSquare"}];var Xl={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"},Jl={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"},Zl={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"},Ks={dark:Xl,light:Jl,neutral:Zl};function gp(e){return Ks[e]||Ks.dark}var Ql={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"}},ed={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"}},qs={en:Ql,es:ed};function In(e){return qs[e]||qs.en}function Ys(e,t){let a=In(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 fp(e){let t=In(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 hp(e,t=0,a=true){let r=In(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 kp(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 ad(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 wp({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 Tp({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:o=false,error:s,className:n,style:l,availableTags:u=[],onCreateTag:i,attachmentsByTask:c,comments:d,onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:k,onTaskOpen:g,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,timerState:x,onLogTime:D,onUpdateEstimate:N,onUpdateSoldEffort:C,onStartTimer:w,onStopTimer:R,onDiscardTimer:F,blurFinancials:T=false}){let{theme:H="dark",locale:A="en",customTranslations:se}=t,S=Ys(A,se),j=H==="dark",[ie,Ae]=useState(r||new Date),[L,ge]=useState(null),[ee,Ke]=useState(null),[B,te]=useState({}),xe=4,fe=3,[He,ve]=useState(null),[_e,re]=useState(""),[V,Y]=useState(void 0),[me,Te]=useState(null),[Xe,z]=useState(false),[Ne,Pe]=useState(false),[Fe,J]=useState(null),[I,K]=useState(false),[le,De]=useState(new Date),je=useCallback(()=>{Ae(new Date(ie.getFullYear(),ie.getMonth()-1,1));},[ie]),ot=useCallback(()=>{Ae(new Date(ie.getFullYear(),ie.getMonth()+1,1));},[ie]),ct=useCallback(()=>{Ae(new Date);},[]),qe=useMemo(()=>{let q=ie.getFullYear(),ke=ie.getMonth(),rt=new Date(q,ke,1),Se=new Date(q,ke+1,0),Re=rt.getDay(),X=Se.getDate(),Ye=kp(e),$=new Date;$.setHours(0,0,0,0);let de=[],Oe=Re,et=new Date(q,ke,0).getDate();for(let Ge=Oe-1;Ge>=0;Ge--){let be=new Date(q,ke-1,et-Ge);de.push({date:be,isCurrentMonth:false,isToday:false,isWeekend:be.getDay()===0||be.getDay()===6,events:Ye.filter(Ue=>ad(be,Ue)).map(Ue=>({id:Ue.id,title:Ue.name,start:Ue.startDate,end:Ue.endDate,task:Ue}))});}for(let Ge=1;Ge<=X;Ge++){let be=new Date(q,ke,Ge),Ue=be.getTime()===$.getTime();de.push({date:be,isCurrentMonth:true,isToday:Ue,isWeekend:be.getDay()===0||be.getDay()===6,events:Ye.filter(W=>ad(be,W)).map(W=>({id:W.id,title:W.name,start:W.startDate,end:W.endDate,task:W}))});}let tt=42-de.length;for(let Ge=1;Ge<=tt;Ge++){let be=new Date(q,ke+1,Ge);de.push({date:be,isCurrentMonth:false,isToday:false,isWeekend:be.getDay()===0||be.getDay()===6,events:Ye.filter(Ue=>ad(be,Ue)).map(Ue=>({id:Ue.id,title:Ue.name,start:Ue.startDate,end:Ue.endDate,task:Ue}))});}return de},[ie,e]),sa=A==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],G=ie.toLocaleDateString(A==="es"?"es-ES":"en-US",{month:"long",year:"numeric"});return o?jsx("div",{className:m("flex-1 flex items-center justify-center",j?"bg-[#0F1117]":"bg-white",n),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:m("text-sm",j?"text-[#9CA3AF]":"text-gray-600"),children:[S.labels.noEvents,"..."]})]})}):s?jsx("div",{className:m("flex-1 flex items-center justify-center",j?"bg-[#0F1117]":"bg-white",n),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:m("text-lg font-semibold mb-2",j?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:m("text-sm",j?"text-[#9CA3AF]":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:m("flex-1 flex items-center justify-center",j?"bg-[#0F1117]":"bg-white",n),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(Calendar,{className:"w-8 h-8 text-[#3B82F6]"})}),jsx("h3",{className:m("text-lg font-semibold mb-2",j?"text-white":"text-gray-900"),children:S.labels.noEvents}),jsx("p",{className:m("text-sm",j?"text-[#9CA3AF]":"text-gray-600"),children:S.labels.newTask})]})}):jsxs("div",{className:m("flex-1 flex flex-col w-full h-full overflow-auto",j?"bg-[#0F1117]":"bg-white",n),style:l,children:[jsx("div",{className:m("flex-shrink-0 px-6 py-4 border-b",j?"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:m("text-xl font-semibold capitalize",j?"text-white":"text-gray-900"),children:G}),jsx("button",{onClick:ct,className:m("px-3 py-1.5 text-sm rounded-lg transition-colors",j?"bg-white/5 text-white hover:bg-white/10":"bg-gray-100 text-gray-700 hover:bg-gray-200"),children:S.navigation.today})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:je,className:m("p-2 rounded-lg transition-colors",j?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:m("w-5 h-5",j?"text-[#9CA3AF]":"text-gray-600")})}),jsx("button",{onClick:ot,className:m("p-2 rounded-lg transition-colors",j?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:m("w-5 h-5",j?"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:sa.map(q=>jsx("div",{className:m("py-2 text-center text-xs font-medium uppercase",j?"text-[#9CA3AF]":"text-gray-500"),children:q},q))}),jsx("div",{className:m("grid grid-cols-7 auto-rows-min gap-px rounded-lg",j?"bg-[#2D2D2D]":"bg-gray-300"),children:qe.map((q,ke)=>{let rt=q.date.getDay()===0||q.date.getDay()===6;return jsxs("div",{className:m("min-h-[120px] p-2 transition-colors flex flex-col relative group",j?rt?"bg-[#1C1F26]":q.isCurrentMonth?"bg-[#13161B]":"bg-[#0D0F13]":rt?"bg-gray-100":q.isCurrentMonth?"bg-white":"bg-gray-50",q.isToday&&"ring-2 ring-[#3B82F6] ring-inset"),children:[(()=>{let Se=B[ke]||xe,Re=q.events.slice(0,Se),X=q.events.length-Se;return jsxs("div",{className:"space-y-1 flex-1",children:[Re.map(Ye=>jsx("div",{className:"relative group",children:jsxs(motion.button,{onClick:()=>{ge(Ye.task),a.onEventClick?.(Ye),g?.(Ye.task.id);},whileHover:{scale:1.02},className:m("w-full flex items-center gap-1 px-1.5 py-0.5 rounded text-xs truncate",Ye.task.progress===100?j?"bg-green-500/20 text-green-400":"bg-green-500/10 text-green-600":j?"bg-[#3B82F6]/20 text-[#3B82F6]":"bg-[#3B82F6]/10 text-[#3B82F6]"),children:[jsx(wp,{task:Ye.task}),jsx("span",{className:"truncate",children:Ye.title})]})},Ye.id)),X>0&&jsxs("button",{onClick:Ye=>{Ye.stopPropagation(),te($=>({...$,[ke]:Se+fe}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",j?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:["+",X," ",A==="es"?"M\xC1S":"MORE"]}),Se>xe&&q.events.length>xe&&jsx("button",{onClick:Ye=>{Ye.stopPropagation(),te($=>({...$,[ke]:xe}));},className:m("text-xs px-1.5 py-0.5 hover:underline cursor-pointer font-medium",j?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-600"),children:A==="es"?"MENOS":"LESS"})]})})(),jsxs("div",{className:"flex items-center justify-end gap-1.5 mt-1",children:[(()=>{let Se=ke>=28,Re=ke%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),He===ke?ve(null):(ve(ke),re(""),Y(void 0),Te(null),J(null),z(false),Pe(false),K(false),De(q.date));},className:m("w-5 h-5 rounded flex items-center justify-center transition-all",He===ke?"opacity-100 bg-[#7C3AED] text-white":"opacity-0 group-hover:opacity-100",j?"hover:bg-[#7C3AED] text-[#6B7280] hover:text-white":"hover:bg-[#7C3AED] text-gray-400 hover:text-white"),children:jsx(Plus,{className:m("w-3.5 h-3.5 transition-transform",He===ke&&"rotate-45")})}),jsx(AnimatePresence,{children:He===ke&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{ve(null),re(""),Y(void 0),Te(null),J(null),z(false),Pe(false),K(false);}}),jsxs(motion.div,{initial:{opacity:0,y:Se?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Se?-5:5,scale:.95},transition:{duration:.12},className:m("absolute w-[320px] rounded-lg shadow-2xl z-50",Se?"bottom-full mb-1":"top-full mt-1",Re?"right-0":"left-0",j?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>{X.stopPropagation(),z(false),Pe(false),K(false);},children:[jsx("div",{className:"p-2.5",children:jsx("input",{type:"text",value:_e,onChange:X=>re(X.target.value),placeholder:A==="es"?'Escribe el nombre de la tarea o "/" para los comandos':'Type task name or "/" for commands',className:m("w-full bg-transparent text-sm outline-none placeholder:opacity-40",j?"text-white":"text-gray-900"),autoFocus:true,onKeyDown:X=>{if(X.key==="Enter"&&_e.trim()){let Ye=t.availableUsers?.find(de=>de.id===me),$=Fe||q.date;a.onTaskCreate?.({name:_e.trim(),startDate:$,endDate:$,priority:V,assignees:Ye?[Ye]:void 0}),re(""),Y(void 0),Te(null),J(null),ve(null);}X.key==="Escape"&&(ve(null),re(""),Y(void 0),Te(null),J(null));}})}),jsxs("div",{className:m("px-2.5 py-2 flex items-center justify-between border-t",j?"border-white/10":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),z(!Xe),Pe(false);},className:m("p-1 rounded transition-colors",V?V==="urgent"||V==="high"?"text-red-400 bg-red-500/20":V==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":j?"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:Xe&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",j?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:A==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:A==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:A==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:A==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:A==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{Y(X.id),z(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",j?"hover:bg-white/5":"hover:bg-gray-50",V===X.id&&(j?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:m("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:j?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),K(!I),z(false),Pe(false),De(Fe||q.date);},className:m("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors",Fe?"bg-[#7C3AED]/20 text-[#7C3AED]":j?"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"}),(Fe||q.date).toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:I&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-xl shadow-2xl overflow-hidden flex",j?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:m("w-40 py-2 border-r",j?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Ye=new Date(X);Ye.setDate(X.getDate()+1);let $=new Date(X);$.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let de=new Date(X);de.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let Oe=new Date(X);Oe.setDate(X.getDate()+14);let et=new Date(X);return et.setDate(X.getDate()+28),[{label:A==="es"?"Hoy":"Today",date:X,display:X.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:A==="es"?"Ma\xF1ana":"Tomorrow",date:Ye,display:Ye.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:A==="es"?"Este fin de semana":"This weekend",date:$,display:A==="es"?"s\xE1b.":"sat."},{label:A==="es"?"Pr\xF3xima semana":"Next week",date:de,display:A==="es"?"lun.":"mon."},{label:A==="es"?"2 semanas":"2 weeks",date:Oe,display:Oe.toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:A==="es"?"4 semanas":"4 weeks",date:et,display:et.toLocaleDateString(A==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ge,be)=>jsxs("button",{className:m("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",j?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{J(Ge.date),K(false);},children:[jsx("span",{children:Ge.label}),jsx("span",{className:m("text-[10px]",j?"text-[#6B7280]":"text-gray-400"),children:Ge.display})]},be))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:m("text-xs font-medium",j?"text-white":"text-gray-900"),children:le.toLocaleDateString(A==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>De(new Date),className:m("px-1.5 py-0.5 rounded text-[10px] transition-colors",j?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:A==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>De(new Date(le.getFullYear(),le.getMonth()-1)),className:m("p-0.5 rounded",j?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:()=>De(new Date(le.getFullYear(),le.getMonth()+1)),className:m("p-0.5 rounded",j?"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:(A==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:m("w-6 h-6 flex items-center justify-center text-[10px]",j?"text-[#6B7280]":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=le.getFullYear(),Ye=le.getMonth(),$=new Date(X,Ye,1).getDay(),de=new Date(X,Ye+1,0).getDate(),Oe=new Date(X,Ye,0).getDate(),et=new Date,tt=[];for(let be=$-1;be>=0;be--)tt.push({dayNum:Oe-be,isCurrentMonth:false,date:new Date(X,Ye-1,Oe-be)});for(let be=1;be<=de;be++)tt.push({dayNum:be,isCurrentMonth:true,date:new Date(X,Ye,be)});let Ge=42-tt.length;for(let be=1;be<=Ge;be++)tt.push({dayNum:be,isCurrentMonth:false,date:new Date(X,Ye+1,be)});return tt.map((be,Ue)=>{let W=be.date.toDateString()===et.toDateString(),ce=(Fe||q.date).toDateString()===be.date.toDateString();return jsx("button",{className:m("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",!be.isCurrentMonth&&(j?"text-[#4B5563]":"text-gray-300"),be.isCurrentMonth&&(j?"text-white":"text-gray-900"),W&&"ring-1 ring-[#3B82F6]",ce&&"bg-[#7C3AED] text-white",!ce&&(j?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{J(be.date),K(false);},children:be.dayNum},Ue)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),Pe(!Ne),z(false);},className:m("p-1 rounded transition-colors",me?"text-[#7C3AED] bg-[#7C3AED]/20":j?"hover:bg-white/10 text-[#6B7280]":"hover:bg-gray-100 text-gray-400"),children:me?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(X=>X.id===me)?.color||"#7C3AED"},children:t.availableUsers?.find(X=>X.id===me)?.initials||t.availableUsers?.find(X=>X.id===me)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:Ne&&jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:m("absolute left-0 bottom-full mb-1 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",j?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{onClick:()=>{Te(null),Pe(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",j?"hover:bg-white/5":"hover:bg-gray-50",!me&&(j?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:m("w-5 h-5 rounded-full flex items-center justify-center",j?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:j?"text-[#9CA3AF]":"text-gray-500",children:A==="es"?"Sin asignar":"Unassigned"})]}),t.availableUsers?.map(X=>jsxs("button",{onClick:()=>{Te(X.id),Pe(false);},className:m("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",j?"hover:bg-white/5":"hover:bg-gray-50",me===X.id&&(j?"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:X.color||"#7C3AED"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:j?"text-white":"text-gray-900",children:X.name})]},X.id)),(!t.availableUsers||t.availableUsers.length===0)&&jsx("div",{className:m("px-3 py-2 text-xs",j?"text-[#6B7280]":"text-gray-400"),children:A==="es"?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:()=>{if(_e.trim()){let X=t.availableUsers?.find($=>$.id===me),Ye=Fe||q.date;a.onTaskCreate?.({name:_e.trim(),startDate:Ye,endDate:Ye,priority:V,assignees:X?[X]:void 0}),re(""),Y(void 0),Te(null),J(null),ve(null);}},disabled:!_e.trim(),className:m("px-2.5 py-1 rounded text-xs font-medium transition-colors",_e.trim()?"bg-[#7C3AED] hover:bg-[#6D28D9] text-white":j?"bg-white/5 text-[#4B5563]":"bg-gray-100 text-gray-400"),children:A==="es"?"Guardar":"Save"})]})]})]})})]})})(),jsx("span",{className:m("text-sm font-medium",q.isToday?"text-[#3B82F6]":q.isCurrentMonth?j?"text-white":"text-gray-900":j?"text-[#6B7280]":"text-gray-400"),children:q.date.getDate()})]})]},ke)})})]})}),jsx(Br,{task:L,isOpen:!!L,onClose:()=>ge(null),onTaskUpdate:q=>{a.onTaskUpdate?.(q),ge(q);},theme:H==="dark"?"dark":"light",locale:A,availableUsers:t.availableUsers?.map(q=>({id:q.id,name:q.name,avatar:q.avatar,initials:q.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:u,onCreateTag:i,attachments:L?c?.get(L.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:kp(e).filter(q=>q.id!==L?.id),comments:d?.filter(q=>q.taskId===L?.id).map(q=>({...q,createdAt:q.createdAt instanceof Date?q.createdAt:new Date(q.createdAt),updatedAt:q.updatedAt instanceof Date?q.updatedAt:q.updatedAt?new Date(q.updatedAt):void 0})),onAddComment:p,currentUser:f,mentionableUsers:v,onUploadCommentAttachments:k,enableTimeTracking:y,timeTrackingSummary:h,timeEntries:b,isTimerRunning:x?.isRunning,timerElapsedSeconds:x?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:N,onSoldEffortUpdate:C,onTimerStart:w,onTimerStop:R,onTimerDiscard:F,blurFinancials:T}),jsx(AnimatePresence,{children:ee&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ke(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:m("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",j?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:m("px-4 py-3 border-b flex items-center justify-between",j?"border-white/10":"border-gray-200"),children:[jsx("span",{className:m("font-medium",j?"text-white":"text-gray-900"),children:ee.date.toLocaleDateString(A==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ke(null),className:m("p-1 rounded",j?"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:ee.events.map(q=>jsxs("button",{onClick:()=>{Ke(null),ge(q.task),g?.(q.task.id);},className:m("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",j?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx(wp,{task:q.task}),jsx("span",{className:m("text-sm truncate flex-1",j?"text-white":"text-gray-900"),children:q.title}),q.task.priority==="high"||q.task.priority==="urgent"?jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"}):null]},q.id))})]})]})})]})}var rd={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"},od={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"},nd={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"},Xs={dark:rd,light:od,neutral:nd};function Np(e){return Xs[e]||Xs.dark}function Jx({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:o,onUnstack:s,onDeleteStack:n,className:l}){let[u,i]=useState(false),c=useMemo(()=>t.filter(f=>e.cardIds.includes(f.id)),[t,e.cardIds]),d=useMemo(()=>{let f=c.length,v=new Set(c.flatMap(y=>y.assignedUserIds||[])).size,k=c.map(y=>y.priority).filter(Boolean),g=new Set(c.flatMap(y=>y.labels||[])).size;return {totalCards:f,uniqueAssignees:v,priorities:k,labels:g}},[c]),p=()=>{o?.(e.id);};return jsxs("div",{className:m("card-stack",!e.isExpanded&&"card-stack-collapsed",l),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:p,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:m("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"]})]}),u&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:f=>{f.stopPropagation(),n?.(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:c.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:c.map(f=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(f),children:a(f)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(f),children:[jsx("h4",{children:f.title}),f.description&&jsxs("p",{children:[f.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:v=>{v.stopPropagation(),s?.(e.id,f.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"})]})})]},f.id))})})]})}var Sp={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Rn(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 On(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 Ep(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 Pp({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:o,selectedEventId:s,config:n,className:l}){let u=useMemo(()=>({...Sp,...n}),[n]),[i,c]=useState(new Set),d=useRef(null),p=useMemo(()=>{if(!u.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(b=>{let x=b.timestamp.toISOString().split("T")[0],D=h.get(x);D?D.push(b):h.set(x,[b]);}),Array.from(h.entries()).sort((b,x)=>x[0].localeCompare(b[0])).map(([b,x])=>({date:new Date(b),events:x.sort((D,N)=>N.timestamp.getTime()-D.timestamp.getTime())}))},[e,u.groupByDay]),{uniqueUsers:f,uniqueTypes:v}=useMemo(()=>{let h=new Set,b=new Set;return e.forEach(x=>{h.add(x.userId),b.add(x.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(b)}},[e]),k=h=>{c(b=>{let x=new Set(b);return x.has(h)?x.delete(h):x.add(h),x});},g=h=>{let x=new Date().getTime()-h.getTime(),D=Math.floor(x/6e4),N=Math.floor(x/36e5),C=Math.floor(x/864e5);return D<1?"just now":D<60?`${D}m ago`:N<24?`${N}h ago`:C<7?`${C}d ago`:h.toLocaleDateString()},y=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&d.current){let h=d.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:m("history-timeline-empty",l),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:m("history-timeline",u.compact&&"compact",l),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:h=>{let b=h.target.value;a({...t,types:b?[b]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),v.map(h=>jsxs("option",{value:h,children:[On(h)," ",h.replace("_"," ")]},h))]}),f.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let b=h.target.value;a({...t,users:b?[b]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),f.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),y>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",y,")"]})]}),jsx("div",{className:"history-timeline-container",ref:d,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[u.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((b,x)=>{let D=i.has(b.id),N=s===b.id,C=Ep(b.type);return jsxs("div",{"data-event-id":b.id,className:m("history-timeline-event",D&&"expanded",N&&"selected"),onClick:()=>o?.(b),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:C},children:u.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:On(b.type)})}),x<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:C}})]}),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:[u.showAvatars&&b.userAvatar&&jsx("img",{src:b.userAvatar,alt:b.userName||b.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:b.userName||b.userId}),jsx("span",{className:"history-timeline-event-action",children:Rn(b)})]})]}),jsx("div",{className:"history-timeline-event-time",children:u.useRelativeTime?g(b.timestamp):b.timestamp.toLocaleString()})]}),Object.keys(b.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:w=>{w.stopPropagation(),k(b.id);},children:[D?"\u25BC":"\u25B6"," Show changes"]}),D&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(b.changes).map(([w,R])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[w,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(R.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(R.to)})]})]},w)),b.metadata&&Object.keys(b.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(b.metadata).map(([w,R])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[w,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(R)})]},w))]})]})]})]},b.id)})})]},h.date?.toISOString()||"all"))})]})}function Fp({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:o,onPrevious:s,onNext:n,onGoToEvent:l,onSpeedChange:u,className:i}){let c=[.5,1,1.5,2,3],d=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),p=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:m("history-replay-empty",i),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:m("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:d&&On(d.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:d&&Rn(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:f=>l(parseInt(f.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((f,v)=>jsx("div",{className:m("history-replay-progress-marker",v===e.currentIndex&&"active"),style:{left:`${v/(e.totalEvents-1)*100}%`},onClick:()=>l(v),title:Rn(f)},f.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:n,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:c.map(f=>jsxs("button",{className:m("history-replay-speed-btn",e.speed===f&&"active"),onClick:()=>u(f),children:[f,"x"]},f))})]}),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(f=>jsx("span",{className:"history-replay-card-preview-label-tag",children:f},f))})]})]})]})]}):jsxs("div",{className:m("history-replay-start",i),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 sd(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 id(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 Ap(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 Lp(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function r2(e,t,a,r,o,s=100){let n=e.map(u=>({...u,x:u.x??a/2+Math.random()*100-50,y:u.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(n.map(u=>[u.id,u]));for(let u=0;u<s;u++){let i=1-u/s;n.forEach(c=>{let d=a/2,p=r/2;c.vx+=(d-c.x)*o.centerForce*i,c.vy+=(p-c.y)*o.centerForce*i,n.forEach(f=>{if(c.id===f.id)return;let v=c.x-f.x,k=c.y-f.y,g=Math.sqrt(v*v+k*k)||1,y=o.chargeStrength*i/(g*g);c.vx+=v/g*y,c.vy+=k/g*y;});}),t.forEach(c=>{let d=l.get(typeof c.source=="string"?c.source:c.source.id),p=l.get(typeof c.target=="string"?c.target:c.target.id);if(!d||!p)return;let f=p.x-d.x,v=p.y-d.y,k=Math.sqrt(f*f+v*v)||1,g=(k-o.linkDistance)/k*o.forceStrength*i;d.vx+=f*g,d.vy+=v*g,p.vx-=f*g,p.vy-=v*g;}),n.forEach(c=>{c.fx!==null&&c.fx!==void 0?(c.x=c.fx,c.vx=0):c.x+=c.vx,c.fy!==null&&c.fy!==void 0?(c.y=c.fy,c.vy=0):c.y+=c.vy,c.x=Math.max(o.nodeSize,Math.min(a-o.nodeSize,c.x)),c.y=Math.max(o.nodeSize,Math.min(r-o.nodeSize,c.y)),c.vx*=.9,c.vy*=.9;});}return n}function Ip({nodes:e,edges:t,config:a,filter:r,onFilterChange:o,criticalPath:s,stats:n,onInteraction:l,className:u}){let i=useRef(null),[c,d]=useState([]),[p,f]=useState(null),[v,k]=useState(null),[g,y]=useState(null),[h,b]=useState(1),[x,D]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let A=r2(e,t,a.width,a.height,a,150);d(A);},[e,t,a]);let N=useCallback((A,se)=>{a.enableDragging&&(se.stopPropagation(),f(A));},[a.enableDragging]),C=useCallback(A=>{if(!p||!i.current)return;let S=i.current.getBoundingClientRect(),j=(A.clientX-S.left-x.x)/h,ie=(A.clientY-S.top-x.y)/h;d(Ae=>Ae.map(L=>L.id===p?{...L,x:j,y:ie,fx:j,fy:ie}:L));},[p,h,x]),w=useCallback(()=>{f(null);},[]),R=useCallback((A,se)=>{se.stopPropagation(),l?.({type:"node-click",node:A,position:{x:se.clientX,y:se.clientY}});},[l]),F=useCallback((A,se)=>{se.stopPropagation(),l?.({type:"edge-click",edge:A,position:{x:se.clientX,y:se.clientY}});},[l]),T=useCallback(A=>{let se=c.find(S=>S.id===A);return se?{x:se.x,y:se.y}:{x:0,y:0}},[c]),H=useCallback(A=>{if(A.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return A.card.columnId==="done"?"#10b981":"#3b82f6";case "priority":let se=A.card.priority;return se==="URGENT"?"#ef4444":se==="HIGH"?"#f59e0b":se==="MEDIUM"?"#3b82f6":"#6b7280";case "assignee":return A.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#3b82f6"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:m("relationships-graph-empty",u),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:m("relationships-graph",u),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:n.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:n.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:()=>b(A=>Math.min(A+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>b(A=>Math.max(A-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{b(1),D({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(A=>A.type))).map(A=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:sd(A)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Ap(A)," ",id(A)]})]},A))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:C,onMouseUp:w,onMouseLeave:w,children:[jsxs("g",{transform:`translate(${x.x}, ${x.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(A=>{let se=T(typeof A.source=="string"?A.source:A.source.id),S=T(typeof A.target=="string"?A.target:A.target.id),j=Lp(A.type),ie=g===A.id,Ae=A.onCriticalPath;return jsxs("g",{className:m("relationships-graph-edge",ie&&"hovered",Ae&&"critical"),onMouseEnter:()=>y(A.id),onMouseLeave:()=>y(null),onClick:L=>F(A,L),children:[jsx("line",{x1:se.x,y1:se.y,x2:S.x,y2:S.y,stroke:sd(A.type),strokeWidth:Ae?a.edgeWidth*2:a.edgeWidth,strokeOpacity:ie?1:.6,markerEnd:j?"url(#arrowhead)":void 0}),a.showEdgeLabels&&ie&&jsx("text",{x:(se.x+S.x)/2,y:(se.y+S.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:id(A.type)})]},A.id)})}),jsx("g",{className:"relationships-graph-nodes",children:c.map(A=>{let se=v===A.id,S=A.onCriticalPath;return jsxs("g",{className:m("relationships-graph-node",se&&"hovered",S&&"critical"),transform:`translate(${A.x}, ${A.y})`,onMouseDown:j=>N(A.id,j),onMouseEnter:()=>k(A.id),onMouseLeave:()=>k(null),onClick:j=>R(A,j),children:[jsx("circle",{r:S?a.nodeSize*1.2:a.nodeSize,fill:H(A),stroke:S?"#fbbf24":"#ffffff",strokeWidth:S?3:2,opacity:se?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:A.card.title.length>20?A.card.title.substring(0,20)+"...":A.card.title})]},A.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 Op({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:o}){let[s,n]=useState(""),[l,u]=useState(false),[i,c]=useState(null),[d,p]=useState(null),f=useRef(null),v=l||o;useEffect(()=>{e&&f.current&&f.current.focus();},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&!v&&k();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,v]);let k=()=>{v||(n(""),c(null),p(null),t());},g=async()=>{if(!(!s.trim()||v)){u(true),c(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){c(h instanceof Error?h.message:"Failed to generate plan");}finally{u(false);}}},y=()=>{d&&(a(d),k());};return e?jsxs(wt,{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-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:h=>h.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:k,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((h,b)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},b))})]}),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((h,b)=>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:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:h.priority})]})},b)),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:f,value:s,onChange:h=>n(h.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."})]}),i&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:i}),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((h,b)=>jsx("button",{onClick:()=>n(h),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:h},b))})]})]})}),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:k,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:y,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:g,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 ld={"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 n2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},s2={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 i2(e,t,a){let r=ld[e];if(!r)throw new Error(`Unknown model: ${e}`);let o=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return o+s}function $n(e){return `$${e.toFixed(4)}`}var dd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=i2(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,p)=>d+p.cost,0),s=a.reduce((d,p)=>d+p.inputTokens,0),n=a.reduce((d,p)=>d+p.outputTokens,0),l=a.filter(d=>d.success),u=a.reduce((d,p)=>d+p.duration,0),i={},c={};return a.forEach(d=>{i[d.feature]=(i[d.feature]||0)+1,c[d.feature]=(c[d.feature]||0)+d.cost;}),{totalOperations:r,totalCost:o,totalInputTokens:s,totalOutputTokens:n,operationsByFeature:i,costsByFeature:c,averageDuration:r>0?u/r:0,successRate:r>0?l.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,n=new Date;a==="month"?n.setMonth(s.getMonth()-1):n.setDate(s.getDate()-1);let l=this.operations.filter(c=>c.timestamp>=n).length,u=Math.max(0,o-l),i=l/o*100;return {used:l,limit:o,remaining:u,percentUsed:i,isExceeded:l>=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)}},Eo=new dd;function Up({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,o]=useState(Eo.getStats()),[s,n]=useState(Eo.checkLimit(a));if(useEffect(()=>{if(!e)return;let u=setInterval(()=>{o(Eo.getStats()),n(Eo.checkLimit(a));},1e3);return ()=>clearInterval(u)},[e,a]),useEffect(()=>{let u=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)},[e,t]),!e)return null;let l=Eo.getRecentOperations(5);return jsxs(wt,{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:u=>u.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:$n(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(([u,i])=>{let c=r.costsByFeature[u]||0,d=r.totalOperations>0?i/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:u.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[i," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:$n(c)})]})]}),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}%`}})})]},u)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),l.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:l.map(u=>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:u.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(u.timestamp).toLocaleTimeString()," \u2022"," ",u.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[u.inputTokens+u.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:$n(u.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${u.success?"bg-green-400":"bg-red-400"}`})]})]},u.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 Gp({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:o,projectName:s}){let[n,l]=useState(""),[u,i]=useState(""),[c,d]=useState(""),[p,f]=useState(false),[v,k]=useState(null),[g,y]=useState(null),[h,b]=useState(null),x=useRef(null),D=p||o;useEffect(()=>{e&&x.current&&x.current.focus();},[e]),useEffect(()=>{let F=T=>{T.key==="Escape"&&!D&&N();};if(e)return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[e,D]);let N=()=>{D||(l(""),i(""),d(""),k(null),y(null),b(null),t());},C=async()=>{if(!(!n.trim()||D)){f(true),k(null),y(null),b(null);try{let F=await r({prompt:n.trim(),projectName:s||"Mi Proyecto",startDate:u||void 0,endDate:c||void 0});y(F.tasks.tasks),b({from_cache:F.from_cache,tokens_used:F.tokens_used,mock_mode:F.mock_mode,similarity:F.similarity,tokens_saved:F.tokens_saved});}catch(F){k(F instanceof Error?F.message:"Failed to generate tasks");}finally{f(false);}}},w=()=>{g&&(a(g),N());};if(!e)return null;let R=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(wt,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:N}),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:F=>F.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:N,disabled:D,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:g?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:[h?.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"}),h?.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 (",R,"% 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:[h?.tokens_used||0," tokens"]}),h?.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:[h.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:[g.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:g.map((F,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:["#",T+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:F.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"})]}),F.start," \u2192 ",F.end]}),jsxs("span",{children:[F.duration," days"]}),F.dependencies.length>0&&jsxs("span",{className:"text-blue-400",children:["Depends: ",F.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${F.priority==="high"?"bg-red-500/20 text-red-400":F.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-blue-500/20 text-blue-400"}`,children:F.priority})]})},F.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:x,value:n,onChange:F=>l(F.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:D}),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:u,onChange:F=>i(F.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:D})]}),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:c,onChange:F=>d(F.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:D})]})]}),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((F,T)=>jsx("button",{onClick:()=>l(F),disabled:D,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:F},T))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:D&&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:N,disabled:D,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),g?jsx("button",{onClick:w,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:C,disabled:!n.trim()||D,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:D?"Generating...":"Generate Tasks"})]})]})]})})]})}function Qs({initialBoard:e,onPersist:t}){let[a,r]=useState(e),o=useCallback(g=>{t&&Kn(()=>Promise.resolve(t(g)),{maxAttempts:3,initialDelay:1e3,onRetry:(y,h,b)=>{console.warn(`Retry attempt ${h} after ${b}ms: ${y.message}`);}}).then(y=>{y.success||console.error(`Failed to persist board after ${y.attempts} attempts:`,y.error);});},[t]),s=useCallback(async(g,y,h)=>{r(b=>{let x=b.cards.find(F=>F.id===g);if(!x)return b;let D=x.columnId,N={...x,columnId:y,position:h},C=b.cards.map(F=>F.id===g?N:F),w=b.columns.map(F=>{if(F.id===D)return {...F,cardIds:F.cardIds.filter(T=>T!==g)};if(F.id===y){let T=C.filter(H=>H.columnId===y).sort((H,A)=>H.position-A.position);return {...F,cardIds:T.map(H=>H.id)}}return F}),R={...b,cards:C,columns:w};return o(R),R});},[o]),n=useCallback(async(g,y)=>{r(h=>{let b=h.cards.map(D=>D.id===g?{...D,...y}:D),x={...h,cards:b};return o(x),x});},[o]),l=useCallback(async g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y},x=h.columns.map(N=>N.id===g.columnId?{...N,cardIds:[...N.cardIds,y]}:N),D={...h,cards:[...h.cards,b],columns:x};return o(D),D});},[o]),u=useCallback(async g=>{r(y=>{let h=y.cards.find(N=>N.id===g);if(!h)return y;let b=y.cards.filter(N=>N.id!==g),x=y.columns.map(N=>N.id===h.columnId?{...N,cardIds:N.cardIds.filter(C=>C!==g)}:N),D={...y,cards:b,columns:x};return o(D),D});},[o]),i=useCallback(async g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let b={...g,id:y,cardIds:[]},x={...h,columns:[...h.columns,b]};return o(x),x});},[o]),c=useCallback(async(g,y)=>{r(h=>{let b=h.columns.map(D=>D.id===g?{...D,...y}:D),x={...h,columns:b};return o(x),x});},[o]),d=useCallback(async g=>{r(y=>{let h=y.cards.filter(D=>D.columnId!==g),b=y.columns.filter(D=>D.id!==g),x={...y,cards:h,columns:b};return o(x),x});},[o]),p=useCallback(g=>{let y=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(g),y},[l]),f=useCallback(g=>{let y=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(g),y},[i]),v=useCallback(()=>{r(g=>{let y={...g,cards:[],columns:[]};return o(y),y});},[o]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:n,onCardCreate:l,onCardDelete:u,onColumnCreate:i,onColumnUpdate:c,onColumnDelete:d},setBoard:r,helpers:{addCard:p,addColumn:f,deleteCard:u,deleteColumn:d,clearBoard:v}}}function _p({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:o,helpers:s}=Qs({initialBoard:e,onPersist:a}),n=useMemo(()=>({addCard:(u,i,c={})=>{s.addCard({title:i,columnId:u,position:r.cards.filter(d=>d.columnId===u).length,...c});},addColumn:(u,i)=>{let c=r.columns.length>0?Math.max(...r.columns.map(d=>d.position)):0;s.addColumn({title:u,position:i??c+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:n}}var zn={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Kp={by:"none",order:"asc"};function qp({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,o]=useState({...zn,...e}),[s,n]=useState({...Kp,...t}),l=useCallback(k=>{o(g=>({...g,...k}));},[]),u=useCallback(k=>{n(g=>({...g,...k}));},[]),i=useCallback(()=>{o(zn),n(Kp);},[]),c=useCallback(()=>{a&&o({...zn,assignees:[a]});},[a]),d=useCallback(()=>{o({...zn,dateFilter:"overdue"});},[]),p=useCallback(()=>{o({...zn,priorities:["HIGH","URGENT"]});},[]),f=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(k=>{let g=[...k];if(r.search){let y=r.search.toLowerCase();g=g.filter(h=>h.title.toLowerCase().includes(y)||h.description?.toLowerCase().includes(y));}if(r.dateFilter!=="all"){let y=new Date,h=y.getFullYear(),b=String(y.getMonth()+1).padStart(2,"0"),x=String(y.getDate()).padStart(2,"0"),D=`${h}-${b}-${x}`;g=g.filter(N=>{if(!N.endDate&&!N.dueDate)return false;let C=N.endDate||N.dueDate;if(!C)return false;let w;if(typeof C=="string")w=C.split("T")[0]||C;else {let R=C.getUTCFullYear(),F=String(C.getUTCMonth()+1).padStart(2,"0"),T=String(C.getUTCDate()).padStart(2,"0");w=`${R}-${F}-${T}`;}switch(r.dateFilter){case "overdue":return w<D;case "today":return w===D;case "this-week":let R=new Date(D+"T00:00:00"),F=new Date(w+"T00:00:00"),T=new Date(R);return T.setDate(T.getDate()+7),F>=R&&F<=T;case "custom":if(r.dateRange){let H=typeof C=="string"?new Date(C):C;return H>=r.dateRange.start&&H<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(g=g.filter(y=>y.priority&&r.priorities.includes(y.priority))),r.assignees.length>0&&(g=g.filter(y=>(y.assignedUserIds||(y.assigneeId?[y.assigneeId]:[])).some(b=>r.assignees.includes(b)))),r.labels.length>0&&(g=g.filter(y=>y.labels&&y.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(g=g.filter(y=>r.columns.includes(y.columnId))),s.by!=="none"&&g.sort((y,h)=>{let b=0;switch(s.by){case "created":let x=y.createdAt?new Date(y.createdAt).getTime():0,D=h.createdAt?new Date(h.createdAt).getTime():0;b=x-D;break;case "priority":let N={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},C=N[y.priority||"LOW"],w=N[h.priority||"LOW"];b=C-w;break;case "dueDate":let R=y.endDate||y.dueDate,F=h.endDate||h.dueDate;if(!R)return 1;if(!F)return -1;let T=typeof R=="string"?new Date(R).getTime():R.getTime(),H=typeof F=="string"?new Date(F).getTime():F.getTime();b=T-H;break;case "title":b=y.title.localeCompare(h.title);break;case "estimate":let A=y.estimatedTime||0,se=h.estimatedTime||0;b=A-se;break;default:b=0;}return s.order==="asc"?b:-b}),g},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:u,resetFilters:i,filterMyTasks:c,filterOverdue:d,filterHighPriority:p,applyFilters:v,hasActiveFilters:f}}var Xp,Jp;if(typeof window<"u")try{let e=Vn("ai");Xp=e.generateObject,Jp=e.generateText;}catch{}function Zp(e={}){let[t,a]=useState(false),[r,o]=useState(null),s=!!(Xp&&Jp&&e.apiKey),n=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(p){let f=p instanceof Error?p:new Error("Failed to generate plan");throw o(f),f}finally{a(false);}},[s]),l=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(p){let f=p instanceof Error?p:new Error("Failed to suggest assignee");throw o(f),f}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("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(p){let f=p instanceof Error?p:new Error("Failed to predict risks");throw o(f),f}finally{a(false);}},[s]),i=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(p){let f=p instanceof Error?p:new Error("Failed to generate subtasks");throw o(f),f}finally{a(false);}},[s]),c=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(p){let f=p instanceof Error?p:new Error("Failed to estimate effort");throw o(f),f}finally{a(false);}},[s]);return {onGeneratePlan:n,onSuggestAssignee:l,onPredictRisks:u,onGenerateSubtasks:i,onEstimateEffort:c,isAvailable:s,isLoading:t,error:r}}function ud(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(o=>{t(o);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Qp(e){let{cards:t}=e,[a,r]=ud(),o=useCallback(d=>a.selectedCardIds.includes(d),[a.selectedCardIds]),s=useCallback((d,p)=>{if(!p){r({selectedCardIds:[d],lastSelectedCardId:d});return}let f=p.ctrlKey||p.metaKey,v=p.shiftKey;if(f)a.selectedCardIds.includes(d)?r({selectedCardIds:a.selectedCardIds.filter(k=>k!==d),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});else if(v&&a.lastSelectedCardId){let k=t.find(y=>y.id===d),g=t.find(y=>y.id===a.lastSelectedCardId);if(k&&g&&k.columnId===g.columnId){let y=t.filter(w=>w.columnId===k.columnId).sort((w,R)=>w.position-R.position),h=y.findIndex(w=>w.id===a.lastSelectedCardId),b=y.findIndex(w=>w.id===d),[x,D]=h<b?[h,b]:[b,h],N=y.slice(x,D+1).map(w=>w.id),C=Array.from(new Set([...a.selectedCardIds,...N]));r({selectedCardIds:C,lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});}else r({selectedCardIds:[d],lastSelectedCardId:d});},[t,a,r]),n=useCallback(d=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==d),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),u=useCallback(()=>{r({selectedCardIds:t.map(d=>d.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(d=>{a.selectedCardIds.includes(d)?n(d):r({selectedCardIds:[...a.selectedCardIds,d],lastSelectedCardId:d});},[a,n,r]),c=useCallback(()=>t.filter(d=>a.selectedCardIds.includes(d.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:o,selectCard:s,deselectCard:n,clearSelection:l,selectAll:u,toggleCard:i,getSelectedCards:c}}var eg={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function tg(e){let{cards:t,config:a,aiService:r}=e,o=useMemo(()=>({...eg,...a}),[a]),[s,n]=useState([]),l=useCallback((k,g,y,h,b)=>{if(g.length<o.minCardsPerStack){console.warn(`Cannot create stack: minimum ${o.minCardsPerStack} cards required`);return}let x={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:k,cardIds:g,columnId:y,strategy:h,color:b,isExpanded:true,position:s.filter(D=>D.columnId===y).length,createdAt:new Date};n(D=>[...D,x]);},[o.minCardsPerStack,s]),u=useCallback(k=>{n(g=>g.filter(y=>y.id!==k));},[]),i=useCallback(k=>{n(g=>g.map(y=>y.id===k?{...y,isExpanded:!y.isExpanded}:y));},[]),c=useCallback((k,g)=>{n(y=>y.map(h=>h.id===k&&!h.cardIds.includes(g)?{...h,cardIds:[...h.cardIds,g]}:h));},[]),d=useCallback((k,g)=>{n(y=>y.map(h=>{if(h.id===k){let b=h.cardIds.filter(x=>x!==g);return b.length<o.minCardsPerStack?null:{...h,cardIds:b}}return h}).filter(h=>h!==null));},[o.minCardsPerStack]),p=useCallback(k=>s.filter(g=>g.columnId===k).sort((g,y)=>g.position-y.position),[s]),f=useCallback(async k=>{let g=t.filter(D=>D.columnId===k);if(g.length<o.minCardsPerStack*2)return [];let y=[],h=new Map;g.forEach(D=>{D.labels&&D.labels.length>0&&D.labels.forEach(N=>{h.has(N)||h.set(N,[]),h.get(N).push(D);});}),h.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F4CC} ${N}`,cardIds:D.map(C=>C.id),columnId:k,strategy:"labels",color:"#3b82f6"},reason:`${D.length} cards with label "${N}"`,confidence:.85});});let b=new Map;g.forEach(D=>{D.assignedUserIds&&D.assignedUserIds.length>0&&D.assignedUserIds.forEach(N=>{b.has(N)||b.set(N,[]),b.get(N).push(D);});}),b.forEach((D,N)=>{D.length>=o.minCardsPerStack&&y.push({stack:{title:`\u{1F464} Assigned to user-${N.slice(-4)}`,cardIds:D.map(C=>C.id),columnId:k,strategy:"assignee",color:"#8b5cf6"},reason:`${D.length} cards assigned to the same user`,confidence:.8});});let x=new Map;if(g.forEach(D=>{D.priority&&(x.has(D.priority)||x.set(D.priority,[]),x.get(D.priority).push(D));}),x.forEach((D,N)=>{if(D.length>=o.minCardsPerStack){let C={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[N.toLowerCase()]||"\u26AA";y.push({stack:{title:`${C} ${N} Priority`,cardIds:D.map(w=>w.id),columnId:k,strategy:"priority",color:N==="high"||N==="urgent"?"#ef4444":"#10b981"},reason:`${D.length} cards with ${N} priority`,confidence:.75});}}),r&&o.enableAutoStacking)for(let D of g){let C=(await r.findSimilar(D,g)).filter(w=>w.similarity>=o.autoStackConfidenceThreshold);if(C.length>=o.minCardsPerStack-1){let w=[D.id,...C.map(F=>F.card.id)],R=C.reduce((F,T)=>F+T.similarity,0)/C.length;y.push({stack:{title:`\u2728 Similar to "${D.title.substring(0,30)}${D.title.length>30?"...":""}"`,cardIds:w,columnId:k,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${C.length+1} similar tasks`,confidence:R});}}return y.filter(D=>D.confidence>=o.autoStackConfidenceThreshold).sort((D,N)=>N.confidence-D.confidence).slice(0,5)},[t,o,r]),v=useCallback(k=>{l(k.stack.title,k.stack.cardIds,k.stack.columnId,k.stack.strategy,k.stack.color);},[l]);return useEffect(()=>{o.enableAutoStacking&&s.length===0&&new Set(t.map(g=>g.columnId)).forEach(async g=>{let y=await f(g),h=y[0];y.length>0&&h&&h.confidence>=.9&&v(h);});},[]),{stacks:s,createStack:l,deleteStack:u,toggleStack:i,addToStack:c,removeFromStack:d,getStacksForColumn:p,getSuggestions:f,applySuggestion:v,config:o}}var ag=createContext(null);function rg({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,n=new Map;t?.columns?.forEach(u=>{let{Column:i}=Vn("@libxai/core");s.set(u.id,new i(u));}),t?.cards?.forEach(u=>{let{Card:i}=Vn("@libxai/core");n.set(u.id,new i(u));});let l=null;if(t?.board){let{Board:u}=Vn("@libxai/core");l=new u(t.board);}r.current=new BoardStore({board:l,columns:s,cards:n});}let o=r.current;return useEffect(()=>{if(a)return o.subscribeAll(s=>{a(o.getState());})},[o,a]),jsx(ag.Provider,{value:{store:o},children:e})}function ei(){let e=useContext(ag);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Hn(){let e=ei(),[t,a]=useState(e.getBoard()),[r,o]=useState(e.getAllColumns()),[s,n]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),o(e.getAllColumns()),n(e.getAllCards());}),[e]);let l=useCallback(h=>{e.updateBoard(h);},[e]),u=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,b)=>{e.updateColumn(h,b);},[e]),c=useCallback(h=>{e.deleteColumn(h);},[e]),d=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),f=useCallback((h,b)=>{e.updateCard(h,b);},[e]),v=useCallback(h=>{e.deleteCard(h);},[e]),k=useCallback((h,b,x)=>{e.moveCard(h,b,x);},[e]),g=useCallback(h=>e.getCard(h),[e]),y=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:u,updateColumn:i,deleteColumn:c,getColumn:d,addCard:p,updateCard:f,deleteCard:v,moveCard:k,getCard:g,getCardsByColumn:y}}function ng(e){let{cards:t}=Hn();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 sg(e="position",t="asc"){let{cards:a}=Hn();return useMemo(()=>[...a].sort((o,s)=>{let n=0;switch(e){case "title":n=o.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},u=o.priority?l[o.priority]:0,i=s.priority?l[s.priority]:0;n=u-i;break}case "createdAt":n=o.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":n=o.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":n=o.position-s.position;break}return t==="asc"?n:-n}),[a,e,t])}var ti=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Vd.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 n=s[t];if(typeof n=="function")try{let l=await Promise.resolve(n.apply(s,a));l!==void 0&&(o=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{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(n=>{this.pluginLogger.error(`Plugin hook failed: ${o.id}.${t}`,n,{plugin:o.id,hook:t});}));}await Promise.all(r);}},T2=new ti;function lg({items:e,height:t,estimateSize:a,renderItem:r,className:o="",overscan:s=5,horizontal:n=false,gap:l=0,getItemKey:u}){let i=useRef(null),c=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:n,gap:l}),d=c.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},f=n?{width:`${c.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${c.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:o,children:jsx("div",{style:f,children:d.map(v=>{let k=e[v.index];if(!k)return null;let g=u?u(k,v.index):v.index,y={position:"absolute",top:n?0:v.start,left:n?v.start:0,width:n?v.size:"100%",height:n?"100%":v.size};return jsx("div",{style:y,"data-index":v.index,children:r(k,v.index)},g)})})})}function dg(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 ug({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:o,className:s="",overscan:n=3,gap:l=16,getItemKey:u,horizontal:i=true}){let c=useRef(null),d=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>c.current,estimateSize:()=>r,overscan:n,gap:l}),p=d.getVirtualItems(),f={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:c,style:f,className:s,children:jsx("div",{style:v,children:p.map(k=>{let g=e[k.index];if(!g)return null;let y=u?u(g,k.index):k.index,h={position:"absolute",top:0,left:k.start,width:k.size,height:"100%"};return jsx("div",{style:h,"data-index":k.index,children:o(g,k.index)},y)})})})}function mg(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 pg(e,t=10){return e>t}var fd={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},hd={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},bd={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},yd={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},vd={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},xd={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},kd={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},wd={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)"},Cd={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)"},Td={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Nd={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}},Dd={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}},ai={spacing:fd,borderRadius:hd,fontSize:bd,fontWeight:yd,lineHeight:vd,zIndex:xd,duration:kd,easing:wd,shadows:Cd,opacity:Td,kanban:Nd,gantt:Dd};function gg(e,t,a){return e[t]??a}function Sd(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)?Sd(o,s,a):(typeof o=="string"||typeof o=="number")&&(a[s]=o);}return a}function S2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Ed(e="asakaa"){let t=Sd(ai),a=[];for(let[r,o]of Object.entries(t)){let s=`--${e}-${r}`,n=S2(o);a.push(` ${s}: ${n};`);}return `:root {
|
|
404
404
|
${a.join(`
|
|
405
405
|
`)}
|
|
406
|
-
}`}function
|
|
406
|
+
}`}function Wn(e,t="asakaa"){let a=[],r=Sd(e);for(let[o,s]of Object.entries(r)){let n=`--${t}-color-${o}`;a.push(` ${n}: ${s};`);}return `:root {
|
|
407
407
|
${a.join(`
|
|
408
408
|
`)}
|
|
409
|
-
}`}var
|
|
409
|
+
}`}var ri={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"}},Pd={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"}},Md={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 Fd(e=ri,t="asakaa"){let a=Ed(t),r=Wn(e,t);return `${a}
|
|
410
410
|
|
|
411
411
|
${r}`}function fg(){return `/**
|
|
412
412
|
* ASAKAA Design Tokens
|
|
@@ -414,21 +414,21 @@ ${r}`}function fg(){return `/**
|
|
|
414
414
|
* Do not edit this file directly
|
|
415
415
|
*/
|
|
416
416
|
|
|
417
|
-
${
|
|
417
|
+
${Fd(ri)}
|
|
418
418
|
|
|
419
419
|
/* Light theme */
|
|
420
420
|
[data-theme="light"] {
|
|
421
|
-
${
|
|
421
|
+
${Wn(Pd,"asakaa").split(`
|
|
422
422
|
`).slice(1,-1).join(`
|
|
423
423
|
`)}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
/* Neutral theme */
|
|
427
427
|
[data-theme="neutral"] {
|
|
428
|
-
${
|
|
428
|
+
${Wn(Md,"asakaa").split(`
|
|
429
429
|
`).slice(1,-1).join(`
|
|
430
430
|
`)}
|
|
431
431
|
}
|
|
432
|
-
`}var E2=({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 hg({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=
|
|
433
|
-
export{Up as AIUsageDashboard,s2 as AI_FEATURES,
|
|
432
|
+
`}var E2=({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 hg({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:o,themes:s}=jo();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([n,l])=>{let u=n,i=u===r;return jsxs("button",{onClick:()=>o(u),className:`theme-switcher__button ${i?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${l.displayName} theme`,"aria-pressed":i,title:l.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(E2,{theme:u})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},u)})})}
|
|
433
|
+
export{Up as AIUsageDashboard,s2 as AI_FEATURES,ld as AI_MODELS,Ri as AddCardButton,Bi as AddColumnButton,Er as AttachmentUploader,rg as BoardProvider,gs as BulkOperationsToolbar,qi as BurnDownChart,pp as CUSTOM_FIELD_TYPES,Tp as CalendarBoard,Lr as Card,Wi as CardDetailModal,_i as CardDetailModalV2,Fp as CardHistoryReplay,Pp as CardHistoryTimeline,Ip as CardRelationshipsGraph,Jx as CardStack,tl as CardTemplateSelector,pi as CircuitBreaker,$o as Column,ks as ColumnManager,zi as CommandPalette,nl as ConfigMenu,Yo as ContextMenu,vn as DEFAULT_SHORTCUTS,up as DEFAULT_TABLE_COLUMNS,el as DEFAULT_TEMPLATES,nn as DateRangePicker,ln as DependenciesSelector,Dn as DependencyLine,Yi as DistributionCharts,ki as EditableColumnTitle,Wo as ErrorBoundary,rl as ExportImportModal,ol as FilterBar,om as GANTT_AI_SYSTEM_PROMPT,Ls as GanttAIAssistant,Qu as GanttBoard,qo as GanttI18nContext,Es as GanttMilestone,xs as GanttToolbar,Gp as GenerateGanttTasksDialog,Op as GeneratePlanModal,Zi as GroupBySelector,Ei as HealthBar,Yr as KanbanBoard,Li as KanbanToolbar,hn as KanbanViewAdapter,Qi as KeyboardShortcutsHelp,cp as ListView,Lt as MenuIcons,ti as PluginManager,po as PrioritySelector,Pi as ProfitabilityReport,n2 as RATE_LIMITS,mp as STANDARD_FIELDS,Xi as SwimlaneBoardView,Ci as TagBadge,Dc as TagList,Kr as TagPicker,Ds as TaskBar,Br as TaskDetailModal,rm as TaskFormModal,Ts as TaskGrid,dl as ThemeModal,ku as ThemeProvider,hg as ThemeSwitcher,yo as TimeInputPopover,Ti as TimePill,Ni as TimePopover,Ms as Timeline,fo as UserAssignmentSelector,Ki as VelocityChart,ug as VirtualGrid,lg as VirtualList,Eo as aiUsageTracker,hd as borderRadius,jn as calculatePosition,rd as calendarDarkTheme,Ql as calendarEnTranslations,ed as calendarEsTranslations,od as calendarLightTheme,nd as calendarNeutralTheme,Xs as calendarThemes,qs as calendarTranslations,Rs as cardToGanttTask,um as cardsToGanttTasks,m as cn,eu as createKanbanView,Vg as createRetryWrapper,sl as darkTheme,ri as darkTokenTheme,hs as defaultTheme,ai as designTokens,kd as duration,wd as easing,fg as exportTokensToCSS,Hr as findTaskByName,bd as fontSize,yd as fontWeight,$n as formatCost,ys as ganttEnTranslations,Cu as ganttEsTranslations,cm as ganttTaskToCardUpdate,st as ganttThemes,Dd as ganttTokens,cl as ganttTranslations,Ce as ganttUtils,Ed as generateCSSVariables,Fd as generateCompleteCSS,Ug as generateInitialPositions,nm as generateTasksContext,Wn as generateThemeVariables,Np as getCalendarTheme,In as getCalendarTranslations,gp as getListViewTheme,Rl as getListViewTranslations,fp as getMonthNames,gg as getToken,Tu as getTranslations,hp as getWeekdayNames,Nd as kanbanTokens,il as lightTheme,Pd as lightTokenTheme,vd as lineHeight,Xl as listViewDarkTheme,Il as listViewEnTranslations,Bl as listViewEsTranslations,Jl as listViewLightTheme,Zl as listViewNeutralTheme,Ks as listViewThemes,Os as listViewTranslations,Ys as mergeCalendarTranslations,$s as mergeListViewTranslations,ul as mergeTranslations,ll as neutralTheme,Md as neutralTokenTheme,Td as opacity,lm as parseLocalCommand,Fl as parseNaturalDate,Al as parseNaturalDuration,Ll as parseProgress,im as parseStatus,T2 as pluginManager,Gg as retrySyncOperation,Kn as retryWithBackoff,Cd as shadows,pg as shouldVirtualizeGrid,fd as spacing,ko as themes,Zp as useAI,_p as useBoard,Hn as useBoardCore,ei as useBoardStore,tg as useCardStacking,Fi as useDragState,ng as useFilteredCards,qp as useFilters,eo as useGanttI18n,Qs as useKanbanState,yu as useKeyboardShortcuts,Qp as useMultiSelect,ud as useSelectionState,sg as useSortedCards,jo as useTheme,mg as useVirtualGrid,dg as useVirtualList,dm as validateAIResponse,Oi as withErrorBoundary,Yn as wouldCreateCircularDependency,xd as zIndex};//# sourceMappingURL=index.js.map
|
|
434
434
|
//# sourceMappingURL=index.js.map
|