@libxai/board 1.9.6 → 1.9.7
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 +24 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +24 -24
- package/dist/index.js.map +1 -1
- package/dist/styles.css +30 -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 Qf 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,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Search,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,FileJson,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import yy from'react-markdown';import xy from'remark-gfm';import vy from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var
|
|
2
|
-
`)}async function tb(e,t,a){let r=t;if(!r){let o=document.querySelector(".asakaa-board");o&&(r=o.parentElement||o);}if(r)try{let o=await Qf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=o.toDataURL("image/png"),d=297,i=210,u=o.width/o.height,m=d-20,p=m/u;p>i-20&&(p=i-20,m=p*u);let g=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,d,15,"F"),g.text(e.title||"Kanban Board",10,10);let f=(d-m)/2;return g.addImage(l,"PNG",f,20,m,p),g}catch(o){console.error("Error capturing board:",o);}let n=new jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let l=e.cards.filter(d=>d.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):l.forEach(d=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(d.title,25,s),s+=6,d.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(d.description,160);n.text(u,25,s),s+=u.length*5;}let i=[];if(d.priority&&i.push(`Priority: ${d.priority}`),d.labels&&d.labels.length>0&&i.push(`Labels: ${d.labels.join(", ")}`),d.assignedUserIds&&d.assignedUserIds.length>0&&i.push(`Assigned: ${d.assignedUserIds.length} user(s)`),d.startDate||d.endDate){let u=[];d.startDate&&u.push(`Start: ${d.startDate}`),d.endDate&&u.push(`End: ${d.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}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=Mu(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=Mu(t[o]||"");if(l.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,f)=>{i[g]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let m=n.get(u),p={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:m.id,position:m.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),m.cardIds.push(p.id);}catch(l){s.push(`Line ${o+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:n.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 Mu(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Pu(e,t){switch(t){case "json":return ab(e);case "csv":return rb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Fu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var zl=createContext(null);function Au(){return useContext(zl)}var Lu=createContext(null);function Iu({children:e,themeName:t}){return jsx(Lu.Provider,{value:{themeName:t},children:e})}function Ln(){return useContext(Lu)}function ea({children:e,container:t}){let[a,r]=useState(false),n=Au(),s=Ln();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:d}=n,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":d,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var Hu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},ub="#BDC3C7",pb=({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 nn({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),l=useRef(null),d=useRef(null),i=()=>{if(!d.current)return;let g=d.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,y=160,b=220,h=4,v=g.right-y;v<10&&(v=g.left),v+y>x-10&&(v=x-y-10);let w=f-g.bottom,N=g.top,D;w>=b+h?D=g.bottom+h:N>=b+h?D=g.top-b-h:D=w>=N?g.bottom+h:Math.max(10,g.top-b-h),o({top:D,left:v}),n(true);};useEffect(()=>{let g=f=>{l.current&&!l.current.contains(f.target)&&!d.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),n(false);},m=e?Hu[e]:null,p=m?.color||ub;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:d,onClick:()=>r?n(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:m?.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(ea,{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(Hu).map(([g,f])=>jsxs("button",{onClick:()=>u(g),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:f.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(pb,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===g&&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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var mb=[{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 ms({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),d=useRef(null),i=useRef(null),p=(Ln()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,N=window.innerWidth,D=320,F=380,T=4,S=v.left;S+D>N-10&&(S=N-D-10),S<10&&(S=10);let P=w-v.bottom,k=v.top,j;P>=F+T?j=v.bottom+T:k>=F+T?j=v.top-F-T:j=P>=k?v.bottom+T:Math.max(10,v.top-F-T),l({top:j,left:S}),s(true);};useEffect(()=>{let v=w=>{d.current&&!d.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let f=v=>{let w=new Date,N=S=>{let P=S.getFullYear(),k=String(S.getMonth()+1).padStart(2,"0"),j=String(S.getDate()).padStart(2,"0");return `${P}-${k}-${j}`},D=N(w),F=new Date(w);F.setDate(F.getDate()+v);let T=N(F);a(D,T),s(false);},x=()=>{if(!e||!t)return "Set date";let v=F=>{if(F instanceof Date)return F;if(typeof F!="string"||!F.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=F.split("-").map(Number);if(T.length!==3||T.some(j=>isNaN(j)))return null;let S=T[0],P=T[1],k=T[2];return S===void 0||P===void 0||k===void 0?null:new Date(S,P-1,k)},w=v(e),N=v(t);if(!w||!N||isNaN(w.getTime())||isNaN(N.getTime()))return "Set date";let D=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${D[w.getMonth()]} ${w.getDate()} \u2013 ${D[N.getMonth()]} ${N.getDate()}`},y=e&&t,h=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>n?s(false):g(),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:y?`${x()}`:"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:x()})]}),n&&jsx(ea,{children:jsxs("div",{ref:d,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.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:mb.map(v=>jsx("button",{onClick:()=>f(v.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:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.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:v=>a(v.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:v=>a(e,v.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:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function ln({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[l,d]=useState(""),[i,u]=useState({top:0,left:0}),m=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,N=300,D=380,F=4,T=h.right-N;T<10&&(T=h.left),T+N>w-10&&(T=w-N-10);let S=v-h.bottom,P=h.top,k;S>=D+F?k=h.bottom+F:P>=D+F?k=h.top-D-F:k=S>=P?h.bottom+F:Math.max(10,h.top-D-F),u({top:k,left:T}),o(true);};useEffect(()=>{let h=v=>{m.current&&!m.current.contains(v.target)&&!p.current?.contains(v.target)&&(o(false),d(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=v=>{v.key==="Escape"&&(o(false),d(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let f=h=>{let v=e.some(w=>w.id===h.id);a(v?e.filter(w=>w.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),y=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?o(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[y.map(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)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):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(ea,{children:jsxs("div",{ref:m,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=>d(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:x.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"}):x.map(h=>{let v=e.some(w=>w.id===h.id);return jsxs("button",{onClick:()=>f(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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor: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:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),o(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 ui(e,t,a){let r=new Map;e.forEach(d=>{if(d.dependencies&&Array.isArray(d.dependencies)){let i=d.dependencies.map(u=>{if(typeof u=="string")return u;let m=u;return m.taskId||m.targetId||""}).filter(Boolean);r.set(d.id,i);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,l=d=>{if(!s.has(d)){s.add(d),o.add(d);let i=r.get(d)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))return true}}return o.delete(d),false};return l(a)}function fs({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,d]=useState(false),[i,u]=useState(""),[m,p]=useState(t.length>0),[g,f]=useState({top:0,left:0}),[x,y]=useState(null),b=useRef(null),h=useRef(null),v=()=>{if(!h.current)return;let T=h.current.getBoundingClientRect(),S=window.innerHeight,P=window.innerWidth,k=300,j=m?380:120,U=4,ae=T.right-k;ae<10&&(ae=T.left),ae+k>P-10&&(ae=P-k-10);let L=S-T.bottom,X=T.top,K;L>=j+U?K=T.bottom+U:X>=j+U?K=T.top-j-U:K=L>=X?T.bottom+U:Math.max(10,T.top-j-U),f({top:K,left:ae}),d(true);};useEffect(()=>{if(!l||!h.current)return;let T=h.current.getBoundingClientRect(),S=window.innerHeight,P=window.innerWidth,k=300,j=m?380:120,U=4,ae=T.right-k;ae<10&&(ae=T.left),ae+k>P-10&&(ae=P-k-10);let L=S-T.bottom,X=T.top,K;L>=j+U?K=T.bottom+U:X>=j+U?K=T.top-j-U:K=L>=X?T.bottom+U:Math.max(10,T.top-j-U),f({top:K,left:ae});},[m,l]),useEffect(()=>{let T=S=>{b.current&&!b.current.contains(S.target)&&!h.current?.contains(S.target)&&(d(false),u(""));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{let T=S=>{S.key==="Escape"&&(d(false),u(""));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]);let w=T=>{let S=t.includes(T),P=a.find(k=>k.id===T);if(y(null),S){let k=t.filter(j=>j!==T);r(k),k.length===0&&p(false);}else {if(s&&ui(a,T,e)){let j=`Cannot add "${P?.title||T}" as dependency - would create circular reference`;y(j),o?.(T,P?.title||T),setTimeout(()=>y(null),3e3);return}r([...t,T]),p(true);}},N=()=>{let T=!m;p(T),T||r([]);},D=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),F=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?d(false):v(),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:F,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:F},children:t.length})]}),l&&jsx(ea,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.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:[x&&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:x})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:m?"#00E5CC":"transparent",borderColor:m?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:m&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),m&&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:T=>u(T.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:D.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"}):D.map(T=>{let S=t.includes(T.id);return jsxs("button",{onClick:()=>w(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.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:S?"#00E5CC":"transparent",borderColor:S?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:S&&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:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),d(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 wo=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:d=[]})=>{let{attributes:i,listeners:u,setNodeRef:m,transform:p,transition:g,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:ii.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:m,style:x,...i,...u,onClick:()=>a?.(e),children:t(e)});let y=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:m,style:v,className:c("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:w=>{w.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:w=>{w.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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:D=>{D.currentTarget.style.display="none";}}),N===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]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.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:w=>w.stopPropagation(),className:"priority-selector",children:jsx(nn,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(ms,{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:(w,N)=>o?.(e.id,{startDate:w,endDate:N})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(ln,{assignedUsers:y,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(N=>N.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(fs,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:d,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),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:"#00E5CC"},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:"#00E5CC"}})})]})]})},(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&&e.render===t.render&&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)));wo.displayName="Card";var pi={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"}},Yu=({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 Xu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),d=useRef(null),i=useRef(null),u=[...Object.entries(pi).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...r.filter(y=>!Object.keys(pi).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let y=pi[e];if(y)return {...y,id:e};let b=r.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...pi.todo,id:"todo"}},p=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=180,w=280,N=4,D=y.right-v;D<10&&(D=y.left),D+v>h-10&&(D=h-v-10);let F=b-y.bottom,T=y.top,S;F>=w+N?S=y.bottom+N:T>=w+N?S=y.top-w-N:S=F>=T?y.bottom+N:Math.max(10,y.top-w-N),l({top:S,left:D}),s(true);};useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]);let g=y=>{t(y),s(false);},f=m(),x=f.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>n?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:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:f.label,children:jsx(Yu,{icon:f.icon,color:x})}),n&&jsx(ea,{children:jsxs("div",{ref:d,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:u.map(y=>jsxs("button",{onClick:()=>g(y.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(Yu,{icon:y.icon,color:y.color}),jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}var Ju={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function Qu({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Ju[s]||Ju.en,[l,d]=useState(false),[i,u]=useState(false),[m,p]=useState(e),[g,f]=useState({top:0,left:0}),x=useRef(null),y=useRef(null),b=useRef(null);useEffect(()=>{if(l&&y.current){let N=y.current.getBoundingClientRect();f({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),useEffect(()=>{let N=D=>{x.current&&!x.current.contains(D.target)&&!y.current?.contains(D.target)&&(d(false),u(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{let N=D=>{D.key==="Escape"&&(d(false),u(false),p(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{u(true),p(e);},v=()=>{let N=m.trim();N&&N!==e&&t(N),u(false),d(false),p(e);},w=N=>{N.key==="Enter"?v():N.key==="Escape"&&(u(false),p(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:y,onClick:()=>d(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,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"})]})}),l&&jsx(ea,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.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:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:m,onChange:N=>p(N.target.value),onKeyDown:w,onBlur:v,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-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,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:o.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),d(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var Rn=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:d,allCards:i,enableVirtualization:u,cardHeight:m=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:f,onColumnDelete:x,isDeletable:y=false,className:b,renderMetrics:h,locale:v})=>{let{setNodeRef:w,isOver:N}=useDroppable({id:e.id,data:{type:"column",column:e}}),D=useRef(null),F=u??Cu(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>D.current,estimateSize:()=>m,enabled:F});if(a)return jsx("div",{ref:w,className:b,children:a(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let U=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:U}:U>=80?{state:"warning",percentage:U}:U>=60?{state:"approaching",percentage:U}:{state:"ok",percentage:U}})(),k=P.state==="exceeded",j=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:c("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",k&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:c(j()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.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"})]}),P.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"})]}),P.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"})}),P.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"})]})]}),(f||x)&&jsx(Qu,{columnTitle:e.title,onRename:U=>f?.(e.id,U),onDelete:x?()=>x(e.id):void 0,isDeletable:y,locale:v}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!p&&jsx("div",{ref:D,className:"asakaa-column-cards",style:{maxHeight:F?"600px":void 0},children:jsx(SortableContext,{items:t.map(U=>U.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"})}):F?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(U=>{let ae=t[U.index];return ae?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsx(wo,{card:ae,render:r,onClick:o,onUpdate:l,availableUsers:d,allCards:i})},ae.id):null})}):t.map(U=>jsx(wo,{card:U,render:r,onClick:o,onUpdate:l,availableUsers:d,allCards:i},U.id))})})]})});Rn.displayName="Column";function jl({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let d=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?d():u.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:d,onKeyDown:i,className:c("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:c("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Lb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function op(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let d=l.name.toLowerCase(),i=d.replace(/\s+/g,""),u=d.split(/\s+/);return !!(i===s||d===s||u.some(m=>m===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Ib(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Bb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Rb=["\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 np({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:d="es",currentUser:i,enableEmoji:u=true,enableAttachments:m=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:f,maxFileSizeMB:x=10}){let y=l==="dark",[b,h]=useState(false),[v,w]=useState([]),[N,D]=useState(0),[F,T]=useState(null),[S,P]=useState(false),k=useRef(null),j=useRef(null),U=useRef(null),ae=useRef(null),L=useCallback((H,te)=>{let ye=Lb(H,te);if(T(ye),ye){let Re=r.filter(Se=>Se.name.toLowerCase().includes(ye.query)||Se.email&&Se.email.toLowerCase().includes(ye.query)).slice(0,5);w(Re),h(Re.length>0),D(0);}else h(false),w([]);},[r]),X$1=H=>{let te=H.target.value;if(t(te),L(te,H.target.selectionStart||0),k.current){k.current.style.height="24px";let ye=k.current.scrollHeight,Re=280,Se=Math.min(ye,Re);k.current.style.height=`${Se}px`,k.current.style.overflowY=ye>Re?"auto":"hidden";}},K=()=>{k.current&&L(e,k.current.selectionStart||0);},V=useCallback(H=>{if(!F||!k.current)return;let te=e.slice(0,F.start),ye=e.slice(F.end),Re=`@${H.name.replace(/\s+/g,"")} `,Se=te+Re+ye;t(Se),h(false),T(null),setTimeout(()=>{if(k.current){let Ee=F.start+Re.length;k.current.selectionStart=Ee,k.current.selectionEnd=Ee,k.current.focus();}},0);},[F,e,t]),R=H=>{if(b&&v.length>0)switch(H.key){case "ArrowDown":H.preventDefault(),D(te=>te<v.length-1?te+1:0);break;case "ArrowUp":H.preventDefault(),D(te=>te>0?te-1:v.length-1);break;case "Enter":{H.preventDefault();let te=v[N];te&&V(te);break}case "Tab":{H.preventDefault();let te=v[N];te&&V(te);break}case "Escape":H.preventDefault(),h(false);break}else H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),a());};useEffect(()=>{let H=te=>{j.current&&!j.current.contains(te.target)&&k.current&&!k.current.contains(te.target)&&h(false),ae.current&&!ae.current.contains(te.target)&&P(false);};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[]);let J=useCallback(H=>{if(!k.current)return;let te=k.current.selectionStart||e.length,ye=e.slice(0,te)+H+e.slice(te);t(ye),P(false),setTimeout(()=>{if(k.current){let Re=te+H.length;k.current.selectionStart=Re,k.current.selectionEnd=Re,k.current.focus();}},0);},[e,t]),Te=useCallback(H=>{if(!g||!H.target.files)return;let te=Array.from(H.target.files),ye=x*1024*1024,Re=te.filter(Se=>Se.size>ye?(console.warn(`File ${Se.name} exceeds max size of ${x}MB`),false):true);Re.length>0&&g(Re),H.target.value="";},[g,x]),$e=useCallback(H=>H.type.startsWith("image/")?Image:H.type.includes("pdf")||H.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&j.current){let H=j.current.children[N];H&&H.scrollIntoView({block:"nearest"});}},[N,b]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(H=>{let te=$e(H.file),ye=H.file.type.startsWith("image/");return jsxs("div",{className:c("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[ye&&H.preview?jsx("img",{src:H.preview,alt:H.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(te,{className:c("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:c("text-xs truncate",y?"text-white":"text-gray-900"),children:H.file.name}),jsx("p",{className:c("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:Bb(H.file.size)})]}),f&&jsx("button",{onClick:()=>f(H.id),className:c("p-0.5 rounded-full transition-colors",y?"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"})})]},H.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:c("flex-1 relative min-w-0"),children:[jsxs("div",{className:c("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!S),disabled:s||o,className:c("p-1 rounded transition-colors flex-shrink-0",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:S&&jsx(motion.div,{ref:ae,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"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:Rb.map(H=>jsx("button",{type:"button",onClick:()=>J(H),className:c("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:H},H))})})})]}),m&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:s||o,className:c("p-1.5 rounded transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:d==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:U,type:"file",multiple:true,onChange:Te,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:k,value:e,onChange:X$1,onSelect:K,onKeyDown:R,placeholder:n||(d==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:c("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&p.length===0||s,className:c("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":y?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?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:b&&v.length>0&&jsx(motion.div,{ref:j,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((H,te)=>jsxs("button",{type:"button",onClick:()=>V(H),className:c("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",te===N?y?"bg-white/10":"bg-gray-100":y?"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:H.color||"#8B5CF6"},children:Ib(H.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:c("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:H.name}),H.email&&jsx("p",{className:c("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:H.email})]})]},H.id))})})]})]})]})}function sp({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[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,d)=>l.type==="mention"?jsx("span",{className:c("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},d):jsx("span",{children:l.value},d))})}var hi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Oo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[l,d]=useState(false),[i,u]=useState(""),[m,p]=useState(false),[g,f]=useState(hi[10]||"#00E5CC"),[x,y]=useState({top:0,left:0}),b=useRef(null),h=useRef(null),v=useRef(null),w=useRef(null),N=t.filter(k=>k.name.toLowerCase().includes(i.toLowerCase())),D=t.some(k=>k.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();y({top:k.bottom+6,left:k.left});}},[l]),useEffect(()=>{let k=j=>{let U=j.target,ae=b.current?.contains(U),L=v.current?.contains(U);!ae&&!L&&(d(false),u(""),p(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let F=k=>{let j=e.some(U=>U.id===k.id);a(j?e.filter(U=>U.id!==k.id):[...e,k]);},T=async()=>{if(!(!r||!i.trim())){p(true);try{let k=await r(i.trim(),g);k&&(a([...e,k]),u(""),f(hi[Math.floor(Math.random()*hi.length)]||"#00E5CC"));}finally{p(false);}}},S=(k,j)=>{j.stopPropagation(),a(e.filter(U=>U.id!==k));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&d(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,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(k=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${k.color}20`,color:k.color},children:k.name},k.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:v,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:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:k=>u(k.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:k=>{k.key==="Enter"&&i.trim()&&!D&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(k=>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:`${k.color}20`,color:k.color},onClick:j=>S(k.id,j),children:[k.name,jsx(X,{className:"w-3 h-3"})]},k.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(k=>{let j=e.some(U=>U.id===k.id);return jsxs("button",{type:"button",onClick:()=>F(k),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:j?`${k.color}15`:"transparent",color:n.textPrimary},onMouseEnter:U=>{j||(U.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:U=>{j||(U.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.color}}),jsx("span",{className:"flex-1 text-left",children:k.name}),j&&jsx(Check,{className:"w-4 h-4",style:{color:k.color}})]},k.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!D&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:hi.map(k=>jsx("button",{type:"button",onClick:()=>f(k),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:k,outline:g===k?`2px solid ${k}`:"none",outlineOffset:"2px"}},k))}),jsxs("button",{type:"button",onClick:T,disabled:m,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:m?.7:1},children:[m?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 Kl({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:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function lp({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Kl,{tag:s,size:a},s.id)),n>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:["+",n]})]})}var cn=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{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:"#00E5CC",light:"#00E5CC"},{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 dp(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 jb(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 _b({className:e}){return jsxs("svg",{className:c("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 ql({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=jb(e.health),o={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"},d=dp(e.loggedMinutes),i=e.estimateMinutes?dp(e.estimateMinutes):null,u=a&&i?`${d} / ${i}`:d;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:c("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsx(_b,{className:l[t]}),jsx("span",{children:u})]})}function Kb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function xi(e){let t=Kb(e);return t!==null?String(t):e}function up(e){let a=xi(e).trim().toLowerCase();if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function vi(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 Xb(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 Jb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Qb({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 pp({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 Zb({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 Yl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:d,onDiscardTimer:i,onClose:u,className:m}){let[p,g]=useState(""),[f,x]=useState(t.estimateMinutes?vi(t.estimateMinutes):""),[y,b]=useState(""),[h,v]=useState(false),[w,N]=useState(false),D=useRef(null);useEffect(()=>{D.current?.focus();},[]);let F=async()=>{let P=up(p);if(!(P<=0||!s)){v(true);try{await s({durationMinutes:P,note:y.trim()||void 0,source:"manual"}),g(""),b("");}finally{v(false);}}},T=async()=>{if(!o)return;let P=f.trim()?up(f):null;await o(P),N(false);},S=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),F()),P.key==="Escape"&&u?.();};return jsxs("div",{className:c("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",m),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:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(pp,{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:Xb(n)})]}),jsx("button",{onClick:d,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Qb,{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(pp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:c("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(Jb,{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(Zb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:D,type:"text",value:p,onChange:P=>g(P.target.value),onKeyDown:S,placeholder:"8 (=8h), 2h 30m",className:c("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-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:F,disabled:h||!p.trim(),className:c("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:y,onChange:P=>b(P.target.value),onKeyDown:S,placeholder:"Note (optional)",className:c("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-[#00E5CC] 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:vi(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"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&T(),P.key==="Escape"&&N(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?vi(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:c("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:c("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(P=>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:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:vi(P.durationMinutes)})]},P.id))})]})]})}function oh(e){let a=xi(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function nh(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 co({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[l,d]=useState(nh(r)),[i,u]=useState(""),[m,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let f=async()=>{p(true);let v=oh(l);await n(v&&v>0?v:null,i||void 0),p(false);},x=async()=>{p(true),await n(null),p(false);},y=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:c("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:l,onChange:v=>d(v.target.value),onKeyDown:y,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:v=>u(v.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:m||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:m?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:x,disabled:m,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function sh(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 ih(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 Jl({summary:e,showLabel:t=false,size:a="md",className:r}){let n=sh(e.health),s=ih(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,d=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:c("flex items-center gap-2",r),children:[jsx("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:c("h-full w-1/4",n)})}),t&&jsx("span",{className:c("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:c("flex items-center gap-2",r),children:[jsxs("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:c("h-full transition-all duration-300",n),style:{width:`${d}%`}}),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:c("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function On(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 dh(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function ch(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-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";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 uh(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 ph({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=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",o=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",d=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:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:c("text-2xl font-bold",n),children:[r?"+":"",On(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:c("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("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:c("font-medium",d),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:c("font-medium",d),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:c("font-medium",d),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("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:c("font-medium",d),children:On(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:c("font-medium",d),children:On(e.totalLoggedMinutes)})]}),jsxs("div",{className:c("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:c("font-medium",d),children:e.totalTasksWithEstimate})]})]})]})]})}function mh({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:c("border-b",s,r&&c("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:c("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:c("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?On(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:On(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:c("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[n,On(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:c("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:c("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",ch(e.status,a),dh(e.status,a)),children:uh(e.status,t)})})]})}function Ql({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",l=o?"bg-[#050505]":"bg-gray-50",d=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",u=o?"text-white/[0.92]":"text-gray-900",m=o?"text-white/[0.60]":"text-gray-500",p=o?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:c("p-8 text-center",m,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:c("p-8 text-center",m,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:c("space-y-6 p-6",l,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:c("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:c("text-sm mt-1",m),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(ph,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:c("rounded-lg border overflow-hidden",d,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:c("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:"%"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:c("divide-y",i),children:g.map(f=>jsx(mh,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:c("text-xs text-center",m),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 $n(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 Sh(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 kp(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==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(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.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 Eh(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 Co({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:d=[],onCreateTag:i,attachments:u=[],onUploadAttachments:m,onDeleteAttachment:p,availableTasks:g=[],comments:f=[],onAddComment:x,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:N=[],isTimerRunning:D=false,timerElapsedSeconds:F=0,onTimeLog:T,onEstimateUpdate:S,onSoldEffortUpdate:P,onTimerStart:k,onTimerStop:j,onTimerDiscard:U,blurFinancials:ae=false}){let L=s==="dark",X$1={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},K=e&&"title"in e&&!("name"in e),V=e,[R,J]=useState(e?kp(e,l):null),[Te,$e]=useState(false),[H,te]=useState(false),[ye,Re]=useState(false),[Se,Ee]=useState(null),[Ve,ot]=useState(new Date),[be,Ge]=useState(false),[je,He]=useState(false),[wt,Nt]=useState(""),[Je,ze]=useState(false),[lt,At]=useState(false),[Ne,ft]=useState(false),[A,ie]=useState(false),[B,Z]=useState(""),O=useRef(null),ee=useRef(null),[Ue,ke]=useState(""),Be=useRef(null),[Me,Pe]=useState(""),[nt,at]=useState(false),[dt,mt]=useState([]),[Vt,Mt]=useState(""),[zt,gt]=useState(false),Dt=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 C=kp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:C?.id,taskName:C?.name,soldEffortMinutes:C?.soldEffortMinutes,quotedMinutes:C?.quotedMinutes,effortMinutes:C?.effortMinutes,timeLoggedMinutes:C?.timeLoggedMinutes}),J(C),Z(C.description||""),ke(C.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!B)return;let C=setTimeout(()=>{let z=ee.current;z&&(z.style.height="auto",z.style.height=`${Math.max(100,z.scrollHeight)}px`);},50);return ()=>clearTimeout(C)},[t,B]),useEffect(()=>()=>{O.current&&clearTimeout(O.current),Be.current&&clearTimeout(Be.current);},[]),useEffect(()=>{t&&Dt.current&&f.length>0&&setTimeout(()=>{Dt.current&&(Dt.current.scrollTop=Dt.current.scrollHeight);},100);},[t,f.length]);let Ut=useCallback(C=>{J(C),K&&n&&V?n(Eh(C,V)):r&&r(C);},[K,V,n,r]),Gt=useCallback(()=>{$e(false),te(false),Re(false),Ee(null),He(false),Nt(""),ze(false);},[]),Rt=useCallback((C,z)=>{if(!R)return;let ve={...R,[C]:z};Ut(ve);},[R,Ut]),rt=useCallback(()=>{let C=ee.current;C&&(C.style.height="auto",C.style.height=`${Math.max(100,C.scrollHeight)}px`);},[]),ia=useCallback(C=>{Z(C),setTimeout(rt,0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{if(R){let z={...R,description:C};Ut(z);}},800);},[R,Ut,rt]),fa=useCallback(C=>{ke(C),Be.current&&clearTimeout(Be.current),Be.current=setTimeout(()=>{if(R&&C.trim()){let z={...R,name:C.trim()};Ut(z);}},800);},[R,Ut]),W=useCallback(C=>{let z=C.map(ve=>{let Y={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:ve};return ve.type.startsWith("image/")&&(Y.preview=URL.createObjectURL(ve)),Y});mt(ve=>[...ve,...z]);},[]),le=useCallback(C=>{mt(z=>{let ve=z.find(Y=>Y.id===C);return ve?.preview&&URL.revokeObjectURL(ve.preview),z.filter(Y=>Y.id!==C)});},[]),st=useCallback(async()=>{if(!(!R||!Me.trim()&&dt.length===0||!x)){at(true);try{let C=op(Me,b),z=[];if(dt.length>0&&h){let ve=dt.map(Y=>Y.file);z=await h(ve);}await x(R.id,Me.trim(),C.length>0?C:void 0,z.length>0?z:void 0),Pe(""),dt.forEach(ve=>{ve.preview&&URL.revokeObjectURL(ve.preview);}),mt([]);}finally{at(false);}}},[R,Me,dt,x,b,h]),jt=useCallback(()=>{if(!R||!Vt.trim())return;let C=R.subtasks||[],z={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Vt.trim(),progress:0,startDate:new Date,endDate:new Date,position:C.length},ve=[...C,z],Y={...R,subtasks:ve};Ut(Y),Mt(""),gt(false);},[R,Vt,Ut]),re=useCallback(C=>{if(!R?.subtasks)return;let z=R.subtasks.map(Y=>Y.id===C?{...Y,progress:Y.progress===100?0:100}:Y),ve={...R,subtasks:z};Ut(ve);},[R,Ut]),xe=useCallback(C=>{if(!R?.subtasks)return;let z=R.subtasks.filter(Y=>Y.id!==C),ve={...R,subtasks:z};Ut(ve);},[R,Ut]),Tt=useCallback(C=>{let z=typeof C=="string"?new Date(C):C,Y=new Date().getTime()-z.getTime(),Ze=Math.floor(Y/6e4),Ct=Math.floor(Y/36e5),St=Math.floor(Y/864e5);return Ze<1?o==="es"?"Ahora":"Just now":Ze<60?o==="es"?`Hace ${Ze} min`:`${Ze}m ago`:Ct<24?o==="es"?`Hace ${Ct}h`:`${Ct}h ago`:St<7?o==="es"?`Hace ${St}d`:`${St}d ago`:z.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),bt=useCallback(C=>{if(!R)return;let z=R.progress||0;C==="completed"?z=100:C==="in-progress"&&z===0?z=10:C==="todo"&&(z=0);let ve={...R,status:C,progress:z};Ut(ve),$e(false);},[R,Ut]),pt=useCallback((C,z)=>{if(!R)return;let ve={...R,startDate:C,endDate:z};Ut(ve);},[R,Ut]),it=useCallback(()=>{let C=Ve.getFullYear(),z=Ve.getMonth(),ve=new Date(C,z,1),Ze=new Date(C,z+1,0).getDate(),Ct=ve.getDay(),St=[],Na=new Date(C,z,0).getDate();for(let Qt=Ct-1;Qt>=0;Qt--)St.push({date:new Date(C,z-1,Na-Qt),isCurrentMonth:false});for(let Qt=1;Qt<=Ze;Qt++)St.push({date:new Date(C,z,Qt),isCurrentMonth:true});let xa=42-St.length;for(let Qt=1;Qt<=xa;Qt++)St.push({date:new Date(C,z+1,Qt),isCurrentMonth:false});return St},[Ve]),q=useCallback(async C=>{if(C.preventDefault(),C.stopPropagation(),ft(false),!R||!m)return;let z=Array.from(C.dataTransfer.files);if(z.length!==0){ie(true);try{await m(R.id,z);}finally{ie(false);}}},[R,m]),fe=useCallback(async C=>{if(!R||!m||!C.target.files)return;let z=Array.from(C.target.files);if(z.length!==0){ie(true);try{await m(R.id,z);}finally{ie(false);}C.target.value="";}},[R,m]),ce=useCallback(C=>{C.preventDefault(),C.stopPropagation(),ft(true);},[]),$=useCallback(C=>{C.preventDefault(),C.stopPropagation(),ft(false);},[]),ne=useCallback(C=>C<1024?`${C} B`:C<1024*1024?`${(C/1024).toFixed(1)} KB`:`${(C/(1024*1024)).toFixed(1)} MB`,[]),Ke=useCallback(C=>C.startsWith("image/")?Image:C.includes("pdf")||C.includes("document")?FileText:File,[]);return !t||!R?null:jsx(AnimatePresence,{children:t&&R&&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:c("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:c("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:c("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:c("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:R.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 C=R.progress===100?0:100,ve={...R,progress:C,status:C===100?"completed":"todo"};Ut(ve);},className:c("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ue,onChange:C=>fa(C.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:c("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",R.progress===100?"line-through text-[#6B7280]":L?"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:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Gt(),$e(!Te);},className:c("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?o==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Te&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$e(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(C=>jsxs("button",{onClick:()=>bt(C.id),className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",R.status===C.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",C.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:C.label})]},C.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Gt(),Re(!ye);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((C,z)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:C.color||"#8B5CF6"},title:C.name,children:C.initials||C.name.slice(0,2).toUpperCase()},z)),R.assignees.length>3&&jsxs("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:c("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:c("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ye&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(C=>{let z=R.assignees?.some(ve=>ve.name===C.name);return jsxs("button",{onClick:()=>{let ve=R.assignees||[],Y;z?Y=ve.filter(Ze=>Ze.name!==C.name):Y=[...ve,C],Rt("assignees",Y);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",z&&(L?"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:C.color||"#8B5CF6"},children:C.initials||C.name.slice(0,2).toUpperCase()}),jsx("span",{className:c("flex-1",L?"text-white":"text-gray-900"),children:C.name}),z&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},C.name)}):jsx("div",{className:c("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Ee(Se?null:"start"),ot(R.startDate||new Date);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:c("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Se&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:c("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:C=>C.stopPropagation(),children:[jsxs("div",{className:c("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let C=new Date,z=new Date(C);z.setDate(C.getDate()+1);let ve=new Date(C);ve.setDate(C.getDate()+((6-C.getDay()+7)%7||7));let Y=new Date(C);Y.setDate(C.getDate()+((1-C.getDay()+7)%7||7));let Ze=new Date(C);Ze.setDate(C.getDate()+(6-C.getDay()+7)%7+7);let Ct=new Date(C);Ct.setDate(C.getDate()+14);let St=new Date(C);return St.setDate(C.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:C,display:C.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:z,display:z.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:ve,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ze,display:Ze.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Ct,display:Ct.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:St,display:St.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((xa,Qt)=>jsxs("button",{className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Se==="start"){let ur=R.endDate&&xa.date>R.endDate?xa.date:R.endDate;pt(xa.date,ur),Ee("end");}else {let ur=R.startDate&&xa.date<R.startDate?xa.date:R.startDate;pt(ur,xa.date),Ee(null);}},children:[jsx("span",{children:xa.label}),jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:xa.display})]},Qt))})(),jsx("div",{className:c("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{pt(void 0,void 0),Ee(null);},className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:c("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Se==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:c("font-medium",L?"text-white":"text-gray-900"),children:Ve.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ot(new Date),className:c("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ot(new Date(Ve.getFullYear(),Ve.getMonth()-1)),className:c("p-1 rounded",L?"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:()=>ot(new Date(Ve.getFullYear(),Ve.getMonth()+1)),className:c("p-1 rounded",L?"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:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(C=>jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:C},C))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:it().map((C,z)=>{let ve=C.date.toDateString()===new Date().toDateString(),Y=R.startDate?.toDateString()===C.date.toDateString(),Ze=R.endDate?.toDateString()===C.date.toDateString(),Ct=Y||Ze,St=R.startDate&&R.endDate&&C.date>=R.startDate&&C.date<=R.endDate;return jsx("button",{onClick:()=>{let Na=new Date(C.date);if(Se==="start"){let xa=R.endDate&&Na>R.endDate?Na:R.endDate;pt(Na,xa),Ee("end");}else {let xa=R.startDate&&Na<R.startDate?Na:R.startDate;pt(xa,Na),Ee(null);}},className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!C.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),C.isCurrentMonth&&(L?"text-white":"text-gray-900"),ve&&"ring-2 ring-[#00E5CC]",Y&&"bg-[#00E5CC] text-white",Ze&&!Y&&"bg-[#7C3AED] text-white",St&&!Ct&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!Ct&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:C.date.getDate()},z)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Gt(),te(!H);},className:c("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?o==="es"?"Alta":"High":R.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:H&&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:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(C=>jsxs("button",{onClick:()=>{Rt("priority",C.id),te(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",R.priority===C.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",C.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:C.label})]},C.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:c("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[be?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:C=>{let z=parseInt(C.target.value),ve=R.status;z===100?ve="completed":z>0?ve="in-progress":ve="todo";let Y={...R,progress:z,status:ve};Ut(Y);},onBlur:()=>Ge(false),className:c("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"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-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ge(true),className:c("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:c("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:c("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),v&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsx("span",{className:c("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?$n(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>At("estimate"),className:c("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:$n(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>At("estimate"),className:c("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:lt==="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(co,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async C=>{await S?.(R.id,C),At(false);},onClose:()=>At(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:ae?jsx("span",{className:c("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:o==="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"}):R.status==="completed"||R.progress===100?jsx("span",{className:c("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?$n(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>At("quoted"),className:c("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:$n(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>At("quoted"),className:c("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:lt==="quoted"&&!ae&&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(co,{mode:"quoted",locale:o,isDark:L,currentValue:R.quotedMinutes||null,onSave:async C=>{P?(await P(R.id,C),J(z=>z?{...z,quotedMinutes:C}:null)):Rt("quotedMinutes",C),At(false);},onClose:()=>At(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsx("div",{className:c("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):D?jsxs("button",{type:"button",onClick:()=>j?.(R.id),className:c("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"}),Sh(F||0)]}):jsx("button",{type:"button",onClick:()=>k?.(R.id),className:c("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),R.status==="completed"||R.progress===100?jsxs("div",{className:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>At("log"),className:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"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"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:c("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[$n(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:c("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",$n(w.estimateMinutes)]})]}),w.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:c("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:lt==="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(co,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(C,z)=>{C&&await T?.(R.id,{durationMinutes:C,note:z,source:"manual"}),At(false);},onClose:()=>At(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(Oo,{selectedTags:R.tags||[],availableTags:d,onChange:C=>{Rt("tags",C);},onCreateTag:i,theme:X$1})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:c("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(C=>{let z=g.find(ve=>ve.id===C);return jsxs("span",{className:c("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[z?.name||C.slice(0,8),jsx("button",{onClick:()=>{let ve=(R.dependencies||[]).filter(Y=>Y!==C);Rt("dependencies",ve);},className:c("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},C)})}),jsxs("button",{onClick:()=>{Gt(),He(!je);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"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:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{He(false),Nt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:c("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:wt,onChange:C=>Nt(C.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:c("w-full px-3 py-2 rounded-md text-sm outline-none",L?"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:g.length>0?g.filter(C=>C.id!==R.id).filter(C=>wt===""||C.name.toLowerCase().includes(wt.toLowerCase())).map(C=>{let z=R.dependencies?.includes(C.id);return jsxs("button",{onClick:()=>{let ve=R.dependencies||[],Y;z?Y=ve.filter(Ze=>Ze!==C.id):Y=[...ve,C.id],Rt("dependencies",Y);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",z&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:c("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",z?"bg-[#00E5CC] border-[#00E5CC]":L?"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:c("block truncate",L?"text-white":"text-gray-900"),children:C.name}),jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:C.id.slice(0,8)})]})]},C.id)}):jsx("div",{className:c("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Gt(),ze(!Je);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"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:R.color||"#6366F1"}}),jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:cn.find(C=>C.value===R.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:c("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:cn.map(C=>{let z=R.color===C.value;return jsx("button",{onClick:()=>{Rt("color",C.value),ze(false);},className:c("w-7 h-7 rounded-full flex items-center justify-center transition-all",z&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:C.value,outlineColor:z?C.value:void 0},title:C.name,children:z&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},C.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:C=>Rt("isMilestone",C.target.checked),className:c("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ee,value:B,onChange:C=>ia(C.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:c("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",L?"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:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(C=>C.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((C,z)=>(C.position??0)-(z.position??0)).map(C=>jsxs("div",{className:c("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>re(C.id),className:c("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",C.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:C.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:c("text-sm flex-1",C.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:C.name}),jsx("button",{onClick:()=>xe(C.id),className:c("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"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"})})]},C.id))}),zt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Vt,onChange:C=>Mt(C.target.value),onKeyDown:C=>{C.key==="Enter"&&Vt.trim()?jt():C.key==="Escape"&&(gt(false),Mt(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:c("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:jt,disabled:!Vt.trim(),className:c("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Vt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{gt(false),Mt("");},className:c("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>gt(true),className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"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"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:c("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(C=>{let z=Ke(C.type),ve=C.type.startsWith("image/");return jsxs("div",{className:c("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[ve&&C.thumbnailUrl?jsx("img",{src:C.thumbnailUrl,alt:C.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:c("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx(z,{className:c("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:c("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:C.name}),jsx("p",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ne(C.size)})]}),p&&jsx("button",{onClick:()=>p(C.id),className:c("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},C.id)})}),jsxs("div",{onDragOver:ce,onDragLeave:$,onDrop:q,className:c("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",Ne?L?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",A&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:fe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!m||A}),A?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:c("w-6 h-6 mx-auto mb-2",Ne?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:Ne?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="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"})]})}),!m&&jsx("p",{className:c("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:c("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:c("p-1.5 rounded transition-colors",L?"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 Qf 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,BarChart,Users,CalendarClock,FileText,Timer,Clock,Tag,CalendarCheck,Flag,CircleDot,Moon,Sun,Palette,Search,ZoomOut,ZoomIn,Keyboard,ChevronRight,Image,File,User,Check,CalendarDays,X,Hourglass,Play,Square,Diamond,Upload,MessageSquare,Layers,Filter,Zap,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,ChevronLeft,GripVertical,Smile,Paperclip,Send,FileJson,AlertCircle,Milestone,List,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import yy from'react-markdown';import xy from'remark-gfm';import vy from'rehype-sanitize';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var ci=(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 ui=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 [ui.Translate.toString(e),ui.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function c(...e){return twMerge(clsx(e))}function pi(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 Kf(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function $l(e,t){return e.length===0?1e3:t===0?pi(null,e[0].position):t>=e.length?pi(e[e.length-1].position,null):pi(e[t-1].position,e[t].position)}function Nu(e,t=100){return e>t}var qf=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 Yf(e,t,a,r){let n=t*Math.pow(a,e-1),s=n*.2*Math.random();return Math.min(n+s,r)}async function mi(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=qf,onRetry:l}=t,d,i=0;for(let u=1;u<=a;u++){i=u;try{return {data:await e(),attempts:i,success:!0}}catch(m){if(d=m,u===a||!o(d,u))return {error:d,attempts:i,success:false};let g=Yf(u,r,n,s);if(l)try{l(d,u,g);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,g));}}return {error:d||new Error("Unknown error"),attempts:i,success:false}}function Xf(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(n){if(a=n,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function Jf(e,t={}){return async(...a)=>mi(()=>e(...a),t)}var Hl=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 Du=(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))(Du||{}),cn=class cn{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:n,component:s,...o}=t,l=`[${a}] [${r}] [${s}]`,d=Object.keys(o).length>0;switch(r){case "DEBUG":console.debug(l,n,d?o:"");break;case "INFO":console.info(l,n,d?o:"");break;case "WARN":console.warn(l,n,d?o:"");break;case "ERROR":console.error(l,n,d?o:""),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",...cn.globalOptions};}static configure(t){cn.globalOptions={...cn.globalOptions,...t};}child(t){return new cn({...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 gi((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new gi(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:Du[t],message:a,component:this.options.componentName,...r};this.options.onLog(n);}};cn.globalOptions={};var zl=cn,gi=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}},Su=new zl;function Zf(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 eb(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 o=e.columns.find(l=>l.id===s.columnId);return [s.id,Ul(s.title),Ul(s.description||""),Ul(o?.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 tb(e,t,a){let r=t;if(!r){let o=document.querySelector(".asakaa-board");o&&(r=o.parentElement||o);}if(r)try{let o=await Qf(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),l=o.toDataURL("image/png"),d=297,i=210,u=o.width/o.height,m=d-20,p=m/u;p>i-20&&(p=i-20,m=p*u);let g=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});g.setFontSize(16),g.setTextColor(255,255,255),g.setFillColor(10,10,10),g.rect(0,0,d,15,"F"),g.text(e.title||"Kanban Board",10,10);let f=(d-m)/2;return g.addImage(l,"PNG",f,20,m,p),g}catch(o){console.error("Error capturing board:",o);}let n=new jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let l=e.cards.filter(d=>d.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,l.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):l.forEach(d=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(d.title,25,s),s+=6,d.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(d.description,160);n.text(u,25,s),s+=u.length*5;}let i=[];if(d.priority&&i.push(`Priority: ${d.priority}`),d.labels&&d.labels.length>0&&i.push(`Labels: ${d.labels.join(", ")}`),d.assignedUserIds&&d.assignedUserIds.length>0&&i.push(`Assigned: ${d.assignedUserIds.length} user(s)`),d.startDate||d.endDate){let u=[];d.startDate&&u.push(`Start: ${d.startDate}`),d.endDate&&u.push(`End: ${d.endDate}`),i.push(u.join(" \u2192 "));}i.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(i.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function Ul(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function Mu(e,t,a,r){switch(t){case "json":return Zf(e,r);case "csv":return eb(e);case "pdf":return await tb(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function Pu(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},l=new Blob([e],{type:o[t]}),d=URL.createObjectURL(l),i=document.createElement("a");i.href=d,i.download=s,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(d);}function ab(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 rb(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=Fu(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let l=Fu(t[o]||"");if(l.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-l.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${l.length})`);continue}for(;l.length<a.length;)l.push("");let i={};a.forEach((g,f)=>{i[g]=l[f]||"";});let u=i.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let m=n.get(u),p={id:i["Card ID"]||`card-${o}`,title:i.Title||"Untitled",description:i.Description?i.Description:void 0,columnId:m.id,position:m.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),m.cardIds.push(p.id);}catch(l){s.push(`Line ${o+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:n.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 Fu(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function Au(e,t){switch(t){case "json":return ab(e);case "csv":return rb(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Lu(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var Wl=createContext(null);function Iu(){return useContext(Wl)}var Bu=createContext(null);function Ru({children:e,themeName:t}){return jsx(Bu.Provider,{value:{themeName:t},children:e})}function $n(){return useContext(Bu)}function oa({children:e,container:t}){let[a,r]=useState(false),n=Iu(),s=$n();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:l,themeName:d}=n,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":d,"data-gantt-portal":"true",style:i,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var Uu={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},ub="#BDC3C7",pb=({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 un({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),l=useRef(null),d=useRef(null),i=()=>{if(!d.current)return;let g=d.current.getBoundingClientRect(),f=window.innerHeight,x=window.innerWidth,y=160,b=220,h=4,v=g.right-y;v<10&&(v=g.left),v+y>x-10&&(v=x-y-10);let w=f-g.bottom,N=g.top,S;w>=b+h?S=g.bottom+h:N>=b+h?S=g.top-b-h:S=w>=N?g.bottom+h:Math.max(10,g.top-b-h),o({top:S,left:v}),n(true);};useEffect(()=>{let g=f=>{l.current&&!l.current.contains(f.target)&&!d.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[r]),useEffect(()=>{let g=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[r]);let u=g=>{t(g),n(false);},m=e?Uu[e]:null,p=m?.color||ub;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:d,onClick:()=>r?n(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:m?.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(oa,{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(Uu).map(([g,f])=>jsxs("button",{onClick:()=>u(g),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:f.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(pb,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===g&&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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},g)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:g=>{g.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:g=>{g.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:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var mb=[{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 xs({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),d=useRef(null),i=useRef(null),p=($n()?.themeName||"dark")==="dark",g=()=>{if(!i.current)return;let v=i.current.getBoundingClientRect(),w=window.innerHeight,N=window.innerWidth,S=320,F=380,T=4,E=v.left;E+S>N-10&&(E=N-S-10),E<10&&(E=10);let P=w-v.bottom,k=v.top,j;P>=F+T?j=v.bottom+T:k>=F+T?j=v.top-F-T:j=P>=k?v.bottom+T:Math.max(10,v.top-F-T),l({top:j,left:E}),s(true);};useEffect(()=>{let v=w=>{d.current&&!d.current.contains(w.target)&&!i.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[n]),useEffect(()=>{let v=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[n]);let f=v=>{let w=new Date,N=E=>{let P=E.getFullYear(),k=String(E.getMonth()+1).padStart(2,"0"),j=String(E.getDate()).padStart(2,"0");return `${P}-${k}-${j}`},S=N(w),F=new Date(w);F.setDate(F.getDate()+v);let T=N(F);a(S,T),s(false);},x=()=>{if(!e||!t)return "Set date";let v=F=>{if(F instanceof Date)return F;if(typeof F!="string"||!F.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=F.split("-").map(Number);if(T.length!==3||T.some(j=>isNaN(j)))return null;let E=T[0],P=T[1],k=T[2];return E===void 0||P===void 0||k===void 0?null:new Date(E,P-1,k)},w=v(e),N=v(t);if(!w||!N||isNaN(w.getTime())||isNaN(N.getTime()))return "Set date";let S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${S[w.getMonth()]} ${w.getDate()} \u2013 ${S[N.getMonth()]} ${N.getDate()}`},y=e&&t,h=(()=>{if(!t)return false;let v=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),v<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:i,onClick:()=>n?s(false):g(),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:y?`${x()}`:"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:x()})]}),n&&jsx(oa,{children:jsxs("div",{ref:d,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.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:mb.map(v=>jsx("button",{onClick:()=>f(v.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:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=p?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${p?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:v.label},v.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:v=>a(v.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:v=>a(e,v.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:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function mn({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[l,d]=useState(""),[i,u]=useState({top:0,left:0}),m=useRef(null),p=useRef(null),g=()=>{if(!p.current)return;let h=p.current.getBoundingClientRect(),v=window.innerHeight,w=window.innerWidth,N=300,S=380,F=4,T=h.right-N;T<10&&(T=h.left),T+N>w-10&&(T=w-N-10);let E=v-h.bottom,P=h.top,k;E>=S+F?k=h.bottom+F:P>=S+F?k=h.top-S-F:k=E>=P?h.bottom+F:Math.max(10,h.top-S-F),u({top:k,left:T}),o(true);};useEffect(()=>{let h=v=>{m.current&&!m.current.contains(v.target)&&!p.current?.contains(v.target)&&(o(false),d(""));};if(s)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s]),useEffect(()=>{let h=v=>{v.key==="Escape"&&(o(false),d(""));};if(s)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s]);let f=h=>{let v=e.some(w=>w.id===h.id);a(v?e.filter(w=>w.id!==h.id):[...e,h]);},x=t.filter(h=>h.name.toLowerCase().includes(l.toLowerCase())),y=e.slice(0,n),b=e.length-n;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:p,onClick:()=>s?o(false):g(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[y.map(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)),b>0&&jsxs("div",{className:"asakaa-avatar",children:["+",b]})]}):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(oa,{children:jsxs("div",{ref:m,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=>d(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:x.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"}):x.map(h=>{let v=e.some(w=>w.id===h.id);return jsxs("button",{onClick:()=>f(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:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor: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:v?"#00E5CC":"transparent"},children:v?"\u2713":""})]},h.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),o(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 fi(e,t,a){let r=new Map;e.forEach(d=>{if(d.dependencies&&Array.isArray(d.dependencies)){let i=d.dependencies.map(u=>{if(typeof u=="string")return u;let m=u;return m.taskId||m.targetId||""}).filter(Boolean);r.set(d.id,i);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,l=d=>{if(!s.has(d)){s.add(d),o.add(d);let i=r.get(d)||[];for(let u of i){if(!s.has(u)&&l(u))return true;if(o.has(u))return true}}return o.delete(d),false};return l(a)}function ws({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[l,d]=useState(false),[i,u]=useState(""),[m,p]=useState(t.length>0),[g,f]=useState({top:0,left:0}),[x,y]=useState(null),b=useRef(null),h=useRef(null),v=()=>{if(!h.current)return;let T=h.current.getBoundingClientRect(),E=window.innerHeight,P=window.innerWidth,k=300,j=m?380:120,U=4,ae=T.right-k;ae<10&&(ae=T.left),ae+k>P-10&&(ae=P-k-10);let L=E-T.bottom,X=T.top,Y;L>=j+U?Y=T.bottom+U:X>=j+U?Y=T.top-j-U:Y=L>=X?T.bottom+U:Math.max(10,T.top-j-U),f({top:Y,left:ae}),d(true);};useEffect(()=>{if(!l||!h.current)return;let T=h.current.getBoundingClientRect(),E=window.innerHeight,P=window.innerWidth,k=300,j=m?380:120,U=4,ae=T.right-k;ae<10&&(ae=T.left),ae+k>P-10&&(ae=P-k-10);let L=E-T.bottom,X=T.top,Y;L>=j+U?Y=T.bottom+U:X>=j+U?Y=T.top-j-U:Y=L>=X?T.bottom+U:Math.max(10,T.top-j-U),f({top:Y,left:ae});},[m,l]),useEffect(()=>{let T=E=>{b.current&&!b.current.contains(E.target)&&!h.current?.contains(E.target)&&(d(false),u(""));};if(l)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[l]),useEffect(()=>{let T=E=>{E.key==="Escape"&&(d(false),u(""));};if(l)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]);let w=T=>{let E=t.includes(T),P=a.find(k=>k.id===T);if(y(null),E){let k=t.filter(j=>j!==T);r(k),k.length===0&&p(false);}else {if(s&&fi(a,T,e)){let j=`Cannot add "${P?.title||T}" as dependency - would create circular reference`;y(j),o?.(T,P?.title||T),setTimeout(()=>y(null),3e3);return}r([...t,T]),p(true);}},N=()=>{let T=!m;p(T),T||r([]);},S=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(i.toLowerCase())||T.id.toLowerCase().includes(i.toLowerCase())),F=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:h,onClick:()=>l?d(false):v(),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:F,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:F},children:t.length})]}),l&&jsx(oa,{children:jsxs("div",{ref:b,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${g.top}px`,left:`${g.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:[x&&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:x})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:N,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:m?"#00E5CC":"transparent",borderColor:m?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:m&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),m&&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:T=>u(T.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:S.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"}):S.map(T=>{let E=t.includes(T.id);return jsxs("button",{onClick:()=>w(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:P=>{P.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:P=>{P.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:E?"#00E5CC":"transparent",borderColor:E?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:E&&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:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),p(false),d(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 So=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:l=[],allCards:d=[]})=>{let{attributes:i,listeners:u,setNodeRef:m,transform:p,transition:g,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),x={transform:ui.Transform.toString(p),transition:g};if(t)return jsx("div",{ref:m,style:x,...i,...u,onClick:()=>a?.(e),children:t(e)});let y=l.filter(w=>e.assignedUserIds?.includes(w.id)),b=e.progress===100,h=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),v={...x,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:m,style:v,className:c("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...i,...u,onClick:w=>{w.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:w=>{w.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:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((w,N)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:S=>{S.currentTarget.style.display="none";}}),N===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]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:b?"line-through":"none",opacity:b?.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:w=>w.stopPropagation(),className:"priority-selector",children:jsx(un,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(xs,{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:(w,N)=>o?.(e.id,{startDate:w,endDate:N})})}),l.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(mn,{assignedUsers:y,availableUsers:l,onChange:w=>o?.(e.id,{assignedUserIds:w.map(N=>N.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(ws,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:d,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),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:"#00E5CC"},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:"#00E5CC"}})})]})]})},(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&&e.render===t.render&&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)));So.displayName="Card";var bi={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"}},Ju=({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 Qu({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,l]=useState({top:0,left:0}),d=useRef(null),i=useRef(null),u=[...Object.entries(bi).map(([y,b])=>({id:y,label:b.label,color:b.color,icon:b.icon})),...r.filter(y=>!Object.keys(bi).includes(y.id)).map(y=>({id:y.id,label:y.title,color:y.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let y=bi[e];if(y)return {...y,id:e};let b=r.find(h=>h.id===e);return b?{id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}:{...bi.todo,id:"todo"}},p=()=>{if(!i.current)return;let y=i.current.getBoundingClientRect(),b=window.innerHeight,h=window.innerWidth,v=180,w=280,N=4,S=y.right-v;S<10&&(S=y.left),S+v>h-10&&(S=h-v-10);let F=b-y.bottom,T=y.top,E;F>=w+N?E=y.bottom+N:T>=w+N?E=y.top-w-N:E=F>=T?y.bottom+N:Math.max(10,y.top-w-N),l({top:E,left:S}),s(true);};useEffect(()=>{let y=b=>{d.current&&!d.current.contains(b.target)&&!i.current?.contains(b.target)&&s(false);};if(n)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[n]),useEffect(()=>{let y=b=>{b.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[n]);let g=y=>{t(y),s(false);},f=m(),x=f.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:i,onClick:()=>n?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:`${x}10`,boxShadow:`0 0 0 2px ${x}30 inset`},title:f.label,children:jsx(Ju,{icon:f.icon,color:x})}),n&&jsx(oa,{children:jsxs("div",{ref:d,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:u.map(y=>jsxs("button",{onClick:()=>g(y.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:y.color,background:"transparent"},onMouseEnter:b=>{b.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:b=>{b.currentTarget.style.background="transparent";},children:[jsx(Ju,{icon:y.icon,color:y.color}),jsx("span",{className:"font-semibold",children:y.label}),e===y.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},y.id))})]})})]})}var Zu={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function ep({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Zu[s]||Zu.en,[l,d]=useState(false),[i,u]=useState(false),[m,p]=useState(e),[g,f]=useState({top:0,left:0}),x=useRef(null),y=useRef(null),b=useRef(null);useEffect(()=>{if(l&&y.current){let N=y.current.getBoundingClientRect();f({top:N.bottom+window.scrollY+8,left:N.left+window.scrollX});}},[l]),useEffect(()=>{let N=S=>{x.current&&!x.current.contains(S.target)&&!y.current?.contains(S.target)&&(d(false),u(false));};if(l)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useEffect(()=>{let N=S=>{S.key==="Escape"&&(d(false),u(false),p(e));};if(l)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[l,e]),useEffect(()=>{i&&b.current&&(b.current.focus(),b.current.select());},[i]);let h=()=>{u(true),p(e);},v=()=>{let N=m.trim();N&&N!==e&&t(N),u(false),d(false),p(e);},w=N=>{N.key==="Enter"?v():N.key==="Escape"&&(u(false),p(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:y,onClick:()=>d(!l),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,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"})]})}),l&&jsx(oa,{children:jsx("div",{ref:x,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${g.top}px`,left:`${g.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:i?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:b,type:"text",value:m,onChange:N=>p(N.target.value),onKeyDown:w,onBlur:v,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-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,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:o.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),d(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var Un=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:l,availableUsers:d,allCards:i,enableVirtualization:u,cardHeight:m=120,isCollapsed:p,onToggleCollapse:g,onColumnRename:f,onColumnDelete:x,isDeletable:y=false,className:b,renderMetrics:h,locale:v})=>{let{setNodeRef:w,isOver:N}=useDroppable({id:e.id,data:{type:"column",column:e}}),S=useRef(null),F=u??Nu(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>S.current,estimateSize:()=>m,enabled:F});if(a)return jsx("div",{ref:w,className:b,children:a(e,t)});let P=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let U=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:U}:U>=80?{state:"warning",percentage:U}:U>=60?{state:"approaching",percentage:U}:{state:"ok",percentage:U}})(),k=P.state==="exceeded",j=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:c("asakaa-column",N&&"ring-2 ring-asakaa-accent-blue",k&&"ring-2 ring-asakaa-accent-red",b),children:[n?n(e,t.length):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:c(j()),children:[t.length,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&P.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${P.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[P.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"})]}),P.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"})]}),P.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"})}),P.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"})]})]}),(f||x)&&jsx(ep,{columnTitle:e.title,onRename:U=>f?.(e.id,U),onDelete:x?()=>x(e.id):void 0,isDeletable:y,locale:v}),g&&jsx("button",{onClick:g,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":p?"Expand column":"Collapse column",children:p?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!p&&jsx("div",{ref:S,className:"asakaa-column-cards",style:{maxHeight:F?"600px":void 0},children:jsx(SortableContext,{items:t.map(U=>U.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"})}):F?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(U=>{let ae=t[U.index];return ae?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${U.start}px)`},children:jsx(So,{card:ae,render:r,onClick:o,onUpdate:l,availableUsers:d,allCards:i})},ae.id):null})}):t.map(U=>jsx(So,{card:U,render:r,onClick:o,onUpdate:l,availableUsers:d,allCards:i},U.id))})})]})});Un.displayName="Column";function Kl({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),l=useRef(null);useEffect(()=>{r&&l.current&&(l.current.focus(),l.current.select());},[r]);let d=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},i=u=>{u.key==="Enter"?d():u.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:l,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:d,onKeyDown:i,className:c("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:c("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Lb(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function sp(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(l=>{let d=l.name.toLowerCase(),i=d.replace(/\s+/g,""),u=d.split(/\s+/);return !!(i===s||d===s||u.some(m=>m===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Ib(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Bb(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Rb=["\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 ip({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:l="dark",locale:d="es",currentUser:i,enableEmoji:u=true,enableAttachments:m=true,pendingFiles:p=[],onFilesSelect:g,onRemoveFile:f,maxFileSizeMB:x=10}){let y=l==="dark",[b,h]=useState(false),[v,w]=useState([]),[N,S]=useState(0),[F,T]=useState(null),[E,P]=useState(false),k=useRef(null),j=useRef(null),U=useRef(null),ae=useRef(null),L=useCallback((z,te)=>{let xe=Lb(z,te);if(T(xe),xe){let Re=r.filter(De=>De.name.toLowerCase().includes(xe.query)||De.email&&De.email.toLowerCase().includes(xe.query)).slice(0,5);w(Re),h(Re.length>0),S(0);}else h(false),w([]);},[r]),X$1=z=>{let te=z.target.value;if(t(te),L(te,z.target.selectionStart||0),k.current){k.current.style.height="24px";let xe=k.current.scrollHeight,Re=280,De=Math.min(xe,Re);k.current.style.height=`${De}px`,k.current.style.overflowY=xe>Re?"auto":"hidden";}},Y=()=>{k.current&&L(e,k.current.selectionStart||0);},V=useCallback(z=>{if(!F||!k.current)return;let te=e.slice(0,F.start),xe=e.slice(F.end),Re=`@${z.name.replace(/\s+/g,"")} `,De=te+Re+xe;t(De),h(false),T(null),setTimeout(()=>{if(k.current){let Ee=F.start+Re.length;k.current.selectionStart=Ee,k.current.selectionEnd=Ee,k.current.focus();}},0);},[F,e,t]),R=z=>{if(b&&v.length>0)switch(z.key){case "ArrowDown":z.preventDefault(),S(te=>te<v.length-1?te+1:0);break;case "ArrowUp":z.preventDefault(),S(te=>te>0?te-1:v.length-1);break;case "Enter":{z.preventDefault();let te=v[N];te&&V(te);break}case "Tab":{z.preventDefault();let te=v[N];te&&V(te);break}case "Escape":z.preventDefault(),h(false);break}else z.key==="Enter"&&!z.shiftKey&&(z.preventDefault(),a());};useEffect(()=>{let z=te=>{j.current&&!j.current.contains(te.target)&&k.current&&!k.current.contains(te.target)&&h(false),ae.current&&!ae.current.contains(te.target)&&P(false);};return document.addEventListener("mousedown",z),()=>document.removeEventListener("mousedown",z)},[]);let J=useCallback(z=>{if(!k.current)return;let te=k.current.selectionStart||e.length,xe=e.slice(0,te)+z+e.slice(te);t(xe),P(false),setTimeout(()=>{if(k.current){let Re=te+z.length;k.current.selectionStart=Re,k.current.selectionEnd=Re,k.current.focus();}},0);},[e,t]),Ne=useCallback(z=>{if(!g||!z.target.files)return;let te=Array.from(z.target.files),xe=x*1024*1024,Re=te.filter(De=>De.size>xe?(console.warn(`File ${De.name} exceeds max size of ${x}MB`),false):true);Re.length>0&&g(Re),z.target.value="";},[g,x]),$e=useCallback(z=>z.type.startsWith("image/")?Image:z.type.includes("pdf")||z.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(b&&j.current){let z=j.current.children[N];z&&z.scrollIntoView({block:"nearest"});}},[N,b]),jsxs("div",{className:"flex flex-col gap-2",children:[p.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:p.map(z=>{let te=$e(z.file),xe=z.file.type.startsWith("image/");return jsxs("div",{className:c("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",y?"bg-white/10":"bg-gray-100"),children:[xe&&z.preview?jsx("img",{src:z.preview,alt:z.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(te,{className:c("w-4 h-4",y?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:c("text-xs truncate",y?"text-white":"text-gray-900"),children:z.file.name}),jsx("p",{className:c("text-xs",y?"text-[#6B7280]":"text-gray-400"),children:Bb(z.file.size)})]}),f&&jsx("button",{onClick:()=>f(z.id),className:c("p-0.5 rounded-full transition-colors",y?"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"})})]},z.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:c("flex-1 relative min-w-0"),children:[jsxs("div",{className:c("flex items-end gap-1 px-2 py-2 rounded-lg",y?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>P(!E),disabled:s||o,className:c("p-1 rounded transition-colors flex-shrink-0",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:E&&jsx(motion.div,{ref:ae,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",y?"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:Rb.map(z=>jsx("button",{type:"button",onClick:()=>J(z),className:c("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",y?"hover:bg-white/10":"hover:bg-gray-100"),children:z},z))})})})]}),m&&g&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>U.current?.click(),disabled:s||o,className:c("p-1.5 rounded transition-colors",y?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:d==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:U,type:"file",multiple:true,onChange:Ne,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:k,value:e,onChange:X$1,onSelect:Y,onKeyDown:R,placeholder:n||(d==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:c("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",y?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&p.length===0||s,className:c("p-1.5 rounded transition-colors",(e.trim()||p.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":y?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?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:b&&v.length>0&&jsx(motion.div,{ref:j,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:c("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",y?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:v.map((z,te)=>jsxs("button",{type:"button",onClick:()=>V(z),className:c("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",te===N?y?"bg-white/10":"bg-gray-100":y?"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:z.color||"#8B5CF6"},children:Ib(z.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:c("text-sm font-medium truncate",y?"text-white":"text-gray-900"),children:z.name}),z.email&&jsx("p",{className:c("text-xs truncate",y?"text-[#6B7280]":"text-gray-500"),children:z.email})]})]},z.id))})})]})]})]})}function lp({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[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,d)=>l.type==="mention"?jsx("span",{className:c("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:l.value},d):jsx("span",{children:l.value},d))})}var wi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function Wo({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[l,d]=useState(false),[i,u]=useState(""),[m,p]=useState(false),[g,f]=useState(wi[10]||"#00E5CC"),[x,y]=useState({top:0,left:0}),b=useRef(null),h=useRef(null),v=useRef(null),w=useRef(null),N=t.filter(k=>k.name.toLowerCase().includes(i.toLowerCase())),S=t.some(k=>k.name.toLowerCase()===i.toLowerCase());useEffect(()=>{if(l&&h.current){let k=h.current.getBoundingClientRect();y({top:k.bottom+6,left:k.left});}},[l]),useEffect(()=>{let k=j=>{let U=j.target,ae=b.current?.contains(U),L=v.current?.contains(U);!ae&&!L&&(d(false),u(""),p(false));};if(l)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[l]),useEffect(()=>{l&&w.current&&w.current.focus();},[l]);let F=k=>{let j=e.some(U=>U.id===k.id);a(j?e.filter(U=>U.id!==k.id):[...e,k]);},T=async()=>{if(!(!r||!i.trim())){p(true);try{let k=await r(i.trim(),g);k&&(a([...e,k]),u(""),f(wi[Math.floor(Math.random()*wi.length)]||"#00E5CC"));}finally{p(false);}}},E=(k,j)=>{j.stopPropagation(),a(e.filter(U=>U.id!==k));},P={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&d(!l),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:P,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(k=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${k.color}20`,color:k.color},children:k.name},k.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:v,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:x.top,left:x.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:i,onChange:k=>u(k.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:k=>{k.key==="Enter"&&i.trim()&&!S&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(k=>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:`${k.color}20`,color:k.color},onClick:j=>E(k.id,j),children:[k.name,jsx(X,{className:"w-3 h-3"})]},k.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:N.length>0?N.map(k=>{let j=e.some(U=>U.id===k.id);return jsxs("button",{type:"button",onClick:()=>F(k),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:j?`${k.color}15`:"transparent",color:n.textPrimary},onMouseEnter:U=>{j||(U.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:U=>{j||(U.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:k.color}}),jsx("span",{className:"flex-1 text-left",children:k.name}),j&&jsx(Check,{className:"w-4 h-4",style:{color:k.color}})]},k.id)}):i.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),i.trim()&&!S&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:wi.map(k=>jsx("button",{type:"button",onClick:()=>f(k),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:k,outline:g===k?`2px solid ${k}`:"none",outlineOffset:"2px"}},k))}),jsxs("button",{type:"button",onClick:T,disabled:m,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:g,color:"#FFFFFF",opacity:m?.7:1},children:[m?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 Yl({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:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function cp({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Yl,{tag:s,size:a},s.id)),n>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:["+",n]})]})}var fn=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{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:"#00E5CC",light:"#00E5CC"},{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 up(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 jb(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 _b({className:e}){return jsxs("svg",{className:c("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 Xl({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=jb(e.health),o={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"},d=up(e.loggedMinutes),i=e.estimateMinutes?up(e.estimateMinutes):null,u=a&&i?`${d} / ${i}`:d;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:c("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsx(_b,{className:l[t]}),jsx("span",{children:u})]})}function Kb(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Ci(e){let t=Kb(e);return t!==null?String(t):e}function mp(e){let a=Ci(e).trim().toLowerCase();if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Ti(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 Xb(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 Jb({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Qb({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 gp({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 Zb({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 Jl({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:l,onStopTimer:d,onDiscardTimer:i,onClose:u,className:m}){let[p,g]=useState(""),[f,x]=useState(t.estimateMinutes?Ti(t.estimateMinutes):""),[y,b]=useState(""),[h,v]=useState(false),[w,N]=useState(false),S=useRef(null);useEffect(()=>{S.current?.focus();},[]);let F=async()=>{let P=mp(p);if(!(P<=0||!s)){v(true);try{await s({durationMinutes:P,note:y.trim()||void 0,source:"manual"}),g(""),b("");}finally{v(false);}}},T=async()=>{if(!o)return;let P=f.trim()?mp(f):null;await o(P),N(false);},E=P=>{P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),F()),P.key==="Escape"&&u?.();};return jsxs("div",{className:c("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",m),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:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(gp,{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:Xb(n)})]}),jsx("button",{onClick:d,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Qb,{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(gp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:l,className:c("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(Jb,{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(Zb,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:S,type:"text",value:p,onChange:P=>g(P.target.value),onKeyDown:E,placeholder:"8 (=8h), 2h 30m",className:c("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-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:F,disabled:h||!p.trim(),className:c("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:y,onChange:P=>b(P.target.value),onKeyDown:E,placeholder:"Note (optional)",className:c("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-[#00E5CC] 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:Ti(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"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:P=>x(P.target.value),onKeyDown:P=>{P.key==="Enter"&&T(),P.key==="Escape"&&N(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>N(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ti(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:c("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:c("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(P=>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:P.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ti(P.durationMinutes)})]},P.id))})]})]})}function oh(e){let a=Ci(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,l]=a.split(":").map(Number);return (o||0)*60+(l||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,l=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+l}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function nh(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 fo({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[l,d]=useState(nh(r)),[i,u]=useState(""),[m,p]=useState(false),g=useRef(null);useEffect(()=>{g.current?.focus();},[]);let f=async()=>{p(true);let v=oh(l);await n(v&&v>0?v:null,i||void 0),p(false);},x=async()=>{p(true),await n(null),p(false);},y=v=>{v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),f()),v.key==="Escape"&&s();},b={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:c("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:v=>v.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:b[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:g,type:"text",value:l,onChange:v=>d(v.target.value),onKeyDown:y,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:i,onChange:v=>u(v.target.value),onKeyDown:y,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:m||!l.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:m?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:x,disabled:m,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function sh(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 ih(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 Zl({summary:e,showLabel:t=false,size:a="md",className:r}){let n=sh(e.health),s=ih(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},l=e.progressPercent??0,d=Math.min(100,l),i=l>100;return e.health==="no-estimate"?jsxs("div",{className:c("flex items-center gap-2",r),children:[jsx("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:c("h-full w-1/4",n)})}),t&&jsx("span",{className:c("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:c("flex items-center gap-2",r),children:[jsxs("div",{className:c("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:c("h-full transition-all duration-300",n),style:{width:`${d}%`}}),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:c("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[l,"%"]})]})}function Wn(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 dh(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function ch(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-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";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 uh(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 ph({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=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",o=a?"border-white/5":"border-gray-200",l=a?"text-[#9CA3AF]":"text-gray-500",d=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:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("text-sm font-medium mb-1",l),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:c("text-2xl font-bold",n),children:[r?"+":"",Wn(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:c("text-xs mt-1",l),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("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:c("font-medium",d),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:c("font-medium",d),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:c("font-medium",d),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:c("p-4 rounded-lg border",s,o),children:[jsx("div",{className:c("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:c("font-medium",d),children:Wn(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:l,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:c("font-medium",d),children:Wn(e.totalLoggedMinutes)})]}),jsxs("div",{className:c("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:l,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:c("font-medium",d),children:e.totalTasksWithEstimate})]})]})]})]})}function mh({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",l=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:c("border-b",s,r&&c("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:c("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:c("text-xs mt-1",l),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Wn(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Wn(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:c("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":l),children:[n,Wn(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:c("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":l),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:c("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",ch(e.status,a),dh(e.status,a)),children:uh(e.status,t)})})]})}function ed({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",l=o?"bg-[#050505]":"bg-gray-50",d=o?"bg-[#0A0A0A]":"bg-white",i=o?"border-white/[0.08]":"border-gray-200",u=o?"text-white/[0.92]":"text-gray-900",m=o?"text-white/[0.60]":"text-gray-500",p=o?"bg-[#050505]/50":"bg-gray-50",g=useMemo(()=>e?[...e.tasks].sort((f,x)=>f.varianceMinutes===null?1:x.varianceMinutes===null?-1:x.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:c("p-8 text-center",m,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:c("p-8 text-center",m,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:c("space-y-6 p-6",l,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:c("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:c("text-sm mt-1",m),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(ph,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:c("rounded-lg border overflow-hidden",d,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:c("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:"%"}),jsx("th",{className:c("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",m),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:c("divide-y",i),children:g.map(f=>jsx(mh,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:c("text-xs text-center",m),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 Vn(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 Sh(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 Tp(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==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(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.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 Eh(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 Mo({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:l=[],availableTags:d=[],onCreateTag:i,attachments:u=[],onUploadAttachments:m,onDeleteAttachment:p,availableTasks:g=[],comments:f=[],onAddComment:x,currentUser:y,mentionableUsers:b=[],onUploadCommentAttachments:h,enableTimeTracking:v=false,timeTrackingSummary:w,timeEntries:N=[],isTimerRunning:S=false,timerElapsedSeconds:F=0,onTimeLog:T,onEstimateUpdate:E,onSoldEffortUpdate:P,onTimerStart:k,onTimerStop:j,onTimerDiscard:U,blurFinancials:ae=false}){let L=s==="dark",X$1={textTertiary:L?"#6B7280":"#9CA3AF",textSecondary:L?"#9CA3AF":"#6B7280",textPrimary:L?"#FFFFFF":"#111827",borderLight:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:L?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:L?"#1A1D25":"#FFFFFF",bgSecondary:L?"#0A0A0A":"#F9FAFB",hoverBg:L?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},Y=e&&"title"in e&&!("name"in e),V=e,[R,J]=useState(e?Tp(e,l):null),[Ne,$e]=useState(false),[z,te]=useState(false),[xe,Re]=useState(false),[De,Ee]=useState(null),[Ve,ot]=useState(new Date),[he,Ge]=useState(false),[je,He]=useState(false),[Ct,Dt]=useState(""),[Je,ze]=useState(false),[lt,Lt]=useState(false),[ke,gt]=useState(false),[A,se]=useState(false),[B,Z]=useState(""),O=useRef(null),ee=useRef(null),[Ue,Ce]=useState(""),Ie=useRef(null),[Me,Pe]=useState(""),[nt,at]=useState(false),[dt,pt]=useState([]),[jt,Mt]=useState(""),[zt,mt]=useState(false),Pt=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 C=Tp(e,l);console.log("\u{1F4E5} After normalizeToTask:",{taskId:C?.id,taskName:C?.name,soldEffortMinutes:C?.soldEffortMinutes,quotedMinutes:C?.quotedMinutes,effortMinutes:C?.effortMinutes,timeLoggedMinutes:C?.timeLoggedMinutes}),J(C),Z(C.description||""),Ce(C.name||"");}},[e?.id,e?.quotedMinutes,l,t]),useEffect(()=>{if(!t||!B)return;let C=setTimeout(()=>{let $=ee.current;$&&($.style.height="auto",$.style.height=`${Math.max(100,$.scrollHeight)}px`);},50);return ()=>clearTimeout(C)},[t,B]),useEffect(()=>()=>{O.current&&clearTimeout(O.current),Ie.current&&clearTimeout(Ie.current);},[]),useEffect(()=>{t&&Pt.current&&f.length>0&&setTimeout(()=>{Pt.current&&(Pt.current.scrollTop=Pt.current.scrollHeight);},100);},[t,f.length]);let Ut=useCallback(C=>{J(C),Y&&n&&V?n(Eh(C,V)):r&&r(C);},[Y,V,n,r]),_t=useCallback(()=>{$e(false),te(false),Re(false),Ee(null),He(false),Dt(""),ze(false);},[]),Wt=useCallback((C,$)=>{if(!R)return;let pe={...R,[C]:$};Ut(pe);},[R,Ut]),rt=useCallback(()=>{let C=ee.current;C&&(C.style.height="auto",C.style.height=`${Math.max(100,C.scrollHeight)}px`);},[]),ca=useCallback(C=>{Z(C),setTimeout(rt,0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>{if(R){let $={...R,description:C};Ut($);}},800);},[R,Ut,rt]),xa=useCallback(C=>{Ce(C),Ie.current&&clearTimeout(Ie.current),Ie.current=setTimeout(()=>{if(R&&C.trim()){let $={...R,name:C.trim()};Ut($);}},800);},[R,Ut]),W=useCallback(C=>{let $=C.map(pe=>{let K={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:pe};return pe.type.startsWith("image/")&&(K.preview=URL.createObjectURL(pe)),K});pt(pe=>[...pe,...$]);},[]),ie=useCallback(C=>{pt($=>{let pe=$.find(K=>K.id===C);return pe?.preview&&URL.revokeObjectURL(pe.preview),$.filter(K=>K.id!==C)});},[]),st=useCallback(async()=>{if(!(!R||!Me.trim()&&dt.length===0||!x)){at(true);try{let C=sp(Me,b),$=[];if(dt.length>0&&h){let pe=dt.map(K=>K.file);$=await h(pe);}await x(R.id,Me.trim(),C.length>0?C:void 0,$.length>0?$:void 0),Pe(""),dt.forEach(pe=>{pe.preview&&URL.revokeObjectURL(pe.preview);}),pt([]);}finally{at(false);}}},[R,Me,dt,x,b,h]),Kt=useCallback(()=>{if(!R||!jt.trim())return;let C=R.subtasks||[],$={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:jt.trim(),progress:0,startDate:new Date,endDate:new Date,position:C.length},pe=[...C,$],K={...R,subtasks:pe};Ut(K),Mt(""),mt(false);},[R,jt,Ut]),re=useCallback(C=>{if(!R?.subtasks)return;let $=R.subtasks.map(K=>K.id===C?{...K,progress:K.progress===100?0:100}:K),pe={...R,subtasks:$};Ut(pe);},[R,Ut]),ve=useCallback(C=>{if(!R?.subtasks)return;let $=R.subtasks.filter(K=>K.id!==C),pe={...R,subtasks:$};Ut(pe);},[R,Ut]),Nt=useCallback(C=>{let $=typeof C=="string"?new Date(C):C,K=new Date().getTime()-$.getTime(),Ze=Math.floor(K/6e4),wt=Math.floor(K/36e5),kt=Math.floor(K/864e5);return Ze<1?o==="es"?"Ahora":"Just now":Ze<60?o==="es"?`Hace ${Ze} min`:`${Ze}m ago`:wt<24?o==="es"?`Hace ${wt}h`:`${wt}h ago`:kt<7?o==="es"?`Hace ${kt}d`:`${kt}d ago`:$.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),ft=useCallback(C=>{if(!R)return;let $=R.progress||0;C==="completed"?$=100:C==="in-progress"&&$===0?$=10:C==="todo"&&($=0);let pe={...R,status:C,progress:$};Ut(pe),$e(false);},[R,Ut]),ut=useCallback((C,$)=>{if(!R)return;let pe={...R,startDate:C,endDate:$};Ut(pe);},[R,Ut]),it=useCallback(()=>{let C=Ve.getFullYear(),$=Ve.getMonth(),pe=new Date(C,$,1),Ze=new Date(C,$+1,0).getDate(),wt=pe.getDay(),kt=[],Zt=new Date(C,$,0).getDate();for(let qt=wt-1;qt>=0;qt--)kt.push({date:new Date(C,$-1,Zt-qt),isCurrentMonth:false});for(let qt=1;qt<=Ze;qt++)kt.push({date:new Date(C,$,qt),isCurrentMonth:true});let ea=42-kt.length;for(let qt=1;qt<=ea;qt++)kt.push({date:new Date(C,$+1,qt),isCurrentMonth:false});return kt},[Ve]),q=useCallback(async C=>{if(C.preventDefault(),C.stopPropagation(),gt(false),!R||!m)return;let $=Array.from(C.dataTransfer.files);if($.length!==0){se(true);try{await m(R.id,$);}finally{se(false);}}},[R,m]),le=useCallback(async C=>{if(!R||!m||!C.target.files)return;let $=Array.from(C.target.files);if($.length!==0){se(true);try{await m(R.id,$);}finally{se(false);}C.target.value="";}},[R,m]),ge=useCallback(C=>{C.preventDefault(),C.stopPropagation(),gt(true);},[]),H=useCallback(C=>{C.preventDefault(),C.stopPropagation(),gt(false);},[]),fe=useCallback(C=>C<1024?`${C} B`:C<1024*1024?`${(C/1024).toFixed(1)} KB`:`${(C/(1024*1024)).toFixed(1)} MB`,[]),_e=useCallback(C=>C.startsWith("image/")?Image:C.includes("pdf")||C.includes("document")?FileText:File,[]);return !t||!R?null:jsx(AnimatePresence,{children:t&&R&&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:c("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",L?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:c("px-6 py-3 border-b flex items-center gap-3 h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:c("text-xs px-2 py-0.5 rounded",L?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:c("text-xs font-mono",L?"text-[#6B7280]":"text-gray-400"),children:R.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 C=R.progress===100?0:100,pe={...R,progress:C,status:C===100?"completed":"todo"};Ut(pe);},className:c("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":L?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ue,onChange:C=>xa(C.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:c("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",R.progress===100?"line-through text-[#6B7280]":L?"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:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{_t(),$e(!Ne);},className:c("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?o==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:Ne&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>$e(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(C=>jsxs("button",{onClick:()=>ft(C.id),className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",R.status===C.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",C.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:C.label})]},C.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{_t(),Re(!xe);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((C,$)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:C.color||"#8B5CF6"},title:C.name,children:C.initials||C.name.slice(0,2).toUpperCase()},$)),R.assignees.length>3&&jsxs("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:c("text-sm",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:c("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Re(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:l.length>0?l.map(C=>{let $=R.assignees?.some(pe=>pe.name===C.name);return jsxs("button",{onClick:()=>{let pe=R.assignees||[],K;$?K=pe.filter(Ze=>Ze.name!==C.name):K=[...pe,C],Wt("assignees",K);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",$&&(L?"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:C.color||"#8B5CF6"},children:C.initials||C.name.slice(0,2).toUpperCase()}),jsx("span",{className:c("flex-1",L?"text-white":"text-gray-900"),children:C.name}),$&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},C.name)}):jsx("div",{className:c("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Ee(De?null:"start"),ot(R.startDate||new Date);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:c("mx-1",L?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:De&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:c("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:C=>C.stopPropagation(),children:[jsxs("div",{className:c("w-44 py-2 border-r",L?"border-white/10":"border-gray-200"),children:[(()=>{let C=new Date,$=new Date(C);$.setDate(C.getDate()+1);let pe=new Date(C);pe.setDate(C.getDate()+((6-C.getDay()+7)%7||7));let K=new Date(C);K.setDate(C.getDate()+((1-C.getDay()+7)%7||7));let Ze=new Date(C);Ze.setDate(C.getDate()+(6-C.getDay()+7)%7+7);let wt=new Date(C);wt.setDate(C.getDate()+14);let kt=new Date(C);return kt.setDate(C.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:C,display:C.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:$,display:$.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:pe,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:K,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:Ze,display:Ze.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:wt,display:wt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:kt,display:kt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((ea,qt)=>jsxs("button",{className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(De==="start"){let cr=R.endDate&&ea.date>R.endDate?ea.date:R.endDate;ut(ea.date,cr),Ee("end");}else {let cr=R.startDate&&ea.date<R.startDate?ea.date:R.startDate;ut(cr,ea.date),Ee(null);}},children:[jsx("span",{children:ea.label}),jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:ea.display})]},qt))})(),jsx("div",{className:c("border-t mt-2 pt-2",L?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{ut(void 0,void 0),Ee(null);},className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",L?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:c("text-xs mb-3 px-2 py-1 rounded",L?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:De==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:c("font-medium",L?"text-white":"text-gray-900"),children:Ve.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>ot(new Date),className:c("p-1 rounded text-sm transition-colors",L?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>ot(new Date(Ve.getFullYear(),Ve.getMonth()-1)),className:c("p-1 rounded",L?"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:()=>ot(new Date(Ve.getFullYear(),Ve.getMonth()+1)),className:c("p-1 rounded",L?"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:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(C=>jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",L?"text-[#6B7280]":"text-gray-400"),children:C},C))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:it().map((C,$)=>{let pe=C.date.toDateString()===new Date().toDateString(),K=R.startDate?.toDateString()===C.date.toDateString(),Ze=R.endDate?.toDateString()===C.date.toDateString(),wt=K||Ze,kt=R.startDate&&R.endDate&&C.date>=R.startDate&&C.date<=R.endDate;return jsx("button",{onClick:()=>{let Zt=new Date(C.date);if(De==="start"){let ea=R.endDate&&Zt>R.endDate?Zt:R.endDate;ut(Zt,ea),Ee("end");}else {let ea=R.startDate&&Zt<R.startDate?Zt:R.startDate;ut(ea,Zt),Ee(null);}},className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!C.isCurrentMonth&&(L?"text-[#4B5563]":"text-gray-300"),C.isCurrentMonth&&(L?"text-white":"text-gray-900"),pe&&"ring-2 ring-[#00E5CC]",K&&"bg-[#00E5CC] text-white",Ze&&!K&&"bg-[#7C3AED] text-white",kt&&!wt&&(L?"bg-[#7C3AED]/20":"bg-purple-100"),!wt&&(L?"hover:bg-white/10":"hover:bg-gray-100")),children:C.date.getDate()},$)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{_t(),te(!z);},className:c("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":L?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?o==="es"?"Alta":"High":R.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:z&&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:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(C=>jsxs("button",{onClick:()=>{Wt("priority",C.id),te(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",R.priority===C.id&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",C.color)}),jsx("span",{className:L?"text-white":"text-gray-900",children:C.label})]},C.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:c("w-4 h-4 rounded-full border-2",L?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[he?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:C=>{let $=parseInt(C.target.value),pe=R.status;$===100?pe="completed":$>0?pe="in-progress":pe="todo";let K={...R,progress:$,status:pe};Ut(K);},onBlur:()=>Ge(false),className:c("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",L?"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-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ge(true),className:c("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",L?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:c("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:c("text-sm font-medium min-w-[40px]",L?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),v&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsx("span",{className:c("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?Vn(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>Lt("estimate"),className:c("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Vn(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>Lt("estimate"),className:c("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:lt==="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(fo,{mode:"estimate",locale:o,isDark:L,currentValue:w?.estimateMinutes||null,onSave:async C=>{await E?.(R.id,C),Lt(false);},onClose:()=>Lt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:ae?jsx("span",{className:c("text-sm select-none blur-[4px] opacity-60 pointer-events-none",L?"text-[#94A3B8]":"text-gray-500"),title:o==="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"}):R.status==="completed"||R.progress===100?jsx("span",{className:c("text-sm px-2 py-0.5 cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?Vn(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>Lt("quoted"),className:c("text-sm px-2 py-0.5 rounded",L?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Vn(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>Lt("quoted"),className:c("text-sm",L?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:lt==="quoted"&&!ae&&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(fo,{mode:"quoted",locale:o,isDark:L,currentValue:R.quotedMinutes||null,onSave:async C=>{P?(await P(R.id,C),J($=>$?{...$,quotedMinutes:C}:null)):Wt("quotedMinutes",C),Lt(false);},onClose:()=>Lt(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsx("div",{className:c("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",L?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):S?jsxs("button",{type:"button",onClick:()=>j?.(R.id),className:c("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"}),Sh(F||0)]}):jsx("button",{type:"button",onClick:()=>k?.(R.id),className:c("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",L?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),R.status==="completed"||R.progress===100?jsxs("div",{className:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",L?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>Lt("log"),className:c("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",L?"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"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:c("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":L?"text-white":"text-gray-900"),children:[Vn(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:c("font-normal",L?"text-[#6B7280]":"text-gray-400"),children:[" / ",Vn(w.estimateMinutes)]})]}),w.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:c("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:lt==="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(fo,{mode:"log",locale:o,isDark:L,currentValue:null,onSave:async(C,$)=>{C&&await T?.(R.id,{durationMinutes:C,note:$,source:"manual"}),Lt(false);},onClose:()=>Lt(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(Wo,{selectedTags:R.tags||[],availableTags:d,onChange:C=>{Wt("tags",C);},onCreateTag:i,theme:X$1})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:c("w-4 h-4 mt-1.5",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0 mt-1",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(C=>{let $=g.find(pe=>pe.id===C);return jsxs("span",{className:c("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",L?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[$?.name||C.slice(0,8),jsx("button",{onClick:()=>{let pe=(R.dependencies||[]).filter(K=>K!==C);Wt("dependencies",pe);},className:c("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},C)})}),jsxs("button",{onClick:()=>{_t(),He(!je);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"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:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{He(false),Dt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:c("p-2 border-b",L?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Ct,onChange:C=>Dt(C.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:c("w-full px-3 py-2 rounded-md text-sm outline-none",L?"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:g.length>0?g.filter(C=>C.id!==R.id).filter(C=>Ct===""||C.name.toLowerCase().includes(Ct.toLowerCase())).map(C=>{let $=R.dependencies?.includes(C.id);return jsxs("button",{onClick:()=>{let pe=R.dependencies||[],K;$?K=pe.filter(Ze=>Ze!==C.id):K=[...pe,C.id],Wt("dependencies",K);},className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",L?"hover:bg-white/5":"hover:bg-gray-50",$&&(L?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:c("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",$?"bg-[#00E5CC] border-[#00E5CC]":L?"border-white/30":"border-gray-300"),children:$&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:c("block truncate",L?"text-white":"text-gray-900"),children:C.name}),jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:C.id.slice(0,8)})]})]},C.id)}):jsx("div",{className:c("px-3 py-4 text-sm text-center",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{_t(),ze(!Je);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",L?"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:R.color||"#6366F1"}}),jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:fn.find(C=>C.value===R.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:c("w-3 h-3",L?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Je&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>ze(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:c("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",L?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:fn.map(C=>{let $=R.color===C.value;return jsx("button",{onClick:()=>{Wt("color",C.value),ze(false);},className:c("w-7 h-7 rounded-full flex items-center justify-center transition-all",$&&"ring-2 ring-offset-2",L?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:C.value,outlineColor:$?C.value:void 0},title:C.name,children:$&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},C.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:c("text-sm w-28 truncate flex-shrink-0",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:C=>Wt("isMilestone",C.target.checked),className:c("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":L?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:c("text-sm",L?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:c("w-4 h-4",L?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ee,value:B,onChange:C=>ca(C.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:c("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",L?"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:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(C=>C.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((C,$)=>(C.position??0)-($.position??0)).map(C=>jsxs("div",{className:c("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",L?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>re(C.id),className:c("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",C.progress===100?"bg-green-500 border-green-500":L?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:C.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:c("text-sm flex-1",C.progress===100?"line-through text-[#6B7280]":L?"text-white":"text-gray-900"),children:C.name}),jsx("button",{onClick:()=>ve(C.id),className:c("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",L?"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"})})]},C.id))}),zt?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:jt,onChange:C=>Mt(C.target.value),onKeyDown:C=>{C.key==="Enter"&&jt.trim()?Kt():C.key==="Escape"&&(mt(false),Mt(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:c("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",L?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:Kt,disabled:!jt.trim(),className:c("px-3 py-2 rounded-lg text-sm font-medium transition-colors",jt.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":L?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{mt(false),Mt("");},className:c("p-2 rounded-lg transition-colors",L?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>mt(true),className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",L?"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"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:c("mt-6 pt-4 border-t",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:c("text-sm font-semibold mb-3",L?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(C=>{let $=_e(C.type),pe=C.type.startsWith("image/");return jsxs("div",{className:c("flex items-center gap-3 p-2 rounded-lg group transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[pe&&C.thumbnailUrl?jsx("img",{src:C.thumbnailUrl,alt:C.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:c("w-10 h-10 rounded flex items-center justify-center",L?"bg-white/10":"bg-gray-200"),children:jsx($,{className:c("w-5 h-5",L?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:C.url,target:"_blank",rel:"noopener noreferrer",className:c("text-sm font-medium truncate block hover:underline",L?"text-white":"text-gray-900"),children:C.name}),jsx("p",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:fe(C.size)})]}),p&&jsx("button",{onClick:()=>p(C.id),className:c("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",L?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},C.id)})}),jsxs("div",{onDragOver:ge,onDragLeave:H,onDrop:q,className:c("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",ke?L?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":L?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",A&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:le,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!m||A}),A?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:c("w-6 h-6 mx-auto mb-2",ke?"text-[#00E5CC]":L?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-500"),children:ke?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="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"})]})}),!m&&jsx("p",{className:c("text-xs mt-1",L?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:c("w-96 border-l flex flex-col",L?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between h-[49px]",L?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:c("text-sm font-semibold",L?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:c("ml-2 text-xs font-normal",L?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:c("p-1.5 rounded transition-colors",L?"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: ${L?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:Dt,className:c("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((C,z)=>{let ve=typeof C.createdAt=="string"?new Date(C.createdAt):C.createdAt,Y=typeof z.createdAt=="string"?new Date(z.createdAt):z.createdAt;return ve.getTime()-Y.getTime()}).map(C=>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:C.user?.color||"#8B5CF6"},children:C.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:c("text-sm font-medium",L?"text-white":"text-gray-900"),children:C.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Tt(C.createdAt)})]}),jsx("div",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx(sp,{content:C.content,theme:s})}),C.attachments&&C.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:C.attachments.map(z=>{let ve=z.type.startsWith("image/");return jsxs("a",{href:z.url,target:"_blank",rel:"noopener noreferrer",className:c("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[ve?jsx(Image,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:c("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:z.name})]},z.id)})})]})]},C.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:c("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:c("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:c("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsx(np,{value:Me,onChange:Pe,onSubmit:st,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:nt,theme:s,locale:o,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:dt,onFilesSelect:W,onRemoveFile:le})})]})]})]})})}function ed(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function zo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:l,isLoading:d,error:i,children:u,availableTags:m=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:f,onDeleteAttachment:x,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:N,enableTimeTracking:D,timeTrackingSummary:F,timeEntries:T,timerState:S,onLogTime:P,onUpdateEstimate:k,onUpdateSoldEffort:j,onStartTimer:U,onStopTimer:ae,onDiscardTimer:L,blurFinancials:X=false,sidePanel:K,renderColumnMetrics:V,suppressDetailModal:R=false}){let[J,Te]=ed(),[$e,H]=useState(null),[te,ye]=useState(false),Re=useRef(null),Se=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ee=n?.theme||"dark",Ve=Ee==="dark"||Ee==="neutral",ot=Ve?"dark":"",be=useCallback((A,ie)=>{t.onCardUpdate?.(A,ie);},[t]),Ge=useCallback((A,ie)=>{t.onColumnUpdate?.(A,{title:ie});},[t]),je=useCallback(A=>{t.onColumnDelete?.(A);},[t]),He=["todo","in-progress","completed"],wt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Nt=useMemo(()=>{let A=new Map;return e.columns.forEach(ie=>{let B=ie.cardIds.map(Z=>e.cards.find(O=>O.id===Z)).filter(Z=>Z!==void 0).sort((Z,O)=>Z.position-O.position);A.set(ie.id,B);}),A},[e.cards,e.columns]);useEffect(()=>{let A=Re.current;if(!A)return;let ie=ee=>{let Ue=ee.target,ke=ee.button===1,Be=Ue===A||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(ke||ee.button===0&&Be&&!J.isDragging)&&(ee.preventDefault(),ye(true),Se.current={x:ee.clientX,y:ee.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},A.style.cursor="grabbing",A.style.userSelect="none");},B=ee=>{if(!te)return;let Ue=ee.clientX-Se.current.x,ke=ee.clientY-Se.current.y;A.scrollLeft=Se.current.scrollLeft-Ue,A.scrollTop=Se.current.scrollTop-ke;},Z=()=>{te&&(ye(false),A.style.cursor="",A.style.userSelect="");},O=()=>{te&&(ye(false),A.style.cursor="",A.style.userSelect="");};return A.addEventListener("mousedown",ie),document.addEventListener("mousemove",B),document.addEventListener("mouseup",Z),A.addEventListener("mouseleave",O),()=>{A.removeEventListener("mousedown",ie),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",Z),A.removeEventListener("mouseleave",O);}},[te,J.isDragging]);let Je=useMemo(()=>e.cards.map(A=>({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(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(ie=>typeof ie=="string"?ie:ie.taskId):[]})),[e.cards]),ze=useCallback(A=>{let{active:ie}=A,B=e.cards.find(Z=>Z.id===ie.id);B&&Te({isDragging:true,draggedCardId:B.id,sourceColumnId:B.columnId,targetColumnId:B.columnId});},[e.cards,Te]),lt=useCallback(A=>{let{active:ie,over:B}=A;if(!B||!e.cards.find(ee=>ee.id===ie.id))return;let O=null;B.data.current?.type==="column"?O=B.id:B.data.current?.type==="card"&&(O=e.cards.find(Ue=>Ue.id===B.id)?.columnId||null),O&&O!==J.targetColumnId&&Te({...J,targetColumnId:O});},[e.cards,J,Te]),At=useCallback(async A=>{let{active:ie,over:B}=A;if(Te({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!B)return;let Z=e.cards.find(ke=>ke.id===ie.id);if(!Z)return;let O,ee;if(B.data.current?.type==="column"){O=B.id;let ke=Nt.get(O)||[];ee=Rl(ke,0);}else {let ke=e.cards.find(Pe=>Pe.id===B.id);if(!ke)return;O=ke.columnId;let Be=Nt.get(O)||[],Me=Be.findIndex(Pe=>Pe.id===B.id);ee=Rl(Be,Me);}let Ue=e.columns.find(ke=>ke.id===O);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let ke=Nt.get(O)||[];if(Z.columnId!==O&&ke.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,Z);return}}(Z.columnId!==O||Z.position!==ee)&&await t.onCardMove?.(Z.id,O,ee);},[e.cards,e.columns,Nt,t,Te]),Ne=useCallback(A=>{R||H(A),a?.(A),w?.(A.id);},[a,w,R]),ft=useCallback(A=>{t.onCardUpdate?.(A.id,A),H(A);},[t]);return d?jsx("div",{className:c("asakaa-board",ot,o),style:l,children:jsx(zh,{columnCount:3})}):i?jsx("div",{className:c("asakaa-board",ot,o),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(Iu,{themeName:Ee,children:[jsxs("div",{className:c("flex h-full overflow-hidden",K?"flex-row":""),children:[jsxs(DndContext,{sensors:wt,collisionDetection:closestCorners,onDragStart:ze,onDragOver:lt,onDragEnd:At,children:[jsxs("div",{ref:Re,className:c("asakaa-board",K?"flex-1":"",ot,o),style:{...l,cursor:te?"grabbing":void 0},"data-theme":Ee,children:[e.columns.sort((A,ie)=>A.position-ie.position).map(A=>{let ie=Nt.get(A.id)||[],B=!He.includes(A.id),Z=r?.renderColumnFooter?.(A);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Rn,{column:A,cards:ie,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:V?(O,ee)=>V(O,ee):void 0,onCardClick:Ne,onCardUpdate:be,onColumnRename:t.onColumnUpdate?Ge:void 0,onColumnDelete:t.onColumnDelete?je:void 0,isDeletable:B,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),Z]},A.id)}),u]}),jsx(DragOverlay,{children:J.draggedCardId?jsx(wo,{card:e.cards.find(A=>A.id===J.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),K]}),!R&&jsx(Co,{task:$e,isOpen:!!$e,onClose:()=>H(null),onCardUpdate:ft,theme:Ve?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:m,onCreateTag:p,attachments:$e?g?.get($e.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:Je,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:N,enableTimeTracking:D,timeTrackingSummary:F,timeEntries:T,isTimerRunning:S?.isRunning,timerElapsedSeconds:S?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:k,onSoldEffortUpdate:j,onTimerStart:U,onTimerStop:ae,onTimerDiscard:L,blurFinancials:X})]})}function zh({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 jh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},_h={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:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Kh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},qh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Yh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let d=i=>{t(i),o(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||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,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>d(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor: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 Xh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[l,d]=useState(null),i=useRef(null);if(useEffect(()=>{let g=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||n))return null;let m=[{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:n}].filter(g=>g.handler),p=async(g,f)=>{if(f){d(g);try{await f();}catch(x){console.error(`Export ${g} failed:`,x);}finally{d(null),o(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!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:m.map((g,f)=>jsxs(motion.button,{onClick:()=>p(g.id,g.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:f<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.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===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 Jh({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, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function ad({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:d,translations:i,toolbarRightContent:u,toolbarEndContent:m}){let p=r==="dark"?jh:_h,g={...n==="es"?Kh:qh,...i},f=o||l||d;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Xh,{theme:p,t:g,onExportCSV:o,onExportJSON:l,onExportExcel:d}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),m,t&&(s?jsx(Yh,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Jh,{onClick:()=>t(),label:a||g.newTask}))]})})}function od({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[l,d]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),d(""),o(false));},[l,e]),u=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(d(""),o(false));},[i]),m=useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);return s?jsx("div",{className:c("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:p=>d(p.target.value),onKeyDown:u,onBlur:m,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:()=>{d(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:c("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,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 un({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[d,i]=useState(""),[u,m]=useState(void 0),[p,g]=useState(null),[f,x]=useState(null),[y,b]=useState(false),[h,v]=useState(false),[w,N]=useState(false),[D,F]=useState(s||new Date),T=useRef(null),S=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let k=useCallback(()=>{b(false),v(false),N(false);},[]),j=useCallback(()=>{i(""),m(void 0),g(null),x(null),k(),t();},[t,k]),U=useCallback(()=>{let X=d.trim();if(!X)return;let K=a.find(R=>R.id===p),V=f||s;e({name:X,priority:u,assignee:K||void 0,assigneeId:p,startDate:V,endDate:V}),i(""),m(void 0),g(null),x(null),k(),T.current?.focus();},[d,u,p,f,s,a,e,k]),ae=useCallback(X=>{X.key==="Enter"&&d.trim()&&(X.preventDefault(),U()),X.key==="Escape"&&j();},[U,j,d]),L=f||s||new Date;return jsxs("div",{className:c("quick-task-create",o),onClick:()=>k(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:d,onChange:X=>i(X.target.value),placeholder:S?"Nombre de la tarea...":"Task name...",className:c("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ae})}),jsxs("div",{className:c("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),b(!y),v(false),N(false);},type:"button",className:c("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:S?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:S?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:S?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:S?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:S?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{m(X.id),b(false);},type:"button",className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),N(!w),b(false),v(false),F(f||s||new Date);},type:"button",className:c("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),L.toLocaleDateString(S?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:c("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,K=new Date(X);K.setDate(X.getDate()+1);let V=new Date(X);V.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let R=new Date(X);R.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let J=new Date(X);J.setDate(X.getDate()+14);let Te=new Date(X);Te.setDate(X.getDate()+28);let $e=S?"es-ES":"en-US";return [{label:S?"Hoy":"Today",date:X,display:X.toLocaleDateString($e,{weekday:"short"}).slice(0,3)+"."},{label:S?"Ma\xF1ana":"Tomorrow",date:K,display:K.toLocaleDateString($e,{weekday:"short"}).slice(0,3)+"."},{label:S?"Este fin de semana":"This weekend",date:V,display:S?"s\xE1b.":"sat."},{label:S?"Pr\xF3xima semana":"Next week",date:R,display:S?"lun.":"mon."},{label:S?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString($e,{day:"numeric",month:"short"})},{label:S?"4 semanas":"4 weeks",date:Te,display:Te.toLocaleDateString($e,{day:"numeric",month:"short"})}].map((te,ye)=>jsxs("button",{type:"button",className:c("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(te.date),N(false);},children:[jsx("span",{children:te.label}),jsx("span",{className:c("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:te.display})]},ye))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:c("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:D.toLocaleDateString(S?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>F(new Date),className:c("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:S?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>F(new Date(D.getFullYear(),D.getMonth()-1)),className:c("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>F(new Date(D.getFullYear(),D.getMonth()+1)),className:c("p-0.5 rounded",r?"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:(S?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:c("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=D.getFullYear(),K=D.getMonth(),V=new Date(X,K,1).getDay(),R=new Date(X,K+1,0).getDate(),J=new Date(X,K,0).getDate(),Te=new Date().toDateString(),$e=[];for(let te=V-1;te>=0;te--)$e.push({dayNum:J-te,isCurrent:false,date:new Date(X,K-1,J-te)});for(let te=1;te<=R;te++)$e.push({dayNum:te,isCurrent:true,date:new Date(X,K,te)});let H=42-$e.length;for(let te=1;te<=H;te++)$e.push({dayNum:te,isCurrent:false,date:new Date(X,K+1,te)});return $e.map((te,ye)=>{let Re=te.date.toDateString()===Te,Se=(f||s)?.toDateString()===te.date.toDateString();return jsx("button",{type:"button",className:c("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!te.isCurrent&&(r?"text-white/20":"text-gray-300"),te.isCurrent&&(r?"text-white":"text-gray-900"),Re&&"ring-1 ring-[#007FFF]",Se&&"bg-[#007FFF] text-white",!Se&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(te.date),N(false);},children:te.dayNum},ye)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),v(!h),b(false),N(false);},type:"button",className:c("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(X=>X.id===p)?.color||"#007FFF"},children:a.find(X=>X.id===p)?.initials||a.find(X=>X.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),v(false);},className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:c("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:S?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxs("button",{type:"button",onClick:()=>{g(X.id),v(false);},className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===X.id&&(r?"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-mono font-bold",style:{backgroundColor:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsx("div",{className:c("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:S?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:U,disabled:!d.trim(),type:"button",className:c("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",d.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:S?"Guardar":"Save"})]})]})}function dd({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[d,i]=useState(false),u=useRef(null),m=useRef(null),[p,g]=useState({}),[f,x]=useState(false),y=o==="dark",h={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!d||!u.current)return;let w=90,N=()=>{let D=u.current.getBoundingClientRect(),T=window.innerHeight-D.bottom<w+8;x(T),g({position:"fixed",...T?{bottom:window.innerHeight-D.top+4}:{top:D.bottom+4},left:D.left,width:D.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[d]),useEffect(()=>{if(!d)return;let w=N=>{let D=N.target;m.current&&!m.current.contains(D)&&u.current&&!u.current.contains(D)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]);let v=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:u,className:c("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!d),disabled:s,className:"asakaa-add-card__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"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:d&&jsx(motion.div,{ref:m,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:p,className:c("rounded-lg shadow-2xl",y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(un,{onSubmit:v,onCancel:()=>i(false),availableUsers:a,isDark:y,locale:l,dropdownDirection:"up"})})}),document.body)]})}var Ts=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(zo,{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 n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(n=>`"${n}"`).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((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function $p(e={}){return new Ts(e)}var Hn=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:n,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}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=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:o?`Error in ${o}`:"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"})]})]})}):n}};function cd(e,t){let a=r=>jsx(Hn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function pd({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:d,shortcut:i="k",className:u=""}){let[m,p]=useState(false),[g,f]=useState(""),[x,y]=useState("home"),[b,h]=useState(""),[v,w]=useState("");useEffect(()=>{let T=S=>{(S.metaKey||S.ctrlKey)&&S.key===i&&(S.preventDefault(),p(P=>!P)),S.key==="Escape"&&(p(false),y("home"),f(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),useEffect(()=>{m||(y("home"),f(""),h(""),w(""));},[m]);let N=useCallback(()=>{p(false);},[]),D=useCallback(T=>{let[S,P]=T.split(":");switch(S){case "create-card":y("create-card");break;case "create-card-in":h(P||"");break;case "navigate":P?(a?.(P),N()):y("navigate");break;case "search":r?.(g),N();break;case "priority":y("priority");break;case "set-priority":v&&P&&(n?.(v,P),N());break;case "assign":y("assign");break;case "assign-user":v&&P&&(s?.(v,P),N());break;case "ai":y("ai");break;case "ai-generate-plan":o?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":d?.(),N();break;case "back":y("home");break;}},[g,v,t,a,r,n,s,o,l,d,N]),F=useCallback(()=>{b&&g.trim()&&(t?.(b,g.trim()),N());},[b,g,t,N]);return m?jsx(ea,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:f,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:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&x==="create-card"&&b&&F();}}),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."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:D,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:D,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:D,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:D,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(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:D,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(S=>jsx("span",{className:"command-palette-item-label",children:S},S))})]},T.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,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(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:D,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:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,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(T=>{let S=e.columns.find(P=>P.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:D,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:S?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},T.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:D,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:D,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:D,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:D,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 Up(e,t,a,r,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:Pt,className:c("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",L?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((C,$)=>{let pe=typeof C.createdAt=="string"?new Date(C.createdAt):C.createdAt,K=typeof $.createdAt=="string"?new Date($.createdAt):$.createdAt;return pe.getTime()-K.getTime()}).map(C=>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:C.user?.color||"#8B5CF6"},children:C.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:c("text-sm font-medium",L?"text-white":"text-gray-900"),children:C.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:c("text-xs",L?"text-[#6B7280]":"text-gray-400"),children:Nt(C.createdAt)})]}),jsx("div",{className:c("text-sm",L?"text-[#9CA3AF]":"text-gray-600"),children:jsx(lp,{content:C.content,theme:s})}),C.attachments&&C.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:C.attachments.map($=>{let pe=$.type.startsWith("image/");return jsxs("a",{href:$.url,target:"_blank",rel:"noopener noreferrer",className:c("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",L?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[pe?jsx(Image,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:c("w-4 h-4",L?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:c("text-xs truncate max-w-[100px]",L?"text-white":"text-gray-900"),children:$.name})]},$.id)})})]})]},C.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:c("w-10 h-10 mb-3",L?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:c("text-sm",L?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:c("py-4 pl-4 pr-2 border-t",L?"border-white/10":"border-gray-200"),children:jsx(ip,{value:Me,onChange:Pe,onSubmit:st,users:b,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!x,isSubmitting:nt,theme:s,locale:o,currentUser:y,enableEmoji:true,enableAttachments:!!h,pendingFiles:dt,onFilesSelect:W,onRemoveFile:ie})})]})]})]})})}function ad(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function jo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:l,isLoading:d,error:i,children:u,availableTags:m=[],onCreateTag:p,attachmentsByCard:g,onUploadAttachments:f,onDeleteAttachment:x,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onTaskOpen:w,onUploadCommentAttachments:N,enableTimeTracking:S,timeTrackingSummary:F,timeEntries:T,timerState:E,onLogTime:P,onUpdateEstimate:k,onUpdateSoldEffort:j,onStartTimer:U,onStopTimer:ae,onDiscardTimer:L,blurFinancials:X=false,sidePanel:Y,renderColumnMetrics:V,suppressDetailModal:R=false}){let[J,Ne]=ad(),[$e,z]=useState(null),[te,xe]=useState(false),Re=useRef(null),De=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Ee=n?.theme||"dark",Ve=Ee==="dark"||Ee==="neutral",ot=Ve?"dark":"",he=useCallback((A,se)=>{t.onCardUpdate?.(A,se);},[t]),Ge=useCallback((A,se)=>{t.onColumnUpdate?.(A,{title:se});},[t]),je=useCallback(A=>{t.onColumnDelete?.(A);},[t]),He=["todo","in-progress","completed"],Ct=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Dt=useMemo(()=>{let A=new Map;return e.columns.forEach(se=>{let B=se.cardIds.map(Z=>e.cards.find(O=>O.id===Z)).filter(Z=>Z!==void 0).sort((Z,O)=>Z.position-O.position);A.set(se.id,B);}),A},[e.cards,e.columns]);useEffect(()=>{let A=Re.current;if(!A)return;let se=ee=>{let Ue=ee.target,Ce=ee.button===1,Ie=Ue===A||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(Ce||ee.button===0&&Ie&&!J.isDragging)&&(ee.preventDefault(),xe(true),De.current={x:ee.clientX,y:ee.clientY,scrollLeft:A.scrollLeft,scrollTop:A.scrollTop},A.style.cursor="grabbing",A.style.userSelect="none");},B=ee=>{if(!te)return;let Ue=ee.clientX-De.current.x,Ce=ee.clientY-De.current.y;A.scrollLeft=De.current.scrollLeft-Ue,A.scrollTop=De.current.scrollTop-Ce;},Z=()=>{te&&(xe(false),A.style.cursor="",A.style.userSelect="");},O=()=>{te&&(xe(false),A.style.cursor="",A.style.userSelect="");};return A.addEventListener("mousedown",se),document.addEventListener("mousemove",B),document.addEventListener("mouseup",Z),A.addEventListener("mouseleave",O),()=>{A.removeEventListener("mousedown",se),document.removeEventListener("mousemove",B),document.removeEventListener("mouseup",Z),A.removeEventListener("mouseleave",O);}},[te,J.isDragging]);let Je=useMemo(()=>e.cards.map(A=>({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(),dependencies:Array.isArray(A.dependencies)?A.dependencies.map(se=>typeof se=="string"?se:se.taskId):[]})),[e.cards]),ze=useCallback(A=>{let{active:se}=A,B=e.cards.find(Z=>Z.id===se.id);B&&Ne({isDragging:true,draggedCardId:B.id,sourceColumnId:B.columnId,targetColumnId:B.columnId});},[e.cards,Ne]),lt=useCallback(A=>{let{active:se,over:B}=A;if(!B||!e.cards.find(ee=>ee.id===se.id))return;let O=null;B.data.current?.type==="column"?O=B.id:B.data.current?.type==="card"&&(O=e.cards.find(Ue=>Ue.id===B.id)?.columnId||null),O&&O!==J.targetColumnId&&Ne({...J,targetColumnId:O});},[e.cards,J,Ne]),Lt=useCallback(async A=>{let{active:se,over:B}=A;if(Ne({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!B)return;let Z=e.cards.find(Ce=>Ce.id===se.id);if(!Z)return;let O,ee;if(B.data.current?.type==="column"){O=B.id;let Ce=Dt.get(O)||[];ee=$l(Ce,0);}else {let Ce=e.cards.find(Pe=>Pe.id===B.id);if(!Ce)return;O=Ce.columnId;let Ie=Dt.get(O)||[],Me=Ie.findIndex(Pe=>Pe.id===B.id);ee=$l(Ie,Me);}let Ue=e.columns.find(Ce=>Ce.id===O);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let Ce=Dt.get(O)||[];if(Z.columnId!==O&&Ce.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,Z);return}}(Z.columnId!==O||Z.position!==ee)&&await t.onCardMove?.(Z.id,O,ee);},[e.cards,e.columns,Dt,t,Ne]),ke=useCallback(A=>{R||z(A),a?.(A),w?.(A.id);},[a,w,R]),gt=useCallback(A=>{t.onCardUpdate?.(A.id,A),z(A);},[t]);return d?jsx("div",{className:c("asakaa-board",ot,o),style:l,children:jsx(zh,{columnCount:3})}):i?jsx("div",{className:c("asakaa-board",ot,o),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(Ru,{themeName:Ee,children:[jsxs("div",{className:c("flex h-full overflow-hidden",Y?"flex-row":""),children:[jsxs(DndContext,{sensors:Ct,collisionDetection:closestCorners,onDragStart:ze,onDragOver:lt,onDragEnd:Lt,children:[jsxs("div",{ref:Re,className:c("asakaa-board",Y?"flex-1":"",ot,o),style:{...l,cursor:te?"grabbing":void 0},"data-theme":Ee,children:[e.columns.sort((A,se)=>A.position-se.position).map(A=>{let se=Dt.get(A.id)||[],B=!He.includes(A.id),Z=r?.renderColumnFooter?.(A);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Un,{column:A,cards:se,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:V?(O,ee)=>V(O,ee):void 0,onCardClick:ke,onCardUpdate:he,onColumnRename:t.onColumnUpdate?Ge:void 0,onColumnDelete:t.onColumnDelete?je:void 0,isDeletable:B,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight}),Z]},A.id)}),u]}),jsx(DragOverlay,{children:J.draggedCardId?jsx(So,{card:e.cards.find(A=>A.id===J.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),Y]}),!R&&jsx(Mo,{task:$e,isOpen:!!$e,onClose:()=>z(null),onCardUpdate:gt,theme:Ve?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:m,onCreateTag:p,attachments:$e?g?.get($e.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:x,availableTasks:Je,comments:y,onAddComment:b,currentUser:h,mentionableUsers:v,onUploadCommentAttachments:N,enableTimeTracking:S,timeTrackingSummary:F,timeEntries:T,isTimerRunning:E?.isRunning,timerElapsedSeconds:E?.elapsedSeconds,onTimeLog:P,onEstimateUpdate:k,onSoldEffortUpdate:j,onTimerStart:U,onTimerStop:ae,onTimerDiscard:L,blurFinancials:X})]})}function zh({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 jh={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},_h={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:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Kh={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},qh={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function Yh({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let i=u=>{l.current&&!l.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[s]);let d=i=>{t(i),o(false);};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||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,u)=>i.position-u.position).map((i,u)=>jsxs(motion.button,{onClick:()=>d(i.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor: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 Xh({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[l,d]=useState(null),i=useRef(null);if(useEffect(()=>{let g=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]),!(a||r||n))return null;let m=[{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:n}].filter(g=>g.handler),p=async(g,f)=>{if(f){d(g);try{await f();}catch(x){console.error(`Export ${g} failed:`,x);}finally{d(null),o(false);}}};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!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:m.map((g,f)=>jsxs(motion.button,{onClick:()=>p(g.id,g.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:f<m.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.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===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 Jh({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, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function od({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:l,onExportExcel:d,translations:i,toolbarRightContent:u,toolbarEndContent:m}){let p=r==="dark"?jh:_h,g={...n==="es"?Kh:qh,...i},f=o||l||d;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:p.bgGrid,borderColor:p.border},children:jsxs("div",{className:"flex items-center gap-3",children:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:p.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Xh,{theme:p,t:g,onExportCSV:o,onExportJSON:l,onExportExcel:d}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:p.borderLight}})]}),m,t&&(s?jsx(Yh,{columns:e,onSelect:t,theme:p,t:g,createTaskLabel:a}):jsx(Jh,{onClick:()=>t(),label:a||g.newTask}))]})})}function sd({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[l,d]=useState(""),i=useCallback(()=>{let p=l.trim();p&&(e(p),d(""),o(false));},[l,e]),u=useCallback(p=>{p.key==="Enter"?(p.preventDefault(),i()):p.key==="Escape"&&(d(""),o(false));},[i]),m=useCallback(()=>{setTimeout(()=>{l.trim()||o(false);},150);},[l]);return s?jsx("div",{className:c("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:l,onChange:p=>d(p.target.value),onKeyDown:u,onBlur:m,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:()=>{d(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:c("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,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 bn({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:l="up"}){let[d,i]=useState(""),[u,m]=useState(void 0),[p,g]=useState(null),[f,x]=useState(null),[y,b]=useState(false),[h,v]=useState(false),[w,N]=useState(false),[S,F]=useState(s||new Date),T=useRef(null),E=n==="es",P=l==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let k=useCallback(()=>{b(false),v(false),N(false);},[]),j=useCallback(()=>{i(""),m(void 0),g(null),x(null),k(),t();},[t,k]),U=useCallback(()=>{let X=d.trim();if(!X)return;let Y=a.find(R=>R.id===p),V=f||s;e({name:X,priority:u,assignee:Y||void 0,assigneeId:p,startDate:V,endDate:V}),i(""),m(void 0),g(null),x(null),k(),T.current?.focus();},[d,u,p,f,s,a,e,k]),ae=useCallback(X=>{X.key==="Enter"&&d.trim()&&(X.preventDefault(),U()),X.key==="Escape"&&j();},[U,j,d]),L=f||s||new Date;return jsxs("div",{className:c("quick-task-create",o),onClick:()=>k(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:d,onChange:X=>i(X.target.value),placeholder:E?"Nombre de la tarea...":"Task name...",className:c("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:ae})}),jsxs("div",{className:c("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),b(!y),v(false),N(false);},type:"button",className:c("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[{id:"urgent",label:E?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:E?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:E?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:E?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:E?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(X=>jsxs("button",{onClick:()=>{m(X.id),b(false);},type:"button",className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===X.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:c("w-2 h-2 rounded-full",X.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.label})]},X.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:X=>{X.stopPropagation(),N(!w),b(false),v(false),F(f||s||new Date);},type:"button",className:c("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),L.toLocaleDateString(E?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsx("div",{className:c("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let X=new Date,Y=new Date(X);Y.setDate(X.getDate()+1);let V=new Date(X);V.setDate(X.getDate()+((6-X.getDay()+7)%7||7));let R=new Date(X);R.setDate(X.getDate()+((1-X.getDay()+7)%7||7));let J=new Date(X);J.setDate(X.getDate()+14);let Ne=new Date(X);Ne.setDate(X.getDate()+28);let $e=E?"es-ES":"en-US";return [{label:E?"Hoy":"Today",date:X,display:X.toLocaleDateString($e,{weekday:"short"}).slice(0,3)+"."},{label:E?"Ma\xF1ana":"Tomorrow",date:Y,display:Y.toLocaleDateString($e,{weekday:"short"}).slice(0,3)+"."},{label:E?"Este fin de semana":"This weekend",date:V,display:E?"s\xE1b.":"sat."},{label:E?"Pr\xF3xima semana":"Next week",date:R,display:E?"lun.":"mon."},{label:E?"2 semanas":"2 weeks",date:J,display:J.toLocaleDateString($e,{day:"numeric",month:"short"})},{label:E?"4 semanas":"4 weeks",date:Ne,display:Ne.toLocaleDateString($e,{day:"numeric",month:"short"})}].map((te,xe)=>jsxs("button",{type:"button",className:c("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{x(te.date),N(false);},children:[jsx("span",{children:te.label}),jsx("span",{className:c("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:te.display})]},xe))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:c("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:S.toLocaleDateString(E?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>F(new Date),className:c("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:E?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>F(new Date(S.getFullYear(),S.getMonth()-1)),className:c("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>F(new Date(S.getFullYear(),S.getMonth()+1)),className:c("p-0.5 rounded",r?"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:(E?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(X=>jsx("div",{className:c("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:X},X))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let X=S.getFullYear(),Y=S.getMonth(),V=new Date(X,Y,1).getDay(),R=new Date(X,Y+1,0).getDate(),J=new Date(X,Y,0).getDate(),Ne=new Date().toDateString(),$e=[];for(let te=V-1;te>=0;te--)$e.push({dayNum:J-te,isCurrent:false,date:new Date(X,Y-1,J-te)});for(let te=1;te<=R;te++)$e.push({dayNum:te,isCurrent:true,date:new Date(X,Y,te)});let z=42-$e.length;for(let te=1;te<=z;te++)$e.push({dayNum:te,isCurrent:false,date:new Date(X,Y+1,te)});return $e.map((te,xe)=>{let Re=te.date.toDateString()===Ne,De=(f||s)?.toDateString()===te.date.toDateString();return jsx("button",{type:"button",className:c("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!te.isCurrent&&(r?"text-white/20":"text-gray-300"),te.isCurrent&&(r?"text-white":"text-gray-900"),Re&&"ring-1 ring-[#007FFF]",De&&"bg-[#007FFF] text-white",!De&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{x(te.date),N(false);},children:te.dayNum},xe)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:X=>{X.stopPropagation(),v(!h),b(false),N(false);},type:"button",className:c("p-1 rounded transition-colors",p?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:p?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(X=>X.id===p)?.color||"#007FFF"},children:a.find(X=>X.id===p)?.initials||a.find(X=>X.id===p)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:l==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:l==="up"?-5:5},className:c("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",P,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:X=>X.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{g(null),v(false);},className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!p&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:c("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:E?"Sin asignar":"Unassigned"})]}),a.map(X=>jsxs("button",{type:"button",onClick:()=>{g(X.id),v(false);},className:c("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===X.id&&(r?"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-mono font-bold",style:{backgroundColor:X.color||"#007FFF"},children:X.initials||X.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:X.name})]},X.id)),a.length===0&&jsx("div",{className:c("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:E?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:U,disabled:!d.trim(),type:"button",className:c("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",d.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:E?"Guardar":"Save"})]})]})}function ud({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:l="es"}){let[d,i]=useState(false),u=useRef(null),m=useRef(null),[p,g]=useState({}),[f,x]=useState(false),y=o==="dark",h={buttonLabel:n||(l==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!d||!u.current)return;let w=90,N=()=>{let S=u.current.getBoundingClientRect(),T=window.innerHeight-S.bottom<w+8;x(T),g({position:"fixed",...T?{bottom:window.innerHeight-S.top+4}:{top:S.bottom+4},left:S.left,width:S.width,zIndex:9999});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[d]),useEffect(()=>{if(!d)return;let w=N=>{let S=N.target;m.current&&!m.current.contains(S)&&u.current&&!u.current.contains(S)&&i(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d]);let v=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:u,className:c("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>i(!d),disabled:s,className:"asakaa-add-card__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"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:d&&jsx(motion.div,{ref:m,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:p,className:c("rounded-lg shadow-2xl",y?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(bn,{onSubmit:v,onCancel:()=>i(false),availableUsers:a,isDark:y,locale:l,dropdownDirection:"up"})})}),document.body)]})}var Ps=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(jo,{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 n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(n=>`"${n}"`).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((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function zp(e={}){return new Ps(e)}var Gn=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:n,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}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=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:o?`Error in ${o}`:"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"})]})]})}):n}};function pd(e,t){let a=r=>jsx(Gn,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function gd({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:l,onOpenAIUsage:d,shortcut:i="k",className:u=""}){let[m,p]=useState(false),[g,f]=useState(""),[x,y]=useState("home"),[b,h]=useState(""),[v,w]=useState("");useEffect(()=>{let T=E=>{(E.metaKey||E.ctrlKey)&&E.key===i&&(E.preventDefault(),p(P=>!P)),E.key==="Escape"&&(p(false),y("home"),f(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]),useEffect(()=>{m||(y("home"),f(""),h(""),w(""));},[m]);let N=useCallback(()=>{p(false);},[]),S=useCallback(T=>{let[E,P]=T.split(":");switch(E){case "create-card":y("create-card");break;case "create-card-in":h(P||"");break;case "navigate":P?(a?.(P),N()):y("navigate");break;case "search":r?.(g),N();break;case "priority":y("priority");break;case "set-priority":v&&P&&(n?.(v,P),N());break;case "assign":y("assign");break;case "assign-user":v&&P&&(s?.(v,P),N());break;case "ai":y("ai");break;case "ai-generate-plan":o?.(),N();break;case "ai-predict-risks":l?.(),N();break;case "ai-usage":d?.(),N();break;case "back":y("home");break;}},[g,v,t,a,r,n,s,o,l,d,N]),F=useCallback(()=>{b&&g.trim()&&(t?.(b,g.trim()),N());},[b,g,t,N]);return m?jsx(oa,{children:jsx("div",{className:"command-palette-overlay",onClick:N,children:jsx("div",{className:`command-palette ${u}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:g,onValueChange:f,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:x==="create-card"&&b?"Type card title and press Enter...":x==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&x==="create-card"&&b&&F();}}),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."}),x==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:S,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:S,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:S,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:S,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(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:S,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(E=>jsx("span",{className:"command-palette-item-label",children:E},E))})]},T.id))})]}),x==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:S,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:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),x==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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(T=>{let E=e.columns.find(P=>P.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:S,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:E?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(P=>jsx("span",{className:"command-palette-item-label",children:P},P))})]},T.id)})})]}),x==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:S,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:S,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:S,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:S,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 Vp(e,t,a,r,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.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
|
-
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=f=>{f.stopPropagation();let x=r<a.length-1?r+1:0;i(),n(x);},o.appendChild(m),o.appendChild(p),o.appendChild(g);}o.appendChild(l),o.appendChild(d),document.body.appendChild(o),setTimeout(()=>{d.style.transition="opacity 0.5s ease",d.style.opacity="0";},2e3);}function py(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 my(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 gd(e){return e.startsWith("image/")}function mo({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=useState(false),[d,i]=useState(false),[u,m]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let f=useCallback((T,S)=>{S.preventDefault(),S.stopPropagation();let P=g.current.filter(U=>gd(U.type)),k=P.findIndex(U=>U.id===T.id),j=U=>{let ae=g.current.filter(X=>gd(X.type)),L=ae[U];L&&Up(L.url,L.name,ae,U,j);};Up(T.url,T.name,P,k,j);},[]),x=useCallback(T=>{let S=[],P=[];return e.length+T.length>s?(P.push(`Maximum ${s} files allowed`),{valid:S,errors:P}):(T.forEach(k=>{if(k.size/1048576>r){P.push(`${k.name} is too large (max ${r}MB)`);return}if(n&&!n.some(U=>k.type.match(U))){P.push(`${k.name} has invalid file type`);return}S.push(k);}),{valid:S,errors:P})},[e.length,s,r,n]),y=useCallback(async T=>{let{valid:S,errors:P}=x(T);if(P.length>0){m(P.join(", ")),setTimeout(()=>m(null),5e3);return}if(S.length!==0){i(true),m(null);try{await t?.(S);}catch(k){m(k instanceof Error?k.message:"Upload failed"),setTimeout(()=>m(null),5e3);}finally{i(false);}}},[x,t]),b=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(true);},[]),h=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);},[]),v=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),w=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);let S=Array.from(T.dataTransfer.files);y(S);},[y]),N=useCallback(T=>{let S=T.target.files?Array.from(T.target.files):[];y(S),p.current&&(p.current.value="");},[y]),D=useCallback(()=>{p.current?.click();},[]),F=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${d?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:v,onDrop:w,onClick:D,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:d?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:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:gd(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:S=>f(T,S),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.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:my(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:py(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>F(T.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"})})})]},T.id))})]})}function fd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:n,availableUsers:s=[],comments:o=[],activities:l=[],aiInsights:d=[],attachments:i=[],onAddComment:u,onDeleteComment:m,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:f,onGenerateSubtasks:x,onEstimateEffort:y,currentUserId:b="user-1"}){let[h,v]=useState("details"),[w,N]=useState(false),[D,F]=useState({}),[T,S]=useState(""),[P,k]=useState(false),[j,U]=useState({});if(!t||!e)return null;let ae=useCallback(()=>{N(false),F({}),v("details"),S(""),U({}),a();},[a]),L=useCallback(()=>{r&&Object.keys(D).length>0&&(r(e.id,D),F({}),N(false));},[e.id,D,r]),X=useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),ae());},[e.id,n,ae]),K=useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),S(""));},[e.id,T,u]),V=useCallback(async()=>{if(f){k(true);try{let H=await f(e);U(te=>({...te,assignees:H}));}catch(H){console.error("Failed to suggest assignee:",H);}finally{k(false);}}},[e,f]),R=useCallback(async()=>{if(x){k(true);try{let H=await x(e);U(te=>({...te,subtasks:H}));}catch(H){console.error("Failed to generate subtasks:",H);}finally{k(false);}}},[e,x]),J=useCallback(async()=>{if(y){k(true);try{let H=await y(e);U(te=>({...te,effort:H}));}catch(H){console.error("Failed to estimate effort:",H);}finally{k(false);}}},[e,y]),Te={...e,...D},$e=s.filter(H=>Te.assignedUserIds?.includes(H.id));return jsx(ea,{children:jsx("div",{className:"card-detail-overlay",onClick:ae,children:jsxs("div",{className:"card-detail-modal",onClick:H=>H.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:Te.priority==="URGENT"?"#EF4444":Te.priority==="HIGH"?"#F59E0B":Te.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),w?jsx("input",{type:"text",value:D.title??Te.title,onChange:H=>F({...D,title:H.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:Te.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),F({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:X,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:ae,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:()=>v("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:()=>v("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",o.length>0&&jsx("span",{className:"card-detail-tab-badge",children:o.length})]}),jsxs("button",{onClick:()=>v("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:()=>v("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:()=>v("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"}),w?jsx("textarea",{value:D.description??Te.description??"",onChange:H=>F({...D,description:H.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:Te.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:D.assignedUserIds??Te.assignedUserIds??[],onChange:H=>{let te=Array.from(H.target.selectedOptions,ye=>ye.value);F({...D,assignedUserIds:te});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(H=>jsx("option",{value:H.id,children:H.name},H.id))}):jsx("div",{className:"card-detail-users",children:$e.length>0?$e.map(H=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:H.color},children:H.initials}),jsx("span",{children:H.name})]},H.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:D.priority??Te.priority??"",onChange:H=>F({...D,priority:H.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:Te.priority==="URGENT"?"#EF4444":Te.priority==="HIGH"?"#F59E0B":Te.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:Te.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:Te.labels&&Te.labels.length>0?Te.labels.map(H=>jsx("span",{className:"card-detail-label-tag",children:H},H)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),w?jsx("input",{type:"date",value:D.startDate?new Date(D.startDate).toISOString().split("T")[0]:Te.startDate?new Date(Te.startDate).toISOString().split("T")[0]:"",onChange:H=>F({...D,startDate:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:Te.startDate?new Date(Te.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:D.endDate?new Date(D.endDate).toISOString().split("T")[0]:Te.endDate?new Date(Te.endDate).toISOString().split("T")[0]:"",onChange:H=>F({...D,endDate:H.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:Te.endDate?new Date(Te.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:D.estimatedTime??Te.estimatedTime??"",onChange:H=>F({...D,estimatedTime:H.target.value?parseFloat(H.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:Te.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:Te.dependencies&&Te.dependencies.length>0?Te.dependencies.map(H=>{let te=typeof H=="string"?H:H.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:Te.createdAt?new Date(Te.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:H=>S(H.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:K,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:o.length>0?o.map(H=>{let te=s.find(ye=>ye.id===H.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(H.createdAt).toLocaleString()})]})]}),m&&jsx("button",{onClick:()=>m(H.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:H.content})]},H.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(H=>{let te=s.find(ye=>ye.id===H.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-icon",children:[H.type.includes("CREATED")&&"\u2795",H.type.includes("UPDATED")&&"\u270F\uFE0F",H.type.includes("MOVED")&&"\u27A1\uFE0F",H.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",H.type.includes("COMMENT")&&"\u{1F4AC}",H.type.includes("ASSIGNED")&&"\u{1F464}",H.type.includes("PRIORITY")&&"\u{1F3AF}",H.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",H.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"})," ",H.type.replace(/_/g," ").toLowerCase(),H.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:H.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(H.timestamp).toLocaleString()})]})]},H.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(mo,{cardId:e.id,attachments:i,onUpload:p?H=>p(e.id,H):void 0,onDelete:g,currentUserId:b,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:V,disabled:P||!f,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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:R,disabled:P||!x,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:J,disabled:P||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),j.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),j.assignees.map((H,te)=>{let ye=s.find(Re=>Re.id===H.userId);return jsxs("div",{className:"card-detail-ai-suggestion",children:[ye&&jsx("div",{className:"card-detail-user-avatar",style:{background:ye.color},children:ye.initials}),jsxs("div",{children:[jsx("div",{className:"card-detail-ai-suggestion-name",children:ye?.name}),jsx("div",{className:"card-detail-ai-suggestion-reason",children:H.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(H.confidence*100).toFixed(0),"%"]})]})]},te)})]}),j.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),j.subtasks.map((H,te)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:H.title}),H.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:H.description}),H.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",H.estimatedTime,"h"]})]},te))]}),j.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:[j.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(j.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),d.map(H=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${H.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:H.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:H.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:H.description}),H.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",H.suggestedAction]})]},H.id))]}),!j.assignees&&!j.subtasks&&!j.effort&&d.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 Ds({triggerRef:e,isOpen:t,onClose:a,children:r,width:n=200,estimatedHeight:s=300,className:o=""}){let[l,d]=useState({top:0,left:0}),i=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let m=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,f=4,x=m.left;x+n>g-10&&(x=g-n-10),x<10&&(x=10);let y=p-m.bottom,b=m.top,h;return y>=s+f?h=m.bottom+f:b>=s+f?h=m.top-s-f:y>=b?h=m.bottom+f:h=Math.max(10,m.top-s-f),{top:h,left:x}},[e,n,s]);return useEffect(()=>{t&&d(u());},[t,u]),useEffect(()=>{if(!t)return;let m=g=>{let f=g.target;i.current&&!i.current.contains(f)&&e.current&&!e.current.contains(f)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",m);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",m);}},[t,a,e]),useEffect(()=>{if(!t)return;let m=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),t?jsx(ea,{children:jsx("div",{ref:i,className:`smart-popover ${o}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${n}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 xt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",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:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},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",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var wy=["LOW","MEDIUM","HIGH","URGENT"],ky=["todo","in-progress","review","done"];function yd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:n,availableUsers:s=[],comments:o=[],activities:l=[],onAddComment:d,onDeleteComment:i,currentUser:u,onAIGenerateDescription:m,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:f=[],availableLabels:x=[],availableTags:y=[],onCreateTag:b,onUploadCoverImage:h,unsplashAccessKey:v,theme:w,onSubtasksChange:N,attachments:D=[],onUploadAttachments:F,onDeleteAttachment:T}){let S=Ln(),P=w||S?.themeName||"dark",[k,j]=useState(e),[U,ae]=useState(false),[L,X]=useState(()=>[...e?.subtasks||[]].sort((le,st)=>(le.position??0)-(st.position??0))),[K,V]=useState(false),[R,J]=useState(""),[Te,$e]=useState(""),[H,te]=useState("all"),[ye,Re]=useState(false),[Se,Ee]=useState(false),[Ve,ot]=useState(false),[be,Ge]=useState(false),[je,He]=useState(false),[wt,Nt]=useState(false),Je=useRef(null),ze=useRef(null),lt=useRef(null),At=useRef(null),Ne=useRef(null),ft=useRef(null),A=useRef(null),ie=useRef(null),B=useRef(null),Z=useRef(null),O=useRef(null),ee=useRef(null);useEffect(()=>{if(e&&!k){j({...e});let W=[...e.subtasks||[]].sort((le,st)=>(le.position??0)-(st.position??0));X(W);}else if(e&&k&&e.id!==k.id){j({...e});let W=[...e.subtasks||[]].sort((le,st)=>(le.position??0)-(st.position??0));X(W);}},[e,k]),useEffect(()=>{let W=le=>{let st=le.target;At.current&&!At.current.contains(st)&&Re(false),Ne.current&&!Ne.current.contains(st)&&Ee(false),ft.current&&!ft.current.contains(st)&&ot(false),A.current&&!A.current.contains(st)&&Ge(false);};if(ye||Se||Ve||be)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[ye,Se,Ve,be]),useEffect(()=>{if(!t)return;let W=le=>{let st=le.target,jt=st.tagName==="INPUT"||st.tagName==="TEXTAREA"||st.isContentEditable;if(le.key==="Escape"){le.preventDefault(),ye||Se||Ve||be||je||wt?(Re(false),Ee(false),ot(false),Ge(false),He(false),Nt(false)):jt||a();return}if(jt&&le.key!=="Escape")return;let re=le.metaKey||le.ctrlKey;switch(le.key.toLowerCase()){case "s":le.preventDefault(),Re(true);break;case "a":le.preventDefault(),ot(true);break;case "p":le.preventDefault(),Ee(true);break;case "l":le.preventDefault(),Ge(true);break;case "d":re||(le.preventDefault(),He(true),setTimeout(()=>ie.current?.focus(),0));break;case "e":re||(le.preventDefault(),Nt(true));break;case "i":le.preventDefault(),ae(true),setTimeout(()=>ze.current?.focus(),0);break;case "t":le.preventDefault(),V(true);break;case "c":le.preventDefault(),lt.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,ye,Se,Ve,be,je,wt]);let Ue=useCallback(W=>{let le=W.currentTarget.textContent?.trim()||"";if(k&&le!==k.title){let st={...k,title:le};j(st),r?.(k.id,{title:le});}},[k,r]),ke=useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=k?.title||"",W.currentTarget.blur());},[k]),Be=useCallback(()=>{k&&e&&k.description!==e.description&&r?.(k.id,{description:k.description}),ae(false);},[k,e,r]),Me=useCallback(W=>{if(k){let le={...k,columnId:W};j(le),r?.(k.id,{columnId:W}),Re(false);}},[k,r]),Pe=useCallback(W=>{if(k){let le={...k,priority:W};j(le),r?.(k.id,{priority:W}),Ee(false);}},[k,r]),nt=useCallback(W=>{if(k){let le=k.assignedUserIds||[],st=le.includes(W)?le.filter(re=>re!==W):[...le,W],jt={...k,assignedUserIds:st};j(jt),r?.(k.id,{assignedUserIds:st});}},[k,r]),at=useCallback(W=>{if(k){let le=k.labels||[],st=le.includes(W)?le.filter(re=>re!==W):[...le,W],jt={...k,labels:st};j(jt),r?.(k.id,{labels:st});}},[k,r]),dt=useCallback(W=>{if(k){let le={...k,tags:W};j(le),r?.(k.id,{tags:W});}},[k,r]),mt=useCallback(W=>{if(k){let le=W.target.value,st={...k,endDate:le};j(st),r?.(k.id,{endDate:le}),He(false);}},[k,r]),Vt=useCallback(W=>{if(k){let le={...k,estimatedTime:parseFloat(W)||0};j(le),r?.(k.id,{estimatedTime:parseFloat(W)||0});}},[k,r]),Mt=useCallback(()=>{if(R.trim()&&k){let W={id:`subtask-${Date.now()}`,title:R.trim(),completed:false,position:L.length,createdAt:new Date},le=[...L,W];X(le),J(""),V(false),N?.(k.id,le);}},[R,L,k,N]),zt=useCallback(W=>{let le=L.map(st=>st.id===W?{...st,completed:!st.completed,updatedAt:new Date}:st);X(le),k&&N?.(k.id,le);},[L,k,N]),gt=useCallback(W=>{let le=L.filter(st=>st.id!==W);X(le),k&&N?.(k.id,le);},[L,k,N]),Dt=useCallback(()=>{Te.trim()&&k&&d&&(d(k.id,Te.trim()),$e(""));},[Te,k,d]),Ut=useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),Dt());},[Dt]),Gt=W=>jsx(yy,{remarkPlugins:[xy],rehypePlugins:[vy],components:{a:({node:le,...st})=>jsx("a",{...st,target:"_blank",rel:"noopener noreferrer"})},children:W}),Rt=l.filter(W=>H==="comments"?W.type.includes("COMMENT"):H==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let rt=k||e,ia=s.filter(W=>rt.assignedUserIds?.includes(W.id)),fa=L.filter(W=>W.completed).length;return jsx(ea,{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:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":P,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:Je,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ue,onKeyDown:ke,children:rt.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:At,children:[jsxs("button",{ref:B,className:"modal-v2-field",onClick:()=>Re(!ye),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:rt.columnId||"No status"})]}),jsx(Ds,{triggerRef:B,isOpen:ye,onClose:()=>Re(false),width:250,estimatedHeight:200,children:(f.length>0?f:ky.map(W=>({id:W,title:W}))).map(W=>jsx("button",{className:`modal-v2-popover-item ${rt.columnId===W.id?"active":""}`,onClick:()=>Me(W.id),children:W.title},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:ft,children:[jsxs("button",{ref:Z,className:"modal-v2-field",onClick:()=>ot(!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:ia.length>0?jsx("div",{className:"modal-v2-avatars",children:ia.map(W=>jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Ds,{triggerRef:Z,isOpen:Ve,onClose:()=>ot(false),width:280,estimatedHeight:300,children:s.map(W=>jsxs("button",{className:`modal-v2-popover-item ${rt.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>nt(W.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,rt.assignedUserIds?.includes(W.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"})})]},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:Ne,children:[jsxs("button",{ref:O,className:"modal-v2-field",onClick:()=>Ee(!Se),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:rt.priority||"None"})]}),jsxs(Ds,{triggerRef:O,isOpen:Se,onClose:()=>Ee(false),width:180,estimatedHeight:220,children:[wy.map(W=>jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${rt.priority===W?"active":""}`,onClick:()=>Pe(W),children:W},W)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Pe(""),children:"None"})]})]}),y.length>0||b?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(Oo,{selectedTags:rt.tags||[],availableTags:y,onChange:dt,onCreateTag:b,theme:xt[P]||xt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:A,children:[jsxs("button",{ref:ee,className:"modal-v2-field",onClick:()=>Ge(!be),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:rt.labels&&rt.labels.length>0?jsx("span",{children:rt.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(Ds,{triggerRef:ee,isOpen:be,onClose:()=>Ge(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxs("button",{className:`modal-v2-popover-item ${rt.labels?.includes(W)?"active":""}`,onClick:()=>at(W),children:[W,rt.labels?.includes(W)&&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"})})]},W))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{He(!je),setTimeout(()=>ie.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:rt.endDate?new Date(rt.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:ie,type:"date",value:typeof rt.endDate=="string"?rt.endDate.split("T")[0]:rt.endDate?(()=>{let W=new Date(rt.endDate),le=W.getUTCFullYear(),st=String(W.getUTCMonth()+1).padStart(2,"0"),jt=String(W.getUTCDate()).padStart(2,"0");return `${le}-${st}-${jt}`})():"",onChange:mt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Nt(!wt),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:rt.estimatedTime?`${rt.estimatedTime}h`:"Not set"})]}),wt&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:rt.estimatedTime||"",onChange:W=>Vt(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Nt(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"})]}),U?jsx("textarea",{className:"modal-v2-textarea",value:rt.description||"",onChange:W=>{if(k){let le={...k,description:W.target.value};j(le);}},onBlur:Be,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>ae(true),children:rt.description?jsx("div",{className:"modal-v2-markdown",children:Gt(rt.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"}),L.length>0&&jsxs("span",{className:"modal-v2-count",children:[fa,"/",L.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>V(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:[L.map(W=>jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>zt(W.id),children:W.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:W.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>gt(W.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"})]})})]},W.id)),K&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:R,onChange:W=>J(W.target.value),onKeyDown:W=>{W.key==="Enter"&&Mt(),W.key==="Escape"&&(V(false),J(""));},onBlur:Mt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(F||D.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"}),D.length>0&&jsx("span",{className:"modal-v2-count",children:D.length})]}),jsx(mo,{cardId:rt.id,attachments:D,onUpload:F?W=>F(rt.id,W):void 0,onDelete:T,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 ${H==="all"?"active":""}`,onClick:()=>te("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${H==="comments"?"active":""}`,onClick:()=>te("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${H==="history"?"active":""}`,onClick:()=>te("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:lt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Te,onChange:W=>$e(W.target.value),onKeyDown:Ut,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:Dt,disabled:!Te.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Rt.map(W=>{let le=s.find(jt=>jt.id===W.userId);if(W.type.includes("COMMENT")){let jt=o.find(re=>re.id===W.metadata?.commentId);return jt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[le&&jsx("div",{className:"modal-v2-avatar",style:{background:le.color},children:le.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:le?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:jt.content})]})]},W.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.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:le?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:W.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),Rt.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Fy({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 vd({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,d)=>l+d.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(Fy,{})}),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}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",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((o,l)=>o+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((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function zy({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 wd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,d=s>0?(s-o)/s*100:0,i=o<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?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(zy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?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:d>=50?"#10B981":"#F59E0B"},children:[d.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:o})]}),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 Yy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Xp=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Xy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,l=e+o*Math.cos(-a*(Math.PI/180)),d=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:d,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Jp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=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:[n,"%"]})]})]})}function kd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((d,i)=>d+i.value,0),o=e.map(d=>({...d,totalValue:s,color:d.color||Yy[d.name]||Xp[e.indexOf(d)%Xp.length]})),l=o.map(d=>d.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:o,cx:"50%",cy:"50%",labelLine:false,label:n?Xy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((d,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Jp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let u=i.payload,m=s>0?(u.value/s*100).toFixed(0):"0";return `${d} (${u.value} - ${m}%)`}})]}):jsxs(BarChart$1,{data:o,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(Jp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((d,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:"#00E5CC"},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((d,i)=>i.value>d.value?i:d).name})]})]})]})}var Ai=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,l]=useState(false),[d,i]=useState(false),[u,m]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),x=w=>{r.onBulkUpdate?.(f,{priority:w}),l(false);},y=w=>{r.onBulkMove?.(f,w),i(false),a();},b=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),m(false);},h=w=>{let N=new Set;e.forEach(F=>{F.labels?.forEach(T=>N.add(T));});let D=Array.from(new Set([...N,...w]));r.onBulkUpdate?.(f,{labels:D}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),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(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsx("span",{className:c("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!d),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,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"})})]})]})})});Ai.displayName="BulkOperationsToolbar";function tx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,l,d,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(g=>{let f=a?.find(x=>x.id===g);o=`assignee-${g}`,l=f?.name||`User ${g}`,d=f?.color,i=f?.avatar,r.has(o)||r.set(o,{id:o,title:l,groupValue:g,cardIds:[],color:d,icon:i}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",d="#6b7280",i="\u{1F464}",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:d,icon:i}),r.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`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,d=p.color,r.has(o)||r.set(o,{id:o,title:l,groupValue:s,cardIds:[],color:d}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(g=>{o=`label-${g}`,l=g,d="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:g,cardIds:[],color:d}),r.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",d="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:d}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Cd({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n}){let[s,o]=useState(new Set),l=useMemo(()=>tx(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),d=useCallback(i=>{o(u=>{let m=new Set(u);return m.has(i)?m.delete(i):m.add(i),m});},[]);return t.groupBy==="none"||l.length===0?jsx(zo,{board:e,callbacks:r,availableUsers:a,className:n}):jsxs("div",{className:c("asakaa-swimlane-view",n),children:[l.map(i=>{let u=s.has(i.id),m=e.cards.filter(g=>i.cardIds.includes(g.id)),p={...e,cards:m};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&&d(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":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(zo,{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 Td=[{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 Nd({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),l=Td.find(i=>i.value===e)||Td[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),n(false);};return jsxs("div",{className:c("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!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:c("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Td.map(i=>jsxs("button",{onClick:()=>d(i.value),className:c("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-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Ss=[{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 ox(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,d=n.meta?e.metaKey:true;return s&&o&&l&&d}function am(e={}){let{shortcuts:t=Ss,enabled:a=true,preventDefault:r=true}=e,n=useRef(t),s=useRef(a);useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=useCallback(d=>{n.current=[...n.current,d];},[]),l=useCallback(d=>{n.current=n.current.filter(i=>i.action!==d);},[]);return useEffect(()=>{function d(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let m of n.current)if(ox(i,m)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:m.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r]),{registerShortcut:o,unregisterShortcut:l,isEnabled:a}}function sx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function ix(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 lx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=ix(e),r=t?sx(t):"";return a?`${a} + ${r}`:r}function dx(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 Dd({shortcuts:e=Ss,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(d){d.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!n||!t)return null;let o=dx(e);return jsxs("div",{className:c("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(o).map(([l,d])=>d.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-[#00E5CC] rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:d.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:lx(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 Sd=[{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
|
+
`,g.onmouseenter=()=>{g.style.opacity="1";},g.onmouseleave=()=>{g.style.opacity="0.5";},g.onclick=f=>{f.stopPropagation();let x=r<a.length-1?r+1:0;i(),n(x);},o.appendChild(m),o.appendChild(p),o.appendChild(g);}o.appendChild(l),o.appendChild(d),document.body.appendChild(o),setTimeout(()=>{d.style.transition="opacity 0.5s ease",d.style.opacity="0";},2e3);}function py(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 my(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 bd(e){return e.startsWith("image/")}function yo({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,l]=useState(false),[d,i]=useState(false),[u,m]=useState(null),p=useRef(null),g=useRef(e);g.current=e;let f=useCallback((T,E)=>{E.preventDefault(),E.stopPropagation();let P=g.current.filter(U=>bd(U.type)),k=P.findIndex(U=>U.id===T.id),j=U=>{let ae=g.current.filter(X=>bd(X.type)),L=ae[U];L&&Vp(L.url,L.name,ae,U,j);};Vp(T.url,T.name,P,k,j);},[]),x=useCallback(T=>{let E=[],P=[];return e.length+T.length>s?(P.push(`Maximum ${s} files allowed`),{valid:E,errors:P}):(T.forEach(k=>{if(k.size/1048576>r){P.push(`${k.name} is too large (max ${r}MB)`);return}if(n&&!n.some(U=>k.type.match(U))){P.push(`${k.name} has invalid file type`);return}E.push(k);}),{valid:E,errors:P})},[e.length,s,r,n]),y=useCallback(async T=>{let{valid:E,errors:P}=x(T);if(P.length>0){m(P.join(", ")),setTimeout(()=>m(null),5e3);return}if(E.length!==0){i(true),m(null);try{await t?.(E);}catch(k){m(k instanceof Error?k.message:"Upload failed"),setTimeout(()=>m(null),5e3);}finally{i(false);}}},[x,t]),b=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(true);},[]),h=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);},[]),v=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),w=useCallback(T=>{T.preventDefault(),T.stopPropagation(),l(false);let E=Array.from(T.dataTransfer.files);y(E);},[y]),N=useCallback(T=>{let E=T.target.files?Array.from(T.target.files):[];y(E),p.current&&(p.current.value="");},[y]),S=useCallback(()=>{p.current?.click();},[]),F=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${d?"uploading":""}`,onDragEnter:b,onDragLeave:h,onDragOver:v,onDrop:w,onClick:S,children:[jsx("input",{ref:p,type:"file",multiple:true,onChange:N,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:d?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:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),u&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:u})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:bd(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:E=>f(T,E),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.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:my(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:py(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>F(T.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"})})})]},T.id))})]})}function hd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:n,availableUsers:s=[],comments:o=[],activities:l=[],aiInsights:d=[],attachments:i=[],onAddComment:u,onDeleteComment:m,onUploadAttachments:p,onDeleteAttachment:g,onSuggestAssignee:f,onGenerateSubtasks:x,onEstimateEffort:y,currentUserId:b="user-1"}){let[h,v]=useState("details"),[w,N]=useState(false),[S,F]=useState({}),[T,E]=useState(""),[P,k]=useState(false),[j,U]=useState({});if(!t||!e)return null;let ae=useCallback(()=>{N(false),F({}),v("details"),E(""),U({}),a();},[a]),L=useCallback(()=>{r&&Object.keys(S).length>0&&(r(e.id,S),F({}),N(false));},[e.id,S,r]),X=useCallback(()=>{n&&window.confirm("Are you sure you want to delete this card?")&&(n(e.id),ae());},[e.id,n,ae]),Y=useCallback(()=>{u&&T.trim()&&(u(e.id,T.trim()),E(""));},[e.id,T,u]),V=useCallback(async()=>{if(f){k(true);try{let z=await f(e);U(te=>({...te,assignees:z}));}catch(z){console.error("Failed to suggest assignee:",z);}finally{k(false);}}},[e,f]),R=useCallback(async()=>{if(x){k(true);try{let z=await x(e);U(te=>({...te,subtasks:z}));}catch(z){console.error("Failed to generate subtasks:",z);}finally{k(false);}}},[e,x]),J=useCallback(async()=>{if(y){k(true);try{let z=await y(e);U(te=>({...te,effort:z}));}catch(z){console.error("Failed to estimate effort:",z);}finally{k(false);}}},[e,y]),Ne={...e,...S},$e=s.filter(z=>Ne.assignedUserIds?.includes(z.id));return jsx(oa,{children:jsx("div",{className:"card-detail-overlay",onClick:ae,children:jsxs("div",{className:"card-detail-modal",onClick:z=>z.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:Ne.priority==="URGENT"?"#EF4444":Ne.priority==="HIGH"?"#F59E0B":Ne.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),w?jsx("input",{type:"text",value:S.title??Ne.title,onChange:z=>F({...S,title:z.target.value}),className:"card-detail-title-input",placeholder:"Card title"}):jsx("h2",{className:"card-detail-title",children:Ne.title})]}),jsxs("div",{className:"card-detail-header-actions",children:[w?jsxs(Fragment,{children:[jsx("button",{onClick:L,className:"card-detail-btn card-detail-btn-primary",children:"Save"}),jsx("button",{onClick:()=>{N(false),F({});},className:"card-detail-btn",children:"Cancel"})]}):jsxs("button",{onClick:()=>N(true),className:"card-detail-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),"Edit"]}),jsxs("button",{onClick:X,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:ae,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:()=>v("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:()=>v("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",o.length>0&&jsx("span",{className:"card-detail-tab-badge",children:o.length})]}),jsxs("button",{onClick:()=>v("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:()=>v("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:()=>v("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"}),w?jsx("textarea",{value:S.description??Ne.description??"",onChange:z=>F({...S,description:z.target.value}),className:"card-detail-textarea",placeholder:"Add a description...",rows:4}):jsx("p",{className:"card-detail-text",children:Ne.description||"No description"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Assigned To"}),w?jsx("select",{multiple:true,value:S.assignedUserIds??Ne.assignedUserIds??[],onChange:z=>{let te=Array.from(z.target.selectedOptions,xe=>xe.value);F({...S,assignedUserIds:te});},className:"card-detail-textarea",style:{height:"120px",padding:"8px 12px"},children:s.map(z=>jsx("option",{value:z.id,children:z.name},z.id))}):jsx("div",{className:"card-detail-users",children:$e.length>0?$e.map(z=>jsxs("div",{className:"card-detail-user",children:[jsx("div",{className:"card-detail-user-avatar",style:{background:z.color},children:z.initials}),jsx("span",{children:z.name})]},z.id)):jsx("span",{className:"card-detail-empty",children:"Unassigned"})})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Priority"}),w?jsxs("select",{value:S.priority??Ne.priority??"",onChange:z=>F({...S,priority:z.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:Ne.priority==="URGENT"?"#EF4444":Ne.priority==="HIGH"?"#F59E0B":Ne.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:Ne.priority||"None"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Labels"}),jsx("div",{className:"card-detail-labels",children:Ne.labels&&Ne.labels.length>0?Ne.labels.map(z=>jsx("span",{className:"card-detail-label-tag",children:z},z)):jsx("span",{className:"card-detail-empty",children:"No labels"})})]}),jsxs("div",{className:"card-detail-section-row",children:[jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Start Date"}),w?jsx("input",{type:"date",value:S.startDate?new Date(S.startDate).toISOString().split("T")[0]:Ne.startDate?new Date(Ne.startDate).toISOString().split("T")[0]:"",onChange:z=>F({...S,startDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:Ne.startDate?new Date(Ne.startDate).toLocaleDateString():"Not set"})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"End Date"}),w?jsx("input",{type:"date",value:S.endDate?new Date(S.endDate).toISOString().split("T")[0]:Ne.endDate?new Date(Ne.endDate).toISOString().split("T")[0]:"",onChange:z=>F({...S,endDate:z.target.value||void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"}}):jsx("span",{className:"card-detail-text",children:Ne.endDate?new Date(Ne.endDate).toLocaleDateString():"Not set"})]})]}),jsxs("div",{className:"card-detail-section",children:[jsx("label",{className:"card-detail-label",children:"Estimated Hours"}),w?jsx("input",{type:"number",min:"0",step:"0.5",value:S.estimatedTime??Ne.estimatedTime??"",onChange:z=>F({...S,estimatedTime:z.target.value?parseFloat(z.target.value):void 0}),className:"card-detail-textarea",style:{height:"auto",padding:"8px 12px"},placeholder:"Enter hours"}):jsx("span",{className:"card-detail-text",children:Ne.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:Ne.dependencies&&Ne.dependencies.length>0?Ne.dependencies.map(z=>{let te=typeof z=="string"?z:z.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:Ne.createdAt?new Date(Ne.createdAt).toLocaleString():"Unknown"})]})]}),h==="comments"&&jsxs("div",{className:"card-detail-comments",children:[jsxs("div",{className:"card-detail-comment-form",children:[jsx("textarea",{value:T,onChange:z=>E(z.target.value),className:"card-detail-comment-textarea",placeholder:"Write a comment...",rows:3}),jsx("button",{onClick:Y,disabled:!T.trim(),className:"card-detail-btn card-detail-btn-primary",children:"Add Comment"})]}),jsx("div",{className:"card-detail-comments-list",children:o.length>0?o.map(z=>{let te=s.find(xe=>xe.id===z.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(z.createdAt).toLocaleString()})]})]}),m&&jsx("button",{onClick:()=>m(z.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:z.content})]},z.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(z=>{let te=s.find(xe=>xe.id===z.userId);return jsxs("div",{className:"card-detail-activity-item",children:[jsxs("div",{className:"card-detail-activity-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("COMMENT")&&"\u{1F4AC}",z.type.includes("ASSIGNED")&&"\u{1F464}",z.type.includes("PRIORITY")&&"\u{1F3AF}",z.type.includes("LABEL")&&"\u{1F3F7}\uFE0F",z.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"})," ",z.type.replace(/_/g," ").toLowerCase(),z.newValue&&jsxs("span",{className:"card-detail-activity-value",children:[" ","to ",jsx("strong",{children:z.newValue})]})]}),jsx("div",{className:"card-detail-activity-time",children:new Date(z.timestamp).toLocaleString()})]})]},z.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(yo,{cardId:e.id,attachments:i,onUpload:p?z=>p(e.id,z):void 0,onDelete:g,currentUserId:b,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:V,disabled:P||!f,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("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:R,disabled:P||!x,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:J,disabled:P||!y,className:"card-detail-ai-btn",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 6 12 12 16 14"})]}),"Estimate Effort"]})]}),j.assignees&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Assignee Suggestions"}),j.assignees.map((z,te)=>{let xe=s.find(Re=>Re.id===z.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:z.reasoning}),jsxs("div",{className:"card-detail-ai-suggestion-confidence",children:["Confidence: ",(z.confidence*100).toFixed(0),"%"]})]})]},te)})]}),j.subtasks&&jsxs("div",{className:"card-detail-ai-results",children:[jsx("h4",{children:"Suggested Subtasks"}),j.subtasks.map((z,te)=>jsxs("div",{className:"card-detail-ai-subtask",children:[jsx("div",{className:"card-detail-ai-subtask-title",children:z.title}),z.description&&jsx("div",{className:"card-detail-ai-subtask-desc",children:z.description}),z.estimatedTime&&jsxs("div",{className:"card-detail-ai-subtask-time",children:["Est: ",z.estimatedTime,"h"]})]},te))]}),j.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:[j.effort.hours," hours"]}),jsxs("div",{className:"card-detail-ai-effort-confidence",children:["Confidence: ",(j.effort.confidence*100).toFixed(0),"%"]})]})]}),d.length>0&&jsxs("div",{className:"card-detail-ai-insights",children:[jsx("h4",{children:"AI Insights"}),d.map(z=>jsxs("div",{className:`card-detail-ai-insight card-detail-ai-insight-${z.severity.toLowerCase()}`,children:[jsxs("div",{className:"card-detail-ai-insight-header",children:[jsx("span",{className:"card-detail-ai-insight-title",children:z.title}),jsx("span",{className:"card-detail-ai-insight-severity",children:z.severity})]}),jsx("p",{className:"card-detail-ai-insight-desc",children:z.description}),z.suggestedAction&&jsxs("div",{className:"card-detail-ai-insight-action",children:["\u{1F4A1} ",z.suggestedAction]})]},z.id))]}),!j.assignees&&!j.subtasks&&!j.effort&&d.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 As({triggerRef:e,isOpen:t,onClose:a,children:r,width:n=200,estimatedHeight:s=300,className:o=""}){let[l,d]=useState({top:0,left:0}),i=useRef(null),u=useCallback(()=>{if(!e.current)return {top:0,left:0};let m=e.current.getBoundingClientRect(),p=window.innerHeight,g=window.innerWidth,f=4,x=m.left;x+n>g-10&&(x=g-n-10),x<10&&(x=10);let y=p-m.bottom,b=m.top,h;return y>=s+f?h=m.bottom+f:b>=s+f?h=m.top-s-f:y>=b?h=m.bottom+f:h=Math.max(10,m.top-s-f),{top:h,left:x}},[e,n,s]);return useEffect(()=>{t&&d(u());},[t,u]),useEffect(()=>{if(!t)return;let m=g=>{let f=g.target;i.current&&!i.current.contains(f)&&e.current&&!e.current.contains(f)&&a();},p=setTimeout(()=>{document.addEventListener("mousedown",m);},0);return ()=>{clearTimeout(p),document.removeEventListener("mousedown",m);}},[t,a,e]),useEffect(()=>{if(!t)return;let m=p=>{p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),a());};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,a]),t?jsx(oa,{children:jsx("div",{ref:i,className:`smart-popover ${o}`,style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,width:`${n}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 xt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",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:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},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",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};var wy=["LOW","MEDIUM","HIGH","URGENT"],ky=["todo","in-progress","review","done"];function vd({card:e,isOpen:t,onClose:a,onUpdate:r,onDelete:n,availableUsers:s=[],comments:o=[],activities:l=[],onAddComment:d,onDeleteComment:i,currentUser:u,onAIGenerateDescription:m,onAICreateSubtasks:p,onAIFindSimilar:g,availableColumns:f=[],availableLabels:x=[],availableTags:y=[],onCreateTag:b,onUploadCoverImage:h,unsplashAccessKey:v,theme:w,onSubtasksChange:N,attachments:S=[],onUploadAttachments:F,onDeleteAttachment:T}){let E=$n(),P=w||E?.themeName||"dark",[k,j]=useState(e),[U,ae]=useState(false),[L,X]=useState(()=>[...e?.subtasks||[]].sort((ie,st)=>(ie.position??0)-(st.position??0))),[Y,V]=useState(false),[R,J]=useState(""),[Ne,$e]=useState(""),[z,te]=useState("all"),[xe,Re]=useState(false),[De,Ee]=useState(false),[Ve,ot]=useState(false),[he,Ge]=useState(false),[je,He]=useState(false),[Ct,Dt]=useState(false),Je=useRef(null),ze=useRef(null),lt=useRef(null),Lt=useRef(null),ke=useRef(null),gt=useRef(null),A=useRef(null),se=useRef(null),B=useRef(null),Z=useRef(null),O=useRef(null),ee=useRef(null);useEffect(()=>{if(e&&!k){j({...e});let W=[...e.subtasks||[]].sort((ie,st)=>(ie.position??0)-(st.position??0));X(W);}else if(e&&k&&e.id!==k.id){j({...e});let W=[...e.subtasks||[]].sort((ie,st)=>(ie.position??0)-(st.position??0));X(W);}},[e,k]),useEffect(()=>{let W=ie=>{let st=ie.target;Lt.current&&!Lt.current.contains(st)&&Re(false),ke.current&&!ke.current.contains(st)&&Ee(false),gt.current&&!gt.current.contains(st)&&ot(false),A.current&&!A.current.contains(st)&&Ge(false);};if(xe||De||Ve||he)return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[xe,De,Ve,he]),useEffect(()=>{if(!t)return;let W=ie=>{let st=ie.target,Kt=st.tagName==="INPUT"||st.tagName==="TEXTAREA"||st.isContentEditable;if(ie.key==="Escape"){ie.preventDefault(),xe||De||Ve||he||je||Ct?(Re(false),Ee(false),ot(false),Ge(false),He(false),Dt(false)):Kt||a();return}if(Kt&&ie.key!=="Escape")return;let re=ie.metaKey||ie.ctrlKey;switch(ie.key.toLowerCase()){case "s":ie.preventDefault(),Re(true);break;case "a":ie.preventDefault(),ot(true);break;case "p":ie.preventDefault(),Ee(true);break;case "l":ie.preventDefault(),Ge(true);break;case "d":re||(ie.preventDefault(),He(true),setTimeout(()=>se.current?.focus(),0));break;case "e":re||(ie.preventDefault(),Dt(true));break;case "i":ie.preventDefault(),ae(true),setTimeout(()=>ze.current?.focus(),0);break;case "t":ie.preventDefault(),V(true);break;case "c":ie.preventDefault(),lt.current?.focus();break}};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[t,a,xe,De,Ve,he,je,Ct]);let Ue=useCallback(W=>{let ie=W.currentTarget.textContent?.trim()||"";if(k&&ie!==k.title){let st={...k,title:ie};j(st),r?.(k.id,{title:ie});}},[k,r]),Ce=useCallback(W=>{W.key==="Enter"&&(W.preventDefault(),W.currentTarget.blur()),W.key==="Escape"&&(W.preventDefault(),W.currentTarget.textContent=k?.title||"",W.currentTarget.blur());},[k]),Ie=useCallback(()=>{k&&e&&k.description!==e.description&&r?.(k.id,{description:k.description}),ae(false);},[k,e,r]),Me=useCallback(W=>{if(k){let ie={...k,columnId:W};j(ie),r?.(k.id,{columnId:W}),Re(false);}},[k,r]),Pe=useCallback(W=>{if(k){let ie={...k,priority:W};j(ie),r?.(k.id,{priority:W}),Ee(false);}},[k,r]),nt=useCallback(W=>{if(k){let ie=k.assignedUserIds||[],st=ie.includes(W)?ie.filter(re=>re!==W):[...ie,W],Kt={...k,assignedUserIds:st};j(Kt),r?.(k.id,{assignedUserIds:st});}},[k,r]),at=useCallback(W=>{if(k){let ie=k.labels||[],st=ie.includes(W)?ie.filter(re=>re!==W):[...ie,W],Kt={...k,labels:st};j(Kt),r?.(k.id,{labels:st});}},[k,r]),dt=useCallback(W=>{if(k){let ie={...k,tags:W};j(ie),r?.(k.id,{tags:W});}},[k,r]),pt=useCallback(W=>{if(k){let ie=W.target.value,st={...k,endDate:ie};j(st),r?.(k.id,{endDate:ie}),He(false);}},[k,r]),jt=useCallback(W=>{if(k){let ie={...k,estimatedTime:parseFloat(W)||0};j(ie),r?.(k.id,{estimatedTime:parseFloat(W)||0});}},[k,r]),Mt=useCallback(()=>{if(R.trim()&&k){let W={id:`subtask-${Date.now()}`,title:R.trim(),completed:false,position:L.length,createdAt:new Date},ie=[...L,W];X(ie),J(""),V(false),N?.(k.id,ie);}},[R,L,k,N]),zt=useCallback(W=>{let ie=L.map(st=>st.id===W?{...st,completed:!st.completed,updatedAt:new Date}:st);X(ie),k&&N?.(k.id,ie);},[L,k,N]),mt=useCallback(W=>{let ie=L.filter(st=>st.id!==W);X(ie),k&&N?.(k.id,ie);},[L,k,N]),Pt=useCallback(()=>{Ne.trim()&&k&&d&&(d(k.id,Ne.trim()),$e(""));},[Ne,k,d]),Ut=useCallback(W=>{(W.metaKey||W.ctrlKey)&&W.key==="Enter"&&(W.preventDefault(),Pt());},[Pt]),_t=W=>jsx(yy,{remarkPlugins:[xy],rehypePlugins:[vy],components:{a:({node:ie,...st})=>jsx("a",{...st,target:"_blank",rel:"noopener noreferrer"})},children:W}),Wt=l.filter(W=>z==="comments"?W.type.includes("COMMENT"):z==="history"?!W.type.includes("COMMENT"):true);if(!t||!e)return null;let rt=k||e,ca=s.filter(W=>rt.assignedUserIds?.includes(W.id)),xa=L.filter(W=>W.completed).length;return jsx(oa,{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:W=>W.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"modal-title","data-theme":P,children:[jsxs("header",{className:"modal-v2-header",children:[jsx("h1",{id:"modal-title",ref:Je,className:"modal-v2-title",contentEditable:true,suppressContentEditableWarning:true,onBlur:Ue,onKeyDown:Ce,children:rt.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:Lt,children:[jsxs("button",{ref:B,className:"modal-v2-field",onClick:()=>Re(!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:rt.columnId||"No status"})]}),jsx(As,{triggerRef:B,isOpen:xe,onClose:()=>Re(false),width:250,estimatedHeight:200,children:(f.length>0?f:ky.map(W=>({id:W,title:W}))).map(W=>jsx("button",{className:`modal-v2-popover-item ${rt.columnId===W.id?"active":""}`,onClick:()=>Me(W.id),children:W.title},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:gt,children:[jsxs("button",{ref:Z,className:"modal-v2-field",onClick:()=>ot(!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:ca.length>0?jsx("div",{className:"modal-v2-avatars",children:ca.map(W=>jsx("div",{className:"modal-v2-avatar",style:{background:W.color},title:W.name,children:W.initials},W.id))}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(As,{triggerRef:Z,isOpen:Ve,onClose:()=>ot(false),width:280,estimatedHeight:300,children:s.map(W=>jsxs("button",{className:`modal-v2-popover-item ${rt.assignedUserIds?.includes(W.id)?"active":""}`,onClick:()=>nt(W.id),children:[jsx("div",{className:"modal-v2-avatar-small",style:{background:W.color},children:W.initials}),W.name,rt.assignedUserIds?.includes(W.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"})})]},W.id))})]}),jsxs("div",{className:"modal-v2-field-wrapper",ref:ke,children:[jsxs("button",{ref:O,className:"modal-v2-field",onClick:()=>Ee(!De),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:rt.priority||"None"})]}),jsxs(As,{triggerRef:O,isOpen:De,onClose:()=>Ee(false),width:180,estimatedHeight:220,children:[wy.map(W=>jsx("button",{className:`modal-v2-popover-item priority-${W.toLowerCase()} ${rt.priority===W?"active":""}`,onClick:()=>Pe(W),children:W},W)),jsx("button",{className:"modal-v2-popover-item",onClick:()=>Pe(""),children:"None"})]})]}),y.length>0||b?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(Wo,{selectedTags:rt.tags||[],availableTags:y,onChange:dt,onCreateTag:b,theme:xt[P]||xt.dark})})]})}):jsxs("div",{className:"modal-v2-field-wrapper",ref:A,children:[jsxs("button",{ref:ee,className:"modal-v2-field",onClick:()=>Ge(!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:"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:rt.labels&&rt.labels.length>0?jsx("span",{children:rt.labels.join(", ")}):jsx("span",{className:"modal-v2-empty",children:"Empty"})})]}),jsx(As,{triggerRef:ee,isOpen:he,onClose:()=>Ge(false),width:220,estimatedHeight:200,children:(x.length>0?x:["Bug","Feature","Enhancement","Documentation"]).map(W=>jsxs("button",{className:`modal-v2-popover-item ${rt.labels?.includes(W)?"active":""}`,onClick:()=>at(W),children:[W,rt.labels?.includes(W)&&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"})})]},W))})]}),jsxs("button",{className:"modal-v2-field",onClick:()=>{He(!je),setTimeout(()=>se.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:rt.endDate?new Date(rt.endDate).toLocaleDateString():"Not set"}),jsx("input",{ref:se,type:"date",value:typeof rt.endDate=="string"?rt.endDate.split("T")[0]:rt.endDate?(()=>{let W=new Date(rt.endDate),ie=W.getUTCFullYear(),st=String(W.getUTCMonth()+1).padStart(2,"0"),Kt=String(W.getUTCDate()).padStart(2,"0");return `${ie}-${st}-${Kt}`})():"",onChange:pt,style:{position:"absolute",opacity:0,pointerEvents:"none"}})]}),jsxs("div",{className:"modal-v2-field-wrapper",children:[jsxs("button",{className:"modal-v2-field",onClick:()=>Dt(!Ct),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:rt.estimatedTime?`${rt.estimatedTime}h`:"Not set"})]}),Ct&&jsx("div",{className:"modal-v2-popover",children:jsx("input",{type:"number",min:"0",step:"0.5",placeholder:"Hours",value:rt.estimatedTime||"",onChange:W=>jt(W.target.value),className:"modal-v2-time-input",autoFocus:true,onBlur:()=>Dt(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"})]}),U?jsx("textarea",{className:"modal-v2-textarea",value:rt.description||"",onChange:W=>{if(k){let ie={...k,description:W.target.value};j(ie);}},onBlur:Ie,placeholder:"Add a detailed description...",autoFocus:true}):jsx("div",{className:"modal-v2-content",onClick:()=>ae(true),children:rt.description?jsx("div",{className:"modal-v2-markdown",children:_t(rt.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"}),L.length>0&&jsxs("span",{className:"modal-v2-count",children:[xa,"/",L.length]}),jsxs("button",{className:"modal-v2-add-button",onClick:()=>V(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:[L.map(W=>jsxs("div",{className:`modal-v2-subtask ${W.completed?"completed":""}`,children:[jsx("button",{className:"modal-v2-subtask-checkbox",onClick:()=>zt(W.id),children:W.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:W.title}),jsx("button",{className:"modal-v2-subtask-delete",onClick:()=>mt(W.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"})]})})]},W.id)),Y&&jsx("div",{className:"modal-v2-subtask-input-row",children:jsx("input",{type:"text",placeholder:"Subtask title...",value:R,onChange:W=>J(W.target.value),onKeyDown:W=>{W.key==="Enter"&&Mt(),W.key==="Escape"&&(V(false),J(""));},onBlur:Mt,autoFocus:true,className:"modal-v2-subtask-input"})})]})]}),(F||S.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"}),S.length>0&&jsx("span",{className:"modal-v2-count",children:S.length})]}),jsx(yo,{cardId:rt.id,attachments:S,onUpload:F?W=>F(rt.id,W):void 0,onDelete:T,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 ${z==="all"?"active":""}`,onClick:()=>te("all"),children:"All"}),jsx("button",{className:`modal-v2-filter ${z==="comments"?"active":""}`,onClick:()=>te("comments"),children:"Comments"}),jsx("button",{className:`modal-v2-filter ${z==="history"?"active":""}`,onClick:()=>te("history"),children:"History"})]})]}),jsxs("div",{className:"modal-v2-comment-input",children:[u&&jsx("div",{className:"modal-v2-avatar",style:{background:u.color},children:u.initials}),jsxs("div",{className:"modal-v2-comment-wrapper",children:[jsx("textarea",{ref:lt,className:"modal-v2-comment-textarea",placeholder:"Write a comment...",value:Ne,onChange:W=>$e(W.target.value),onKeyDown:Ut,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:Pt,disabled:!Ne.trim(),children:"Send"})]})]})]}),jsxs("div",{className:"modal-v2-timeline",children:[Wt.map(W=>{let ie=s.find(Kt=>Kt.id===W.userId);if(W.type.includes("COMMENT")){let Kt=o.find(re=>re.id===W.metadata?.commentId);return Kt?jsxs("div",{className:"modal-v2-activity-item comment-item",children:[ie&&jsx("div",{className:"modal-v2-avatar",style:{background:ie.color},children:ie.initials}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-activity-header",children:[jsx("span",{className:"modal-v2-activity-user",children:ie?.name||"Unknown"}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]}),jsx("div",{className:"modal-v2-comment-body",children:Kt.content})]})]},W.id):null}return jsxs("div",{className:"modal-v2-activity-item history-item",children:[jsxs("div",{className:"modal-v2-history-icon",children:[W.type.includes("CREATED")&&"\u2795",W.type.includes("UPDATED")&&"\u270F\uFE0F",W.type.includes("MOVED")&&"\u27A1\uFE0F",W.type.includes("DELETED")&&"\u{1F5D1}\uFE0F",W.type.includes("ASSIGNED")&&"\u{1F464}",W.type.includes("PRIORITY")&&"\u{1F3AF}",W.type.includes("LABEL")&&"\u{1F3F7}\uFE0F"]}),jsxs("div",{className:"modal-v2-activity-content",children:[jsxs("div",{className:"modal-v2-history-text",children:[jsx("span",{className:"modal-v2-activity-user",children:ie?.name||"Unknown"})," ",W.type.replace(/_/g," ").toLowerCase(),W.newValue&&jsxs(Fragment,{children:[" to ",jsx("strong",{children:W.newValue})]})]}),jsx("span",{className:"modal-v2-activity-time",children:new Date(W.timestamp).toLocaleString()})]})]},W.id)}),Wt.length===0&&jsxs("div",{className:"modal-v2-empty",children:[jsx("p",{children:"No activity yet"}),jsx("span",{children:"Activity will appear here"})]})]})]})]})})})}function Fy({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 kd({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((l,d)=>l+d.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(Fy,{})}),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}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",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((o,l)=>o+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((o,l)=>o+l.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,l)=>o+(l.planned||0),0)})]})]})]})}function zy({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 Cd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,l=e[e.length-1]?.ideal||0,d=s>0?(s-o)/s*100:0,i=o<=l;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?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(zy,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?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:d>=50?"#10B981":"#F59E0B"},children:[d.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:o})]}),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 Yy={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Qp=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function Xy({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,l=e+o*Math.cos(-a*(Math.PI/180)),d=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:l,y:d,fill:"white",textAnchor:l>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Zp({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=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:[n,"%"]})]})]})}function Td({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((d,i)=>d+i.value,0),o=e.map(d=>({...d,totalValue:s,color:d.color||Yy[d.name]||Qp[e.indexOf(d)%Qp.length]})),l=o.map(d=>d.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:o,cx:"50%",cy:"50%",labelLine:false,label:n?Xy:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((d,i)=>jsx(Cell,{fill:l[i]},`cell-${i}`))}),jsx(Tooltip,{content:jsx(Zp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(d,i)=>{let u=i.payload,m=s>0?(u.value/s*100).toFixed(0):"0";return `${d} (${u.value} - ${m}%)`}})]}):jsxs(BarChart$1,{data:o,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(Zp,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((d,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:"#00E5CC"},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((d,i)=>i.value>d.value?i:d).name})]})]})]})}var Ri=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,l]=useState(false),[d,i]=useState(false),[u,m]=useState(false),[p,g]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),x=w=>{r.onBulkUpdate?.(f,{priority:w}),l(false);},y=w=>{r.onBulkMove?.(f,w),i(false),a();},b=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),m(false);},h=w=>{let N=new Set;e.forEach(F=>{F.labels?.forEach(T=>N.add(T));});let S=Array.from(new Set([...N,...w]));r.onBulkUpdate?.(f,{labels:S}),g(false);},v=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),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(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>x(w),children:[jsx("span",{className:c("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!d),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>b([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>g(!p),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:v,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"})})]})]})})});Ri.displayName="BulkOperationsToolbar";function tx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,l,d,i;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(g=>{let f=a?.find(x=>x.id===g);o=`assignee-${g}`,l=f?.name||`User ${g}`,d=f?.color,i=f?.avatar,r.has(o)||r.set(o,{id:o,title:l,groupValue:g,cardIds:[],color:d,icon:i}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",l="Unassigned",d="#6b7280",i="\u{1F464}",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:d,icon:i}),r.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`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,d=p.color,r.has(o)||r.set(o,{id:o,title:l,groupValue:s,cardIds:[],color:d}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(g=>{o=`label-${g}`,l=g,d="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:g,cardIds:[],color:d}),r.get(o).cardIds.push(n.id);}):(o="label-none",l="No Labels",d="#6b7280",r.has(o)||r.set(o,{id:o,title:l,groupValue:null,cardIds:[],color:d}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Nd({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n}){let[s,o]=useState(new Set),l=useMemo(()=>tx(e.cards,t.groupBy,a),[e.cards,t.groupBy,a]),d=useCallback(i=>{o(u=>{let m=new Set(u);return m.has(i)?m.delete(i):m.add(i),m});},[]);return t.groupBy==="none"||l.length===0?jsx(jo,{board:e,callbacks:r,availableUsers:a,className:n}):jsxs("div",{className:c("asakaa-swimlane-view",n),children:[l.map(i=>{let u=s.has(i.id),m=e.cards.filter(g=>i.cardIds.includes(g.id)),p={...e,cards:m};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&&d(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":u?"Expand lane":"Collapse lane",children:u?"\u25B6":"\u25BC"})]}),!u&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(jo,{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 Dd=[{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 Sd({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),l=Dd.find(i=>i.value===e)||Dd[0];useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let d=i=>{t(i),n(false);};return jsxs("div",{className:c("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!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:c("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Dd.map(i=>jsxs("button",{onClick:()=>d(i.value),className:c("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-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:i.description})]})]},i.value))})]})]})}var Ls=[{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 ox(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(i=>e.key===i||e.code===i))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,l=n.alt?e.altKey:!e.altKey,d=n.meta?e.metaKey:true;return s&&o&&l&&d}function om(e={}){let{shortcuts:t=Ls,enabled:a=true,preventDefault:r=true}=e,n=useRef(t),s=useRef(a);useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=useCallback(d=>{n.current=[...n.current,d];},[]),l=useCallback(d=>{n.current=n.current.filter(i=>i.action!==d);},[]);return useEffect(()=>{function d(i){if(!s.current)return;let u=i.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&i.key!=="Escape"&&!i.ctrlKey&&!i.metaKey)){for(let m of n.current)if(ox(i,m)){r&&i.preventDefault();let p=new CustomEvent("keyboard-action",{detail:m.action,bubbles:true,cancelable:true});window.dispatchEvent(p);break}}}return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[r]),{registerShortcut:o,unregisterShortcut:l,isEnabled:a}}function sx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function ix(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 lx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=ix(e),r=t?sx(t):"";return a?`${a} + ${r}`:r}function dx(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 Ed({shortcuts:e=Ls,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function l(d){d.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[t,a]),!n||!t)return null;let o=dx(e);return jsxs("div",{className:c("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(o).map(([l,d])=>d.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-[#00E5CC] rounded-full"}),l]}),jsx("div",{className:"space-y-3",children:d.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:lx(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 Md=[{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,13 +122,13 @@ 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 Ed({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),n(false);},d=e.reduce((i,u)=>{let m=u.category||"Other";return i[m]||(i[m]=[]),i[m].push(u),i},{});return jsxs("div",{className:c("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!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:c("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(d).map(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(m=>jsxs("button",{onClick:()=>l(m),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:m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.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 Pd({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,l]=useState("export"),[d,i]=useState("json"),[u,m]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=n?.current||void 0,y=await Su(e,d,x);Eu(y,d);},f=async x=>{let y=x.target.files?.[0];if(y){try{let b=await Fu(y),h=y.name.endsWith(".json")?"json":"csv",v=Pu(b,h);m(v),v.success&&r&&r(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:c("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:c("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:c("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>i(x),className:c("p-4 rounded-lg border-2 transition-all text-center",d===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="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:f,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"})]})]}),u&&jsxs("div",{className:c("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:c("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var gx=["URGENT","HIGH","MEDIUM","LOW"],fx=[{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"}],bx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Fd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:m=true,compact:p=false,groupBy:g="none",onGroupByChange:f}){let[x,y]=useState(true),b=useCallback(D=>{a({search:D.target.value});},[a]),h=useCallback(D=>{a({dateFilter:D.target.value});},[a]),v=useCallback(D=>{r({by:D.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[m&&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"}),o&&jsx("button",{onClick:o,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:b,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:D=>{let F=D.target.value;a({priorities:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),gx.map(D=>jsx("option",{value:D,children:D},D))]})}),d.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:D=>{let F=D.target.value;a({assignees:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),d.map(D=>jsx("option",{value:D.id,children:D.name},D.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:D=>{let F=D.target.value;a({labels:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(D=>jsx("option",{value:D,children:D},D))]})}),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:v,className:"filter-bar__select filter-bar__select--sm",children:fx.map(D=>jsx("option",{value:D.value,children:D.label},D.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:D=>f(D.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:bx.map(D=>jsx("option",{value:D.value,children:D.label},D.value))})}),N&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Ad({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:d}){let[i,u]=useState(false),m=useRef(null);useEffect(()=>{let g=f=>{m.current&&!m.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),u(false);};return jsxs("div",{className:c("relative",r),ref:m,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await 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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Ld={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:"#00E5CC",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"}},Id={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:"#00E5CC",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"}},Bd={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"}},gn={dark:Ld,light:Id,neutral:Bd},Ii="dark";var Bi=createContext(void 0),Dx="asakaa-theme";function nm({children:e,defaultTheme:t=Ii,storageKey:a=Dx}){let[r,n]=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=>{n(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,d=gn[r];Object.entries(d.colors).forEach(([u,m])=>{m&&l.style.setProperty(`--theme-${Sx(u)}`,m);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,m])=>{let p=d.colors[u];p&&l.style.setProperty(m,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:gn};return jsx(Bi.Provider,{value:o,children:e})}function Vn(){let e=useContext(Bi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Sx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function Rd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=Vn();return e?jsxs("div",{className:c("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(gn).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:c("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/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:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.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 sm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return xt[e]||xt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",xt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",xt[e].bgSecondary),bgGrid:r("--theme-bg-card",xt[e].bgGrid),bgWeekend:r("--theme-bg-hover",xt[e].bgWeekend),border:r("--theme-border-primary",xt[e].border),borderLight:r("--theme-border-subtle",xt[e].borderLight),textPrimary:r("--theme-text-primary",xt[e].textPrimary),textSecondary:r("--theme-text-secondary",xt[e].textSecondary),textTertiary:r("--theme-text-tertiary",xt[e].textTertiary),accent:r("--theme-accent-primary",xt[e].accent),accentHover:r("--theme-accent-hover",xt[e].accentHover),accentLight:r("--theme-accent-primary",xt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",xt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",xt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",xt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",xt[e].dependency),dependencyHover:r("--theme-border-secondary",xt[e].dependencyHover),criticalPath:r("--theme-error",xt[e].criticalPath),criticalPathLight:r("--theme-error",xt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",xt[e].today):e==="neutral"?r("--theme-text-primary",xt[e].today):r("--theme-error",xt[e].today),todayLight:e==="light"?r("--theme-accent-primary",xt[e].todayLight):e==="neutral"?r("--theme-text-primary",xt[e].todayLight):r("--theme-error",xt[e].todayLight),milestone:r("--theme-warning",xt[e].milestone),milestoneLight:r("--theme-warning",xt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",xt[e].statusTodo),statusInProgress:r("--theme-accent-primary",xt[e].statusInProgress),statusCompleted:r("--theme-success",xt[e].statusCompleted),hoverBg:r("--theme-bg-hover",xt[e].hoverBg),focusRing:r("--theme-accent-primary",xt[e].focusRing),...xt[e].dotGrid&&{dotGrid:xt[e].dotGrid},...xt[e].glassHeader&&{glassHeader:xt[e].glassHeader},...xt[e].glassToolbar&&{glassToolbar:xt[e].glassToolbar},...xt[e].forecastHud&&{forecastHud:xt[e].forecastHud},...xt[e].neonRedGlow&&{neonRedGlow:xt[e].neonRedGlow},...xt[e].executionBarBg&&{executionBarBg:xt[e].executionBarBg}}}var Ri={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},im={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Od={en:Ri,es:im};function lm(e){return Od[e]||Od.en}function $d(e,t){let a=lm(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 jn=createContext(Ri);function Vr(){return useContext(jn)}function Ps(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,d;a==="right"?d=o.right-r:d=o.left;let i=8;d+r>window.innerWidth-i&&(d=window.innerWidth-i-r),d<i&&(d=i),s({top:l,left:d});},[t,a,e,r]),n}function hm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,d]=useState(false),[i,u]=useState(null),m=useRef(null),p=useRef(null),g=Vr(),f=Ps(m,l,"right",176);if(useEffect(()=>{if(!l)return;let h=v=>{let w=v.target;m.current&&!m.current.contains(w)&&p.current&&!p.current.contains(w)&&d(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]),!(t||a||r||n||s||o))return null;let y=[{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:n},{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:o}].filter(h=>h.handler),b=async(h,v)=>{if(v){u(h);try{await v();}catch(w){console.error(`Export ${h} failed:`,w);}finally{u(null),d(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:m,onClick:()=>d(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] 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:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:y.map((h,v)=>jsxs(motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function cm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=useState(false),[d,i]=useState(null),[u,m]=useState(false),p=useRef(null),g=useRef(null),f=Vr(),x=Ps(p,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let N=D=>{let F=D.target;p.current&&!p.current.contains(F)&&g.current&&!g.current.contains(F)&&l(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(N=>N.handler),v=async(N,D)=>{if(D){i(N);try{await D();}catch(F){console.error(`Export ${N} failed:`,F);}finally{i(null),l(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((N,D)=>jsxs(motion.button,{onClick:()=>v(N.id,N.handler),disabled:d!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:D*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:d===N.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):N.icon}),jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Xx({options:e,value:t,onChange:a,theme:r,layoutId:n="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 o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,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:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Jx({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.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}})]},n.value)})})}function um({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),l=useRef(null),d=Vr(),i=Ps(o,n,"left");useEffect(()=>{if(!n)return;let p=g=>{let f=g.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[n]);let u=[{value:"all",label:d.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],m=t==="all"?d.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${d.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((p,g)=>{let f=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:p.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function pm({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),l=useRef(null),d=useRef(null),i=Vr(),u=Ps(l,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let h=b.target;l.current&&!l.current.contains(h)&&d.current&&!d.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),d._cleanup&&d._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:m.map(f=>{let x=t===f.value&&!r,y=()=>f.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{a(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#00E5CC":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function Qx({value:e,onChange:t,theme:a}){let r=Vr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let l=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Zx({theme:e,forecast:t}){let a=Vr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,d=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,p=t?.currency||"$",g=m!=null?m>=1e6?`${p}${(m/1e6).toFixed(2)}M`:m>=1e3?`${p}${(m/1e3).toFixed(1)}K`:`${p}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",n]}),o&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:d.bg,color:d.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&y&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function ev({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:d,rowDensity:i,onRowDensityChange:u,hasDependencies:m=true}){let[p,g]=useState(false),f=useRef(null),x=useRef(null),y=Vr(),b=Ps(f,p,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let D=F=>{let T=F.target;f.current&&!f.current.contains(T)&&x.current&&!x.current.contains(T)&&g(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[p]);let v=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:GitBranch,active:l,onChange:d}],N=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((D,F)=>{let T=D.icon,S=D.disabled,P=D.tooltip;return jsxs(motion.button,{onClick:()=>!S&&D.onChange?.(!D.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:S?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:S?"not-allowed":"pointer"},whileHover:S?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:F*.03},title:P,children:[jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:S?h?"rgba(255,255,255,0.2)":"#D1D5DB":D.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:D.label}),D.active&&!S&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},D.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((D,F)=>{let T=i===D.value;return jsxs(motion.button,{onClick:()=>u(D.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+F)*.03},children:[jsx("span",{style:{color:T?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:D.label}),T&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},D.value)})]})]})}),document.body)]})}function Oi({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:l,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:m,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:N="execution",onViewModeChange:D,projectForecast:F,onExportPNG:T,onExportPDF:S,onExportExcel:P,onExportCSV:k,onExportJSON:j,onExportMSProject:U,showCriticalPath:ae=true,onShowCriticalPathChange:L,showDependencies:X=true,onShowDependenciesChange:K,highlightWeekends:V=true,onHighlightWeekendsChange:R,showBaseline:J=false,onShowBaselineChange:Te,onCopySnapshotLink:$e,hasDependencies:H=true}){let te=Vr(),ye=T||S||P||k||j||U,Re=!!e.glassToolbar,[Se,Ee]=useState(false),Ve=useRef(null);useEffect(()=>{Se&&Ve.current&&Ve.current.focus();},[Se]);let ot=[{value:"day",label:te.toolbar.day},{value:"week",label:te.toolbar.week},{value:"month",label:te.toolbar.month}],be=[{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"})}],Ge=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Re){let je=Ge?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:Ge?"#1A1A1A":e.bgSecondary,border:`1px solid ${Ge?"rgba(255,255,255,0.08)":e.border}`},animate:{width:Se?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Ee(!Se),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),Se&&jsx("input",{ref:Ve,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Ee(false),onKeyDown:He=>{He.key==="Escape"&&Ee(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),D&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Ge?"#000000":e.bgSecondary,border:`1px solid ${Ge?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>D("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?Ge?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:te.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>D("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?Ge?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:N==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:te.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Qx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),v&&jsx(um,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsx(pm,{theme:e,value:g,onChange:f,hideCompleted:x,onHideCompletedChange:y}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),jsx(ev,{theme:e,showCriticalPath:ae,onShowCriticalPathChange:L,showBaseline:J,onShowBaselineChange:Te,highlightWeekends:V,onHighlightWeekendsChange:R,showDependencies:X,onShowDependenciesChange:K,rowDensity:l,onRowDensityChange:d,hasDependencies:H}),jsx(cm,{theme:e,onExportPNG:T,onExportPDF:S,onExportExcel:P,onExportMSProject:U,onCopySnapshotLink:$e}),u&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Ge?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Ge?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||te.toolbar.createTask})]})]})]}),F&&jsx(Zx,{theme:e,forecast:F})]})}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(Jx,{options:ot,value:t,onChange:je=>a(je),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:()=>n(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>n(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}}),v&&jsx(um,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(pm,{theme:e,value:g,onChange:f,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[b,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||te.toolbar.createTask})]}),(ye||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(cm,{theme:e,onExportPNG:T,onExportPDF:S,onExportExcel:P,onExportMSProject:U,onCopySnapshotLink:$e}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(Xx,{options:be,value:s,onChange:je=>o(je),theme:e})]})]})}function $i({columns:e,onToggleColumn:t,theme:a}){let[r,n]=useState(false),[s,o]=useState({x:0,y:0}),l=useRef(null),d=useRef(null);useEffect(()=>{if(!r)return;let u=m=>{l.current&&!l.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let u=d.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!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(ea,{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(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function Kn({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[l,d]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,m=r.length*36+8,p=8,g=window.innerWidth,f=window.innerHeight,x=t,y=a;t+u+p>g&&(x=t-u,x<p&&(x=p)),a+m+p>f&&(y=f-m-p,y<p&&(y=p)),d({x,y});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=p=>{o.current&&!o.current.contains(p.target)&&n();},m=p=>{p.key==="Escape"&&n();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,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(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:m=>{u.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var ga={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function Tm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:m,enableKeyboard:p=true}){let g=useRef(false),f=useCallback(v=>{g.current=v;},[]),x=useCallback(v=>{let w=[],N=D=>{for(let F of D)w.push(F),F.subtasks&&F.subtasks.length>0&&F.isExpanded&&N(F.subtasks);};return N(v),w},[]),y=useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=useCallback((v,w)=>{let N=x(e);if(N.length===0)return;let D=y();if(!D){a(N[0].id,false);return}let F=N.findIndex(P=>P.id===D.id);if(F===-1)return;let T=v==="up"?F-1:F+1;if(T<0||T>=N.length)return;let S=N[T];a(S.id,w);},[e,y,x,a]),h=useCallback(v=>{if(!p)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||g.current){v.key==="Escape"&&(w.blur(),g.current=false);return}let F=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,T=Array.from(t),S=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(S&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){S.subtasks&&S.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!S.isExpanded||v.key==="ArrowLeft"&&S.isExpanded)&&u(S.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){T.length>0&&(v.preventDefault(),o(T,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){T.length>0&&(v.preventDefault(),l(T));return}if(v.key==="Tab"&&v.shiftKey){T.length>0&&(v.preventDefault(),d(T));return}if(v.key==="Enter"&&!v.shiftKey&&!F){S&&(v.preventDefault(),r(S.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!F){S&&(v.preventDefault(),r(S.id,"above"));return}if(v.key==="Enter"&&F){S&&(v.preventDefault(),m(S.id));return}if(v.key==="F2"){S&&(v.preventDefault(),i(S.id));return}if(v.key==="Delete"||v.key==="Backspace"&&F){T.length>0&&(v.preventDefault(),n(T));return}if(v.key==="d"&&F&&!v.shiftKey){T.length>0&&(v.preventDefault(),s(T));return}},[p,t,y,b,r,n,s,o,l,d,i,u,m]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:f}}function Dm(){let[e,t]=useState(new Set),[a,r]=useState(null),n=useCallback(m=>{t(new Set([m])),r(m);},[]),s=useCallback(m=>{t(p=>{let g=new Set(p);return g.has(m)?g.delete(m):g.add(m),g}),r(m);},[]),o=useCallback((m,p)=>{if(!a){n(m);return}let g=p.indexOf(a),f=p.indexOf(m);if(g===-1||f===-1){n(m);return}let x=Math.min(g,f),y=Math.max(g,f),b=p.slice(x,y+1);t(new Set(b)),r(m);},[a,n]),l=useCallback((m,p,g,f)=>{f?o(m,p):g?s(m):n(m);},[n,s,o]),d=useCallback((m,p)=>{p?t(g=>{let f=new Set(g);return f.add(m),f}):n(m);},[n]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(m=>e.has(m),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:s,selectTaskRange:o,handleTaskClick:l,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function Vd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Vd(t.subtasks):t.subtasks}))}function hn(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((l,d)=>(l.position??0)-(d.position??0));for(let l=0;l<o.length;l++){let d={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function qn(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=qn(a.subtasks,t);if(r)return r}}return null}function Wd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=Wd(a.subtasks,t);if(r)return r}return null}function Gd(e,t){if(t.length===0)return e;let a=hn(e),r=t[0],n=a.findIndex(p=>p.id===r);if(n<=0)return e;let s=a[n-1],o=(p,g)=>{let f=[];return {tasks:p.filter(y=>{if(g.has(y.id))return f.push(y),false;if(y.subtasks){let b=o(y.subtasks,g);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(p,g,f)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,f)}:x),d=new Set(t),{tasks:i,removed:u}=o(e,d),m=l(i,s.id,u);return Vd(m)}function jd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=Wd(a,r);if(!n)continue;let s=Wd(a,n.id),o=(i,u,m)=>{for(let p=0;p<i.length;p++){let g=i[p];if(g.id===u&&g.subtasks){let f=g.subtasks.findIndex(x=>x.id===m);if(f!==-1){let[x]=g.subtasks.splice(f,1);return x}}if(g.subtasks){let f=o(g.subtasks,u,m);if(f)return f}}return null},l=(i,u,m)=>{let p=i.findIndex(g=>g.id===u);if(p!==-1)return i.splice(p+1,0,m),i;for(let g of i)g.subtasks&&l(g.subtasks,u,m);return i},d=o(a,n.id,r);d&&(s&&s.subtasks?l(s.subtasks,n.id,d):l(a,n.id,d));}return Vd(a)}function _d(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,l,d)=>{let i=o.findIndex(m=>m.id===l);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,l,d))return true;return false}let u=d==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(r,n,a),r}function Kd(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function As(e,t){let a=[...e],r=[];for(let n of t){let s=(d,i)=>d.map((u,m)=>({...u,id:`${u.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${m}`):void 0})),o=d=>{let i=d.findIndex(g=>g.id===n);if(i===-1){for(let g of d)if(g.subtasks){let f=o(g.subtasks);if(f)return f}return null}let u=d[i],m=`${u.id}-copy-${Date.now()}`,p={...u,id:m,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,m):void 0};return d.splice(i+1,0,p),p},l=o(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Sm(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=d=>{let i=d.findIndex(m=>m.id===t);if(i===-1){for(let m of d)if(m.subtasks&&l(m.subtasks))return true;return false}let u=a==="above"?i:i+1;return d.splice(u,0,o),true};return l(r),{tasks:r,newTask:o}}function qd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:qd(r.subtasks,t,a)}:r)}function Yd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Yd(a.subtasks,t)}:a)}function Xd(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let f=a(g.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,l=r?.endDate||s,d=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let f=d(g.subtasks);if(f>=0)return f}}return 0},i=d(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:r?.color||"#00E5CC",position:i,parentId:t},m=p=>p.map(g=>{if(g.id===t){let f=g.subtasks||[];return {...g,subtasks:[...f,u],isExpanded:true}}return g.subtasks?{...g,subtasks:m(g.subtasks)}:g});return {tasks:m(e),newTask:u}}function Em(e,t,a,r){if(t===a)return e;let n=qn(e,t);if(!n)return e;if(a){let l=(d,i)=>{if(!d.subtasks)return false;for(let u of d.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,a))return e}let s=l=>{let d=l.filter(u=>u.id!==t),i=d.length<l.length;return d.map((u,m)=>{let p=i?{...u,position:m}:u;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},o=s(e);if(a===null){let l=r!==void 0?r:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((d,i)=>({...d,position:i}));}else {let l=d=>d.map(i=>{if(i.id===a){let u=i.subtasks||[],m=r!==void 0?r:u.length,p=[...u];p.splice(m,0,{...n,parentId:a});let g=p.map((f,x)=>({...f,position:x}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function Gr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Gr(t.subtasks),r=a.reduce((l,d)=>(d.startDate&&l.starts.push(new Date(d.startDate).getTime()),d.endDate&&l.ends.push(new Date(d.endDate).getTime()),l.progresses.push(d.progress??0),l),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((l,d)=>l+d,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function zi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskDblClick:o,onTaskContextMenu:l,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:m,onColumnResize:p,onTaskUpdate:g,onBulkFill:f,onTaskIndent:x,onTaskOutdent:y,onTaskMove:b,onMultiTaskDelete:h,onTaskDuplicate:v,onTaskCreate:w,onTaskRename:N,onCreateSubtask:D,onOpenTaskModal:F,onDeleteRequest:T,onTaskReparent:S,scrollContainerRef:P,showCriticalPath:k=false}){let j=useContext(jn),[U,ae]=useState(null),[L,X]=useState(null),[K,V]=useState(""),R=useRef(null),[J,Te]=useState(null),[$e,H]=useState(0),[te,ye]=useState(0),[Re,Se]=useState({isOpen:false,x:0,y:0,type:"header"}),[Ee,Ve]=useState(null),[ot,be]=useState(null),[Ge,je]=useState(null),He=useRef(0),wt=5,Nt=useRef(false),[Je,ze]=useState(null),[lt,At]=useState(false),Ne=useRef(null),[ft,A]=useState(null),[ie,B]=useState(null),[Z,O]=useState(false),ee=useRef(null);useEffect(()=>{function re(xe){ee.current&&!ee.current.contains(xe.target)&&O(false);}if(Z)return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[Z]),useEffect(()=>{L&&R.current&&(R.current.focus(),R.current.select());},[L]),useEffect(()=>{if(!J)return;let re=Tt=>{let bt=Tt.clientX-$e,pt=te+bt;p?.(J,pt);},xe=()=>{Te(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",re),document.addEventListener("mouseup",xe),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",xe),document.body.style.cursor="",document.body.style.userSelect="";}},[J,$e,te,p]);let{selectedTaskIds:Ue,handleTaskClick:ke,isTaskSelected:Be}=Dm(),{setIsEditing:Me}=Tm({tasks:e,selectedTaskIds:Ue,onTaskSelect:(re,xe)=>{let bt=hn(e).map(pt=>pt.id);ke(re,bt,xe||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:b||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:re=>{let xe=hn(e).find(Tt=>Tt.id===re);xe&>(xe);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:re=>{let xe=hn(e).find(Tt=>Tt.id===re);xe&&F&&F(xe);},enableKeyboard:true}),Pe=(re,xe=0,Tt="")=>{let bt=[],pt=[...re].sort((it,q)=>(it.position??0)-(q.position??0));for(let it=0;it<pt.length;it++){let q=pt[it],fe=it+1,ce=Tt?`${Tt}.${fe}`:`${fe}.0`,$=q.wbsCode||ce;if(q.wbsCode=$,bt.push({task:q,level:xe}),q.subtasks&&q.subtasks.length>0&&q.isExpanded){let Ke=q.wbsCode?.replace(/\.0$/,"")||(Tt?`${Tt}.${fe}`:`${fe}`);bt.push(...Pe(q.subtasks,xe+1,Ke));}}return bt},nt=Pe(e),at=48,dt=Math.max(nt.length*a,600-at),mt=(re,xe)=>xe==="assignees"?re.assignees:xe==="startDate"?re.startDate:re.endDate,Vt=(re,xe,Tt,bt)=>{re.preventDefault(),re.stopPropagation(),A({sourceTaskId:xe,column:Tt,sourceIndex:bt,targetIndex:bt});let pt=re.currentTarget.closest("[data-grid-body]"),it=ce=>{let $=pt?.getBoundingClientRect().top??0,ne=Math.floor((ce-$)/a);return ne=Math.max(0,Math.min(nt.length-1,ne)),ne<bt&&(ne=bt),ne},q=ce=>{let $=it(ce.clientY);A(ne=>ne&&{...ne,targetIndex:$});},fe=ce=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",fe),A(null);let $=it(ce.clientY),ne=nt.find(Y=>Y.task.id===xe)?.task;if(!ne)return;let Ke=mt(ne,Tt),C=Math.min(bt,$),z=Math.max(bt,$),ve=[];for(let Y=C;Y<=z;Y++){if(Y===bt)continue;let Ze=nt[Y]?.task;!Ze||Ze.subtasks&&Ze.subtasks.length>0||ve.push(Ze.id);}ve.length!==0&&f?.(ve,Tt,Ke);};window.addEventListener("mousemove",q),window.addEventListener("mouseup",fe);},Mt=re=>{if(!ft)return false;let xe=Math.min(ft.sourceIndex,ft.targetIndex),Tt=Math.max(ft.sourceIndex,ft.targetIndex);return re>=xe&&re<=Tt},zt=re=>!re.startDate||!re.endDate?"-":`${Math.ceil((re.endDate.getTime()-re.startDate.getTime())/(1e3*60*60*24))}d`,gt=re=>{X(re.id),V(re.name),Me(true);},Dt=re=>{K.trim()&&K!==e.find(xe=>xe.id===re)?.name&&N?.(re,K.trim()),X(null),V(""),Me(false);},Ut=()=>{X(null),V(""),Me(false);},Gt=(re,xe)=>{xe.stopPropagation(),D?.(re.id);},Rt=(re,xe)=>{xe.preventDefault(),He.current=xe.clientY,Ve(re),Nt.current=false,At(false),ze({x:xe.clientX,y:xe.clientY});},rt=re=>{if(!Ee||(Math.abs(re.clientY-He.current)>wt&&!Nt.current&&(Nt.current=true,At(true)),ze({x:re.clientX,y:re.clientY}),!Nt.current))return;if(P?.current){let it=P.current,q=it.getBoundingClientRect(),fe=60,ce=12;Ne.current&&(cancelAnimationFrame(Ne.current),Ne.current=null);let $=re.clientY-q.top,ne=q.bottom-re.clientY;if($<fe&&it.scrollTop>0){let Ke=Math.round(ce*(1-$/fe)),C=()=>{it.scrollTop-=Ke,Nt.current&&it.scrollTop>0&&(Ne.current=requestAnimationFrame(C));};Ne.current=requestAnimationFrame(C);}else if(ne<fe&&it.scrollTop<it.scrollHeight-it.clientHeight){let Ke=Math.round(ce*(1-ne/fe)),C=()=>{it.scrollTop+=Ke,Nt.current&&it.scrollTop<it.scrollHeight-it.clientHeight&&(Ne.current=requestAnimationFrame(C));};Ne.current=requestAnimationFrame(C);}}let Tt=document.querySelectorAll("[data-task-row]"),bt=null,pt=null;Tt.forEach(it=>{let q=it.getBoundingClientRect(),fe=it.getAttribute("data-task-row");if(fe&&fe!==Ee&&re.clientY>=q.top&&re.clientY<=q.bottom){bt=fe;let ce=re.clientY-q.top,$=q.height;ce<$*.25?pt="above":ce>$*.75?pt="below":pt="child";}}),be(bt),je(pt);},ia=()=>{if(Nt.current&&Ee&&ot&&Ge){if(Ge==="child")S?.(Ee,ot);else if(Ge==="above"||Ge==="below"){let re=(pt,it,q=null)=>{for(let fe of pt){if(fe.id===it)return q;if(fe.subtasks){let ce=re(fe.subtasks,it,fe.id);if(ce!==void 0)return ce}}},xe=re(e,Ee,null),Tt=re(e,ot,null),bt=(pt,it,q,fe)=>{let ce=pt.findIndex(Ke=>Ke.id===it),$=fe?pt.findIndex(Ke=>Ke.id===q):-1,ne=Ge==="below"?ce+1:ce;return fe&&$!==-1&&$<ce&&(ne-=1),Math.max(0,ne)};if(Tt===null){let it=bt(e,ot,Ee,xe===null);S?.(Ee,null,it);}else {let pt=qn(e,Tt);if(pt?.subtasks){let it=xe===Tt,q=bt(pt.subtasks,ot,Ee,it);S?.(Ee,Tt,q);}}}}Ne.current&&(cancelAnimationFrame(Ne.current),Ne.current=null),Ve(null),be(null),je(null),ze(null),Nt.current=false,At(false);};useEffect(()=>{if(Ee)return document.addEventListener("mousemove",rt),document.addEventListener("mouseup",ia),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",ia),document.body.style.cursor="",document.body.style.userSelect="";}},[Ee,ot,Ge]);let fa=(re,xe,Tt)=>{let bt=xe.subtasks&&xe.subtasks.length>0;switch(re.id){case "name":let pt=L===xe.id,it=U===xe.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Tt*20}px`},children:[S&&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:it?1:.3},onMouseDown:Y=>Rt(xe.id,Y),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),xe.subtasks&&xe.subtasks.length>0?jsx("button",{onClick:Y=>{Y.stopPropagation(),d?.(xe.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:xe.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"}),pt?jsx("input",{ref:R,type:"text",value:K,onChange:Y=>V(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"?Dt(xe.id):Y.key==="Escape"&&Ut();},onBlur:()=>Dt(xe.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:Y=>Y.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:xe.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:xe.parentId?"13px":"14px",fontWeight:xe.isMilestone?600:xe.parentId?400:600,letterSpacing:xe.parentId?"0":"-0.01em"},title:xe.name,children:[xe.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:xe.wbsCode}),xe.isHighlighted&&xe.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:xe.name}),xe.subtasks&&xe.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(xe.progress||0),"%"]}),k&&xe.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),k&&xe.cpmData&&jsxs("span",{style:{color:xe.cpmData.totalFloat<=0?"#EF4444":xe.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(xe.cpmData.totalFloat),"d"]})]}),it&&!pt&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:Y=>Y.stopPropagation(),children:[jsx("button",{onClick:Y=>Gt(xe,Y),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:Y=>{Y.stopPropagation(),gt(xe);},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 fe=re.id==="startDate"?"startDate":"endDate",ce=xe[fe],$=ie?.taskId===xe.id&&ie?.field===fe,ne=Y=>Y?(typeof Y=="string"?new Date(Y):Y).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:Y=>Y.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:bt?.5:1,cursor:bt?"default":"pointer"},title:bt?"Auto-calculated from subtasks":void 0,onClick:Y=>{if(!bt)if($)B(null);else {let Ze=Y.currentTarget.getBoundingClientRect();B({taskId:xe.id,field:fe,month:ce?typeof ce=="string"?new Date(ce):ce:new Date,position:{top:Ze.bottom+4,left:Ze.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:ne(ce)}),bt&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),$&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>B(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:ie?.position.top,left:ie?.position.left},onClick:Y=>Y.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let Y=new Date,Ze=new Date(Y);Ze.setDate(Y.getDate()+1);let Ct=new Date(Y);Ct.setDate(Y.getDate()+7);let St=new Date(Y);return St.setDate(Y.getDate()+14),[{label:"Hoy",date:Y},{label:"Ma\xF1ana",date:Ze},{label:"Pr\xF3xima semana",date:Ct},{label:"2 semanas",date:St}].map((xa,Qt)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:ur=>ur.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ur=>ur.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(xe.id,{[fe]:xa.date}),B(null);},children:xa.label},Qt))})(),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:Y=>Y.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Y=>Y.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(xe.id,{[fe]:void 0}),B(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:()=>B(Y=>Y?{...Y,month:new Date(Y.month.getFullYear(),Y.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:ie?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>B(Y=>Y?{...Y,month:new Date(Y.month.getFullYear(),Y.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((Y,Ze)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:Y},Ze))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let Y=ie?.month||new Date,Ze=Y.getFullYear(),Ct=Y.getMonth(),St=new Date(Ze,Ct,1).getDay(),Na=new Date(Ze,Ct+1,0).getDate(),xa=new Date,Qt=[];for(let va=St-1;va>=0;va--)Qt.push({day:new Date(Ze,Ct,-va).getDate(),date:new Date(Ze,Ct-1,new Date(Ze,Ct,-va).getDate()),isCurrentMonth:false});for(let va=1;va<=Na;va++)Qt.push({day:va,date:new Date(Ze,Ct,va),isCurrentMonth:true});let ur=42-Qt.length;for(let va=1;va<=ur;va++)Qt.push({day:va,date:new Date(Ze,Ct+1,va),isCurrentMonth:false});return Qt.map((va,Nr)=>{let Sn=va.date.toDateString()===xa.toDateString(),Po=(ce?typeof ce=="string"?new Date(ce):ce:null)?.toDateString()===va.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:va.isCurrentMonth?Po?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Po?"#00E5CC":"transparent",boxShadow:Sn&&!Po?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{g?.(xe.id,{[fe]:va.date}),B(null);},children:va.day},Nr)})})()})]})]})]}),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:zt(xe)})});case "assignees":if(bt)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let Ke=r.filter(Y=>xe.assignees?.some(Ze=>Ze.id?Ze.id===Y.id:Ze.name===Y.name||Ze.initials===Y.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:Y=>Y.stopPropagation(),children:jsx(ln,{assignedUsers:Ke,availableUsers:r,onChange:Y=>{let Ze=Y.map(Ct=>({id:Ct.id,name:Ct.name,initials:Ct.initials,color:Ct.color}));g?.(xe.id,{assignees:Ze});}})});case "status":if(bt){let Y=xe.progress===100?"\u2713":xe.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:Y})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:Y=>Y.stopPropagation(),children:jsx(Xu,{status:xe.status||"todo",onChange:Y=>{g?.(xe.id,{status:Y,progress:Y==="completed"?100:xe.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:bt?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${xe.progress}%`,backgroundColor:xe.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:[xe.progress,"%"]})]});case "priority":let C={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},z={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},ve=C[xe.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:Y=>Y.stopPropagation(),children:jsx(nn,{priority:ve,onChange:Y=>{Y&&g?.(xe.id,{priority:z[Y]||"medium"});}})});default:return null}},W=re=>[{id:"hide",label:"Hide Column",icon:ga.Hide,onClick:()=>m(re),disabled:re==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ga.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ga.SortDesc,onClick:()=>{}}],le=re=>{let xe=re.subtasks&&re.subtasks.length>0,Tt=hn(e),bt=Ue.size>1&&Ue.has(re.id),pt=bt?Tt.filter($=>Ue.has($.id)):[re],it=pt.map($=>$.id),q=pt.filter($=>!($.subtasks&&$.subtasks.length>0)),fe=bt?` (${it.length})`:"",ce=()=>{T?T(it,re.name):h?.(it);};return xe?[{id:"addSubtask",label:j?.contextMenu?.addSubtask||"Add Subtask",icon:ga.Add,onClick:()=>{D?.(re.id);}},{id:"duplicate",label:(j?.contextMenu?.duplicateTask||"Duplicate Task")+fe,icon:ga.Duplicate,onClick:()=>{v?.(it);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(j?.contextMenu?.deleteTask||"Delete Task")+fe,icon:ga.Delete,onClick:ce}]:[{id:"edit",label:j?.contextMenu?.editTask||"Edit Task",icon:ga.Pencil,onClick:()=>{o?.(re);}},{id:"addSubtask",label:j?.contextMenu?.addSubtask||"Add Subtask",icon:ga.Add,onClick:()=>{D?.(re.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(j?.contextMenu?.markIncomplete||"Mark Incomplete")+fe,icon:ga.MarkIncomplete,onClick:()=>{q.forEach($=>g?.($.id,{status:"todo",progress:0}));},disabled:q.length===0||q.every($=>$.status==="todo")},{id:"setInProgress",label:(j?.contextMenu?.setInProgress||"Set In Progress")+fe,icon:ga.SetInProgress,onClick:()=>{q.forEach($=>g?.($.id,{status:"in-progress"}));},disabled:q.length===0||q.every($=>$.status==="in-progress")},{id:"markComplete",label:(j?.contextMenu?.markComplete||"Mark Complete")+fe,icon:ga.MarkComplete,onClick:()=>{q.forEach($=>g?.($.id,{status:"completed",progress:100}));},disabled:q.length===0||q.every($=>$.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(j?.contextMenu?.duplicateTask||"Duplicate Task")+fe,icon:ga.Duplicate,onClick:()=>{v?.(it);}},{id:"split",label:j?.contextMenu?.splitTask||"Split Task",icon:ga.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(j?.contextMenu?.deleteTask||"Delete Task")+fe,icon:ga.Delete,onClick:ce}]},st=u.filter(re=>re.visible),jt=st.reduce((re,xe)=>re+xe.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:jt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${at}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:st.map((re,xe)=>{let Tt=xe===st.length-1,bt=re.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${bt?"":"justify-center"}`,style:{width:`${re.width}px`,minWidth:`${re.minWidth??(bt?200:60)}px`,maxWidth:`${re.maxWidth??2e3}px`,flexShrink:bt&&st.length===1?1:0,flexGrow:bt&&st.length===1?1:0,borderRight:Tt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:pt=>{pt.preventDefault(),Se({isOpen:true,x:pt.clientX,y:pt.clientY,type:"header",columnId:re.id});},onMouseEnter:pt=>{pt.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:pt=>{pt.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:re.label,children:re.label}),re.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:J===re.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:pt=>{pt.preventDefault(),pt.stopPropagation(),Te(re.id),H(pt.clientX),ye(re.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:J===re.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},re.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx($i,{columns:u,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>O(!Z),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"})}),Z&&jsxs("div",{ref:ee,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:re=>re.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:()=>O(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","data-grid-body":true,style:{minHeight:dt},children:nt.map(({task:re,level:xe},Tt)=>{let bt=Be(re.id),pt=Mt(Tt),it=ot===re.id,q=it&&Ge==="above",fe=it&&Ge==="below",ce=it&&Ge==="child",$={};return ce&&($.backgroundColor=`${t.accent}15`,$.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":re.id,className:`flex items-center cursor-pointer group ${Ee===re.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:bt?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:bt?t.accentLight:ce?`${t.accent}15`:Tt%2===0?t.bgPrimary:t.bgGrid,opacity:k?re.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...$},onMouseEnter:()=>ae(re.id),onMouseLeave:()=>ae(null),onClick:ne=>{let C=hn(e).map(Y=>Y.id),ve=navigator.platform.toUpperCase().indexOf("MAC")>=0?ne.metaKey:ne.ctrlKey;ke(re.id,C,ve,ne.shiftKey),!ve&&!ne.shiftKey&&s?.(re);},onDoubleClick:ne=>{ne.stopPropagation(),o?.(re);},onContextMenu:ne=>{ne.preventDefault(),Se({isOpen:true,x:ne.clientX,y:ne.clientY,type:"task",task:re}),l?.(re,ne);},whileHover:{backgroundColor:bt?t.accentLight:t.hoverBg},children:[q&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),fe&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),st.map((ne,Ke)=>{let C=Ke===st.length-1,z=ne.id==="name",ve=!!(re.subtasks&&re.subtasks.length>0),Y=ne.id==="assignees"||ne.id==="startDate"||ne.id==="endDate"?ne.id:null,Ct=!!Y&&!ve&&U===re.id&&!ft,St=pt&&!!ft&&ft.column===ne.id;return jsxs("div",{className:`px-4 flex items-center ${z?"justify-start":"justify-center"}`,style:{position:"relative",width:`${ne.width}px`,minWidth:`${ne.minWidth??(z?200:60)}px`,maxWidth:`${ne.maxWidth??2e3}px`,flexShrink:z&&st.length===1?1:0,flexGrow:z&&st.length===1?1:0,borderRight:C?"none":`1px solid ${U===re.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:St?`${t.accent}22`:void 0,boxShadow:St?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[fa(ne,re,z?xe:0),Ct&&Y&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Na=>Vt(Na,re.id,Y,Tt),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${re.id}-${ne.id}`)})]},re.id)})}),jsx(Kn,{isOpen:Re.isOpen,x:Re.x,y:Re.y,items:Re.type==="header"&&Re.columnId?W(Re.columnId):Re.type==="task"&&Re.task?le(Re.task):[],onClose:()=>Se({...Re,isOpen:false}),theme:t}),lt&&Je&&Ee&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Je.x+12,top:Je.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let re=nt.find(xe=>xe.task.id===Ee)?.task;return re?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:re.name})}):null})()}),document.body)]})}function Lm(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,l]=useState(e),[d,i]=useState(t),[u,m]=useState(null),[p,g]=useState(null),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(0),[w,N]=useState(0),[D,F]=useState(null),[T,S]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:m,hoveredTaskId:p,setHoveredTaskId:g,activeZone:f,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:N,hoveredSegmentIndex:D,setHoveredSegmentIndex:F,isHovered:T,setIsHovered:S,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ae,L)=>{r("none"),m(null),g(null),l(ae),i(L),N(0),b(null),v(0);}}}function Ui({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:l,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:m,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:f,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:w}){let N=Lm(t,r),D=useRef(null),F=useRef(false),T=useRef(null),S=useRef(null),{dragMode:P,setDragMode:k,dragOffset:j,setDragOffset:U,ghostX:ae,setGhostX:L,ghostWidth:X,setGhostWidth:K,connectionLine:V,setConnectionLine:R,hoveredTaskId:J,setHoveredTaskId:Te,activeZone:$e,setActiveZone:H,draggedSegmentIndex:te,setDraggedSegmentIndex:ye,draggedSegmentStartX:Re,setDraggedSegmentStartX:Se,segmentDragOffsetX:Ee,setSegmentDragOffsetX:Ve,hoveredSegmentIndex:ot,setHoveredSegmentIndex:be,isHovered:Ge,setIsHovered:je,isDragging:He,isResizing:wt,isConnecting:Nt,resetDragState:Je}=N,ze=18,lt=!!n.executionBarBg,At=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Ne=lt?3:6,ft=e.subtasks&&e.subtasks.length>0,A=useRef(null),[ie,B]=(()=>{let q=useRef(null),[,fe]=useState(0);return [q.current,ce=>{q.current=ce,fe($=>$+1);}]})(),Z=!!w&&!v&&!ft&&!e.segments&&!!e.startDate&&!!e.endDate,O=e.endDate&&(()=>{let q=new Date;q.setHours(0,0,0,0);let fe=new Date(e.endDate);return fe.setHours(0,0,0,0),fe<q})()&&e.progress<100,ee=h&&e.isCriticalPath,Ue=n.name==="neutral"||n.today==="#1C1917",ke=e.status==="completed"||e.progress===100,Be={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Pe=h&&e.isCriticalPath||O?"#EF4444":e.color?e.color:e.priority&&Be[e.priority]?Be[e.priority]:n.taskBarPrimary,nt=v?"default":He?Nt?"crosshair":wt?"ew-resize":"grabbing":"grab",at=v?"default":"ew-resize",mt=(q=>q>=80?20:q>=60?15:q>=50?12:10)(r),Vt=r<50,Mt=r<40;useEffect(()=>{x&&(!Ge||He||e.segments)&&x(null);},[Ge,He,e.segments,x]);let zt=q=>q.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),gt=()=>{let q=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${q} day${q!==1?"s":""}`},Dt=q=>Math.round(q/s)*s,Ut=q=>{let fe=Math.round(q/s),ce=new Date(o);return ce.setDate(ce.getDate()+fe),ce},Gt=(q,fe)=>{for(let ce of g){if(ce.id===e.id)continue;let $=5;if(q>=ce.x-$&&q<=ce.x+ce.width+$&&fe>=ce.y-$&&fe<=ce.y+ce.height+$)return ce.id}return null},Rt=useCallback((q,fe,ce)=>{if(v)return;q.preventDefault(),q.stopPropagation();let $=D.current?.ownerSVGElement;if(!$)return;let ne=$.createSVGPoint();ne.x=q.clientX,ne.y=q.clientY;let Ke=ne.matrixTransform($.getScreenCTM()?.inverse()),C=ce!==void 0?ce:t,z=fe;if(!z){let ve=Ke.x-C;q.shiftKey?(z="connect",R({x:t+r,y:a+ze/2})):q.ctrlKey||q.metaKey?z="move":q.altKey?z=ve<r/2?"resize-start":"resize-end":Mt?ve<r/2?z="move":z="resize-end":Vt?ve<=mt/2?z="resize-start":ve>=r-mt/2?z="resize-end":z="move":ve<=mt?z="resize-start":ve>=r-mt?z="resize-end":z="move";}F.current=false,k(z),je(false),H(null),z==="move"?U(Ke.x-C):z==="connect"?R({x:t+r,y:a+ze/2}):U(0),L(C),K(r);},[t,r,a,ze,v]),rt=useCallback(q=>{let fe=D.current?.ownerSVGElement;if(!fe)return;let ce=fe.closest(".gantt-timeline-scroll");if(!ce)return;let $=ce.getBoundingClientRect(),ne=60,Ke=15,C=0;if(q.clientX<$.left+ne){let z=$.left+ne-q.clientX;C=-Math.min(Ke,z/2);}else if(q.clientX>$.right-ne){let z=q.clientX-($.right-ne);C=Math.min(Ke,z/2);}return C!==0&&(ce.scrollLeft+=C),C!==0},[]),ia=useCallback(q=>{if(P==="none")return;F.current=true,S.current=q;let fe=D.current?.ownerSVGElement;if(!fe)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let ne=rt(q);ne&&!T.current?T.current=window.setInterval(()=>{S.current&&(rt(S.current),ia(S.current));},16):!ne&&T.current&&(window.clearInterval(T.current),T.current=null);}let ce=fe.createSVGPoint();ce.x=q.clientX,ce.y=q.clientY;let $=ce.matrixTransform(fe.getScreenCTM()?.inverse());if(P==="connect"){R({x:$.x,y:$.y});let ne=Gt($.x,$.y);Te(ne);}else if(P==="move"){let ne=$.x-j,Ke=Dt(ne);L(Ke),K(r);let C=Math.round((Ke-t)/s);if(f?.(e.id,C,true),e.segments&&e.segments.length>0&&te!==null){let z=Ke-Re;Ve(z);}}else if(P==="resize-start"){let ne=$.x,Ke=Dt(ne),C=t+r-Ke;C>=s&&(L(Ke),K(C));}else if(P==="resize-end"){let ne=$.x,C=Dt(ne)-t;C>=s&&K(C);}},[P,t,r,s,j,e,Dt,te,Re,Gt,Te,R,L,K,Ve,f,rt]),fa=useCallback(()=>{if(T.current&&(window.clearInterval(T.current),T.current=null),S.current=null,P!=="none"){if(P==="connect")J&&p&&p(e,J),R(null),Te(null);else {let q=e.endDate.getTime()-e.startDate.getTime(),fe,ce,$=true;if(P==="move"){if(fe=Ut(ae),ce=new Date(fe.getTime()+q),e.segments&&e.segments.length>0&&te!==null){let ne=Math.round(Ee/s),Ke=e.segments.map((Y,Ze)=>{if(Ze===te){let Ct=new Date(Y.startDate),St=new Date(Y.endDate);return Ct.setDate(Ct.getDate()+ne),St.setDate(St.getDate()+ne),{startDate:Ct,endDate:St}}return Y}),C=Ke.flatMap(Y=>[Y.startDate,Y.endDate]),z=new Date(Math.min(...C.map(Y=>Y.getTime()))),ve=new Date(Math.max(...C.map(Y=>Y.getTime())));m?.({...e,segments:Ke},z,ve),Je(t,r);return}}else P==="resize-start"?(fe=Ut(ae),ce=e.endDate,fe>ce&&(console.warn("Invalid date range: start date must be before or equal to end date"),$=false)):P==="resize-end"?(fe=e.startDate,ce=Ut(ae+X),ce.setDate(ce.getDate()-1),ce<fe&&(console.warn("Invalid date range: end date must be after or equal to start date"),$=false)):$=false;$&&fe&&ce&&(ce.getTime()<fe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,fe,ce));}f?.(e.id,0,false),Je(t,r);}},[P,ae,X,e,m,J,p,t,r,s,Ut,Ee,te,Je,f]);useEffect(()=>{if(P==="none")return;let q=ce=>{ia(ce);},fe=()=>{fa();};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",fe),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",fe),T.current&&(window.clearInterval(T.current),T.current=null);}},[P,ia,fa]);let W=He&&!Nt?ae:t,le=He&&!Nt?X:r,st=l.taskClass(e),jt=24,re=h?e.isCriticalPath?1:.25:1,xe=useCallback(q=>{if(!Z)return;q.stopPropagation(),q.preventDefault();let ce=D.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;A.current={barRect:ce,initialPct:e.progress||0},q.currentTarget.setPointerCapture(q.pointerId),B(e.progress||0);},[Z,e.progress,B]),Tt=useCallback(q=>{let fe=A.current;if(!fe)return;let $=D.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??fe.barRect;if(!$||$.width<=0)return;let ne=(q.clientX-$.left)/$.width,Ke=Math.round(Math.max(0,Math.min(1,ne))*100);q.shiftKey&&(Ke=Math.round(Ke/25)*25),B(Ke);},[B]),bt=useCallback(q=>{let fe=A.current;if(!fe)return;q.stopPropagation(),q.preventDefault();try{q.currentTarget.releasePointerCapture(q.pointerId);}catch{}let ce=ie;A.current=null,B(null),ce!=null&&ce!==fe.initialPct&&w&&w(e,ce);},[ie,w,e,B]),pt=useCallback(q=>{q.stopPropagation(),q.preventDefault();},[]),it=ie??(e.progress||0);return jsxs("g",{ref:D,"data-task-bar":"true",style:{opacity:re,transition:"opacity 300ms ease"},onClick:()=>{!He&&!F.current&&d?.(e),F.current=false;},onDoubleClick:q=>{!He&&!F.current&&(q.stopPropagation(),i?.(e));},onContextMenu:q=>{q.preventDefault(),u?.(e,q);},onMouseEnter:()=>!He&&je(true),onMouseMove:q=>{x&&Ge&&!He&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ze,showBelow:false,mouseX:q.clientX,mouseY:q.clientY});},onMouseLeave:()=>{He||(je(false),H(null));},children:[jsx("rect",{x:t,y:a,width:r+jt,height:ze,fill:"transparent",style:{pointerEvents:"all"}}),Ge&&!He&&!Vt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:mt,height:ze,fill:$e==="resize-start"?n.accent:"transparent",opacity:$e==="resize-start"?.15:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>H("resize-start"),onMouseDown:q=>Rt(q,"resize-start")}),jsx("rect",{x:t+mt,y:a,width:r-mt*2,height:ze,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>H("move"),onMouseDown:q=>Rt(q,"move")}),jsx("rect",{x:t+r-mt,y:a,width:mt,height:ze,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.15:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>H("resize-end"),onMouseDown:q=>Rt(q,"resize-end")})]}),Ge&&!He&&Mt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ze,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>H("move"),onMouseDown:q=>Rt(q,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ze,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.2:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>H("resize-end"),onMouseDown:q=>Rt(q,"resize-end")}),Ge&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ze-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),He&&!Nt&&!e.segments&&jsx(motion.rect,{x:ae,y:a,width:X,height:ze,rx:Ne,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!He&&(()=>{let q=e.baselineStartDate.getTime(),fe=e.baselineEndDate.getTime(),ce=o.getTime(),$=864e5,ne=(q-ce)/$,Ke=(fe-q)/$,C=ne*s,z=Math.max(Ke*s,s),ve=W+le,Y=C+z,Ze=e.endDate?.getTime()??0,Ct=Math.ceil((Ze-fe)/$),St=Ct>0,Na=Ct<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:C,y:a,width:z,height:ze,rx:Ne,fill:"none",stroke:At?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),St&&ve>Y&&jsx("rect",{x:Y,y:a,width:ve-Y,height:ze,rx:0,fill:"#EF4444",opacity:.2}),St&&jsxs("text",{x:Math.max(ve,Y)+6,y:a+ze/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",Ct,"d"]}),Na&&jsxs("text",{x:ve+6,y:a+ze/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[Ct,"d"]})]})})(),!e.segments&<&&ft&&(()=>{let fe=a+(ze-8)/2,ce=4,$=e.progress||0,ne=new Date;ne.setHours(0,0,0,0);let Ke=e.startDate&&ne>=e.startDate,C=e.endDate&&(()=>{let St=new Date(e.endDate);return St.setHours(0,0,0,0),ne>St})(),z=e.startDate&&ne<e.startDate,ve=1;if(Ke&&e.startDate&&e.endDate&&!z){let St=new Date(e.startDate);St.setHours(0,0,0,0);let Na=new Date(e.endDate);Na.setHours(0,0,0,0);let xa=Math.max(1,(Na.getTime()-St.getTime())/(1e3*60*60*24)),ur=Math.min((ne.getTime()-St.getTime())/(1e3*60*60*24),xa)/xa*100;ve=ur>0?$/ur:1;}let Y;$>=100?Y="#00E5CC":z?Y="#4B5563":C&&$<100?Y="#EF4444":ve>=.95?Y="#22C55E":ve>=.8?Y="#F59E0B":Y="#EF4444";let Ze=Math.max($/100*le,$>0?ce*2:0),Ct=le>100&&$>0;return jsxs("g",{"data-task-class":st,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:W,y:fe,width:le,height:8,rx:ce,fill:"rgba(255,255,255,0.10)"}),$>0&&jsx("rect",{x:W,y:fe,width:Ze,height:8,rx:ce,fill:Y}),Ct&&jsxs("text",{x:W+Ze+6,y:fe+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round($),"%"]})]})})(),!e.segments&<&&!ft&&jsx(motion.rect,{x:W,y:a,width:le,height:ze,rx:Ne,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":st,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:He&&!Nt?.15:e.parentId?.6:1,scale:Ge&&!He?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:q=>Rt(q),style:{cursor:nt,pointerEvents:"all"}}),!e.segments&&!lt&&jsx(motion.rect,{x:W,y:a,width:le,height:ze,rx:Ne,fill:Pe,"data-task-class":st,initial:{opacity:0,scale:.95},animate:{opacity:He&&!Nt?.15:e.parentId?.6:Ge?.9:.8,scale:Ge&&!He?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ft?void 0:q=>Rt(q),style:{cursor:ft?"default":nt,pointerEvents:"all"}}),lt&&(O||ee)&&!e.segments&&jsx("rect",{x:W,y:a,width:le,height:ze,rx:Ne,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&it>0&&!ft&&jsx("rect",{x:W,y:a,width:Math.max(le*(it/100),Ne*2),height:ze,rx:Ne,fill:Pe,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!ft&&e.progress<100&&(()=>{let q=e.progress>0?le*(e.progress/100):0,fe=W+q,ce=le-q,$=e.progress===0?Ne:0,ne=e.progress===0?W:fe,Ke=e.progress===0?le:ce;return jsxs(Fragment,{children:[jsx("rect",{x:ne,y:a,width:Ke,height:ze,rx:$,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:ne,y:a,width:Ke,height:ze,rx:$,fill:"none",stroke:"#00E5CC",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),lt&&!e.segments&&e.progress>0&&e.progress<100&&!ft&&!He&&ie===null&&(()=>{let q=W+le*(e.progress/100),fe=8,ce=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:q,cy:a+ze/2,r:fe,fill:ce?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:q,y:a+ze/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ce?.initials||ce?.name?.charAt(0)?.toUpperCase()||""})]})})(),Z&&!He&&le>=40&&(ie!==null||it<88)&&(()=>{let q=W+le*(it/100),fe=a+ze/2,ce=ie!==null,$=ce?7:Ge?6:5,ne=ce||Ge?1:.35,Ke=W+le-q,C=Math.max(4,Math.min(12,Ke-10)),z=12;return jsxs("g",{children:[jsx("rect",{x:q-z,y:fe-12,width:z+C,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:xe,onPointerMove:Tt,onPointerUp:bt,onPointerCancel:bt,onClick:pt,onDoubleClick:pt,onMouseDown:ve=>ve.stopPropagation()}),jsx("circle",{cx:q,cy:fe,r:$,fill:"#FFFFFF",stroke:Pe,strokeWidth:2,opacity:ne,style:{pointerEvents:"none",filter:ce?`drop-shadow(0 0 4px ${Pe})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ce&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:q-20,y:fe-28,width:40,height:18,rx:4,fill:At?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Pe,strokeWidth:1}),jsxs("text",{x:q,y:fe-16,textAnchor:"middle",dominantBaseline:"central",fill:At?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[ie,"%"]})]})]})})(),e.segments&&e.segments.map((q,fe)=>{let ce=(q.startDate.getTime()-o.getTime())/864e5*s,ne=(q.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ce+s,Ke=He&&P==="move"&&te===fe,C=ot===fe,z=Ke?ce+Ee:ce;return jsxs("g",{onMouseEnter:()=>!He&&be(fe),onMouseLeave:()=>!He&&be(null),children:[jsx(motion.rect,{x:z,y:a,width:ne,height:ze,rx:Ne,fill:Pe,initial:{opacity:0,scale:.95},animate:{opacity:Ke||e.parentId?.6:C?.9:.8,scale:C&&!He?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ve=>{ve.stopPropagation(),ye(fe),Se(ce),Rt(ve,void 0,ce);},style:{cursor:nt,pointerEvents:"all"}}),jsx("rect",{x:z,y:a,width:ne*(e.progress/100),height:ze,rx:Ne,fill:Pe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${fe}`)}),Ue&&(O||ee)&&!e.segments&&jsxs(Fragment,{children:[ee&&!O&&jsx("rect",{x:W,y:a,width:le,height:ze,rx:Ne,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),O&&jsx("rect",{x:W,y:a,width:le,height:ze,rx:Ne,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&le>60&&!e.segments&&!(lt&&ft)&&(()=>{let q=l.taskLabel(e),fe=typeof q=="string"?q:e.name,ce=fe.length>Math.floor(le/8)?`${fe.substring(0,Math.floor(le/8))}...`:fe;return jsx("text",{x:W+8,y:a+ze/2,dominantBaseline:"middle",fill:ke?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ke?"line-through":"none"},children:ce})})(),!He&&!e.segments&&!ft&&e.progress>0&&e.progress<100&&(lt?jsxs("text",{x:W+le+6,y:a+ze/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):le>100?jsxs("text",{x:W+le-12,y:a+ze/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&le>80&&!He&&!e.segments&&!(lt&&ft)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:W+le-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:W+le-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ge||wt)&&!Nt&&!e.segments&&!ft&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:W-2,y:a,width:16,height:ze,fill:"transparent",style:{cursor:at},onMouseEnter:()=>H("resize-start"),onMouseLeave:()=>H(null),onMouseDown:q=>{q.stopPropagation(),Rt(q,"resize-start");}}),jsx(motion.rect,{x:W+4,y:a+8,width:3,height:ze-16,rx:1.5,fill:$e==="resize-start"||P==="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:W+le-14,y:a,width:16,height:ze,fill:"transparent",style:{cursor:at},onMouseEnter:()=>H("resize-end"),onMouseLeave:()=>H(null),onMouseDown:q=>{q.stopPropagation(),Rt(q,"resize-end");}}),jsx(motion.rect,{x:W+le-7,y:a+8,width:3,height:ze-16,rx:1.5,fill:$e==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Ge&&!He&&!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+ze/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>H("connect"),onMouseLeave:()=>H(null),onMouseDown:q=>{q.stopPropagation(),Rt(q,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ze/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:$e==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Nt&&V&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ze/2,x2:V.x,y2:V.y,stroke:J?n.statusCompleted:n.accent,strokeWidth:J?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:J?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:V.x,cy:V.y,r:J?8:6,fill:J?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),J&&jsx(motion.text,{x:V.x+15,y:V.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:V.x+10},animate:{opacity:1,x:V.x+15},transition:{duration:.2},children:"Connect"})]}),(Ge||He)&&!Nt&&!e.segments&&jsx(motion.rect,{x:W-1,y:a-1,width:le+2,height:ze+2,rx:Ne+1,fill:"none",stroke:He?n.accent:lt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:lt?1:2,opacity:He||lt?.6:.4,initial:{opacity:0},animate:{opacity:He||lt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),wt&&jsxs(Fragment,{children:[jsx("line",{x1:ae,y1:0,x2:ae,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:ae+X,y1:0,x2:ae+X,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Ge&&!He&&!e.segments&&!x&&(()=>{let ce=a<100,$=ce?a+ze+13:a-82-13,ne=ce?`M ${W+le/2-6} ${a+ze+3} L ${W+le/2} ${a+ze+13} L ${W+le/2+6} ${a+ze+3}`:`M ${W+le/2-6} ${a-13} L ${W+le/2} ${a-3} L ${W+le/2+6} ${a-13}`,Ke=$+22,C=$+40,z=$+55,ve=$+70,Y=ce?$+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:ce?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ce?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:ne,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:W+le/2-120,y:$,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:W+le/2,y:Ke,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:W+le/2-110,y:C,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:W+le/2-70,y:C,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:zt(e.startDate)}),jsx("text",{x:W+le/2-110,y:z,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:W+le/2-70,y:z,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:zt(e.endDate)}),jsx("text",{x:W+le/2+10,y:C,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:W+le/2+65,y:C,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:gt()}),jsx("text",{x:W+le/2+10,y:z,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:W+le/2+65,y:z,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:W+le/2-110,y:ve,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:W+le/2-50,y:ve,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ze=>Ze.name).join(", ").substring(0,30),e.assignees.map(Ze=>Ze.name).join(", ").length>30?"...":""]})]}),!ce&&jsx("text",{x:W+le/2,y:Y,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Mt?"Left: move \u2022 Right: resize":Vt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Jd=260,Xn=8,Rm=16,Wv=-12;function Om({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:N}=e,D=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,F=v.lastActivity!=null,T=(D?155:105)+(F?28:0),S=w+Rm,P=N+Wv-T;S+Jd>window.innerWidth-Xn&&(S=w-Jd-Rm),S<Xn&&(S=Xn);let k=P<Xn;k&&(P=N+20),P+T>window.innerHeight-Xn&&(P=window.innerHeight-Xn-T),s({left:S,top:P,showBelow:k});},[e]),!e||!n)return null;let{task:o}=e,l=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,d={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},i=v=>v.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),N=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,D=0,F=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),T=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;F.getTime()<=T.getTime();){let P=F.getDay();v[P]&&!w.has(N(F))&&D++,F.setDate(F.getDate()+1);}let S=Math.max(0,D);return a==="es"?`${S} d\xEDa${S!==1?"s":""}`:`${S} day${S!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),N=v%60;return w===0?`${N}m`:N===0?`${w}h`:`${w}h ${N}m`},p=t.textTertiary||"#9CA3AF",g=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Jd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(Wi,{label:d.start,value:o.startDate?i(o.startDate):"N/A",labelColor:p,valueColor:g}),jsx(Wi,{label:d.duration,value:u(),labelColor:p,valueColor:g}),jsx(Wi,{label:d.end,value:o.endDate?i(o.endDate):"N/A",labelColor:p,valueColor:g}),jsx(Wi,{label:d.progress,value:`${o.progress}%`,labelColor:p,valueColor:g})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:p},children:[d.assignees,": "]}),jsx("span",{style:{color:g,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),l&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.estimated,":"]})," ",jsx("span",{style:{color:g,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.quoted,":"]})," ",jsx("span",{style:{color:g,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:p,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:g},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function Pd({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function i(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[r]);let l=i=>{t(i),n(false);},d=e.reduce((i,u)=>{let m=u.category||"Other";return i[m]||(i[m]=[]),i[m].push(u),i},{});return jsxs("div",{className:c("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!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:c("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(d).map(([i,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:i})}),jsx("div",{children:u.map(m=>jsxs("button",{onClick:()=>l(m),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:m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:m.name}),m.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:m.description})]})]},m.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 Ad({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,l]=useState("export"),[d,i]=useState("json"),[u,m]=useState(null),p=useRef(null);if(!t)return null;let g=async()=>{let x=n?.current||void 0,y=await Mu(e,d,x);Pu(y,d);},f=async x=>{let y=x.target.files?.[0];if(y){try{let b=await Lu(y),h=y.name.endsWith(".json")?"json":"csv",v=Au(b,h);m(v),v.success&&r&&r(v,b);}catch(b){m({success:false,errors:[`Failed to read file: ${b instanceof Error?b.message:"Unknown error"}`]});}p.current&&(p.current.value="");}};return jsxs("div",{className:c("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>l("export"),className:c("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>l("import"),className:c("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(x=>jsxs("button",{onClick:()=>i(x),className:c("p-4 rounded-lg border-2 transition-all text-center",d===x?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[x==="json"&&"\u{1F4C4}",x==="csv"&&"\u{1F4CA}",x==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:x})]},x))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:g,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="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:f,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"})]})]}),u&&jsxs("div",{className:c("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:c("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((x,y)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",x]},y))})]})]})]})]})]})}var gx=["URGENT","HIGH","MEDIUM","LOW"],fx=[{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"}],bx=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function Ld({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:l,availableUsers:d=[],availableLabels:i=[],availableColumns:u=[],showQuickFilters:m=true,compact:p=false,groupBy:g="none",onGroupByChange:f}){let[x,y]=useState(true),b=useCallback(S=>{a({search:S.target.value});},[a]),h=useCallback(S=>{a({dateFilter:S.target.value});},[a]),v=useCallback(S=>{r({by:S.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),N=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${p?"filter-bar--compact":""} ${x?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>y(!x),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:x?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:S=>{S.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:S=>{S.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:x?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),N&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!x&&jsxs("div",{className:"filter-bar__content",children:[m&&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"}),o&&jsx("button",{onClick:o,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:b,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:S=>{let F=S.target.value;a({priorities:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),gx.map(S=>jsx("option",{value:S,children:S},S))]})}),d.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:S=>{let F=S.target.value;a({assignees:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),d.map(S=>jsx("option",{value:S.id,children:S.name},S.id))]})}),i.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:S=>{let F=S.target.value;a({labels:F==="all"?[]:[F]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),i.map(S=>jsx("option",{value:S,children:S},S))]})}),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:v,className:"filter-bar__select filter-bar__select--sm",children:fx.map(S=>jsx("option",{value:S.value,children:S.label},S.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:g,onChange:S=>f(S.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:bx.map(S=>jsx("option",{value:S.value,children:S.label},S.value))})}),N&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function Id({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:l,onExportGanttCSV:d}){let[i,u]=useState(false),m=useRef(null);useEffect(()=>{let g=f=>{m.current&&!m.current.contains(f.target)&&u(false);};return i&&document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g);}},[i]);let p=g=>{g(),u(false);};return jsxs("div",{className:c("relative",r),ref:m,children:[jsxs("button",{onClick:()=>u(!i),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",g.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",g.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":i,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),i&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>p(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>p(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>p(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>p(async()=>await 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:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>p(()=>d?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>p(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>p(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:g=>{g.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:g=>{g.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var Bd={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:"#00E5CC",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"}},Rd={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:"#00E5CC",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"}},Od={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"}},xn={dark:Bd,light:Rd,neutral:Od},$i="dark";var Hi=createContext(void 0),Dx="asakaa-theme";function im({children:e,defaultTheme:t=$i,storageKey:a=Dx}){let[r,n]=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=>{n(l),typeof window<"u"&&localStorage.setItem(a,l);},[a]);useEffect(()=>{if(typeof window>"u")return;let l=document.documentElement,d=xn[r];Object.entries(d.colors).forEach(([u,m])=>{m&&l.style.setProperty(`--theme-${Sx(u)}`,m);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,m])=>{let p=d.colors[u];p&&l.style.setProperty(m,p);}),l.setAttribute("data-theme",r),l.classList.remove("theme-dark","theme-light","theme-neutral"),l.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:xn};return jsx(Hi.Provider,{value:o,children:e})}function qn(){let e=useContext(Hi);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function Sx(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function $d({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=qn();return e?jsxs("div",{className:c("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(xn).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:c("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/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:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.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 lm(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return xt[e]||xt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",xt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",xt[e].bgSecondary),bgGrid:r("--theme-bg-card",xt[e].bgGrid),bgWeekend:r("--theme-bg-hover",xt[e].bgWeekend),border:r("--theme-border-primary",xt[e].border),borderLight:r("--theme-border-subtle",xt[e].borderLight),textPrimary:r("--theme-text-primary",xt[e].textPrimary),textSecondary:r("--theme-text-secondary",xt[e].textSecondary),textTertiary:r("--theme-text-tertiary",xt[e].textTertiary),accent:r("--theme-accent-primary",xt[e].accent),accentHover:r("--theme-accent-hover",xt[e].accentHover),accentLight:r("--theme-accent-primary",xt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",xt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",xt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",xt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",xt[e].dependency),dependencyHover:r("--theme-border-secondary",xt[e].dependencyHover),criticalPath:r("--theme-error",xt[e].criticalPath),criticalPathLight:r("--theme-error",xt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",xt[e].today):e==="neutral"?r("--theme-text-primary",xt[e].today):r("--theme-error",xt[e].today),todayLight:e==="light"?r("--theme-accent-primary",xt[e].todayLight):e==="neutral"?r("--theme-text-primary",xt[e].todayLight):r("--theme-error",xt[e].todayLight),milestone:r("--theme-warning",xt[e].milestone),milestoneLight:r("--theme-warning",xt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",xt[e].statusTodo),statusInProgress:r("--theme-accent-primary",xt[e].statusInProgress),statusCompleted:r("--theme-success",xt[e].statusCompleted),hoverBg:r("--theme-bg-hover",xt[e].hoverBg),focusRing:r("--theme-accent-primary",xt[e].focusRing),...xt[e].dotGrid&&{dotGrid:xt[e].dotGrid},...xt[e].glassHeader&&{glassHeader:xt[e].glassHeader},...xt[e].glassToolbar&&{glassToolbar:xt[e].glassToolbar},...xt[e].forecastHud&&{forecastHud:xt[e].forecastHud},...xt[e].neonRedGlow&&{neonRedGlow:xt[e].neonRedGlow},...xt[e].executionBarBg&&{executionBarBg:xt[e].executionBarBg}}}var zi={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},dm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},Hd={en:zi,es:dm};function cm(e){return Hd[e]||Hd.en}function zd(e,t){let a=cm(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 Xn=createContext(zi);function Yr(){return useContext(Xn)}function Rs(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),l=o.bottom+4,d;a==="right"?d=o.right-r:d=o.left;let i=8;d+r>window.innerWidth-i&&(d=window.innerWidth-i-r),d<i&&(d=i),s({top:l,left:d});},[t,a,e,r]),n}function xm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[l,d]=useState(false),[i,u]=useState(null),m=useRef(null),p=useRef(null),g=Yr(),f=Rs(m,l,"right",176);if(useEffect(()=>{if(!l)return;let h=v=>{let w=v.target;m.current&&!m.current.contains(w)&&p.current&&!p.current.contains(w)&&d(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]),!(t||a||r||n||s||o))return null;let y=[{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:n},{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:o}].filter(h=>h.handler),b=async(h,v)=>{if(v){u(h);try{await v();}catch(w){console.error(`Export ${h} failed:`,w);}finally{u(null),d(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:m,onClick:()=>d(!l),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] 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:g.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:l?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:l&&jsx(motion.div,{ref:p,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:y.map((h,v)=>jsxs(motion.button,{onClick:()=>b(h.id,h.handler),disabled:i!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:v<y.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:v*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function pm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,l]=useState(false),[d,i]=useState(null),[u,m]=useState(false),p=useRef(null),g=useRef(null),f=Yr(),x=Rs(p,o,"right",224),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",b=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let N=S=>{let F=S.target;p.current&&!p.current.contains(F)&&g.current&&!g.current.contains(F)&&l(false);};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(N=>N.handler),v=async(N,S)=>{if(S){i(N);try{await S();}catch(F){console.error(`Export ${N} failed:`,F);}finally{i(null),l(false);}}},w=()=>{s?.(),m(true),setTimeout(()=>m(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:p,onClick:()=>l(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:g,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:x.top,left:x.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((N,S)=>jsxs(motion.button,{onClick:()=>v(N.id,N.handler),disabled:d!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:S*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:d===N.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):N.icon}),jsx("span",{className:"flex-1 text-left",children:N.label})]},N.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Xx({options:e,value:t,onChange:a,theme:r,layoutId:n="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 o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,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:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function Jx({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.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}})]},n.value)})})}function mm({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),l=useRef(null),d=Yr(),i=Rs(o,n,"left");useEffect(()=>{if(!n)return;let p=g=>{let f=g.target;o.current&&!o.current.contains(f)&&l.current&&!l.current.contains(f)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[n]);let u=[{value:"all",label:d.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(p,g)=>({value:g+1,label:`L${g+1}`}))],m=t==="all"?d.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${d.toolbar.wbsLevel||"Level"}: ${m}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:m})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:l,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:i.top,left:i.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((p,g)=>{let f=t===p.value;return jsxs(motion.button,{onClick:()=>{a(p.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:g<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:g*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:p.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(p.value))})})})}),document.body)]})}function gm({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),l=useRef(null),d=useRef(null),i=Yr(),u=Rs(l,s,"left");useEffect(()=>{if(!s)return;let f=setTimeout(()=>{let x=b=>{let h=b.target;l.current&&!l.current.contains(h)&&d.current&&!d.current.contains(h)&&o(false);},y=b=>{b.key==="Escape"&&o(false);};document.addEventListener("mousedown",x),document.addEventListener("keydown",y),d._cleanup=()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",y);};},100);return ()=>{clearTimeout(f),d._cleanup&&d._cleanup();}},[s]);let m=[{value:"all",label:i.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:i.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:i.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:i.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],p=t!=="all"||r,g=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:l,onClick:f=>{f.stopPropagation(),o(x=>!x);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:p?g?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${p?g?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:p?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:i.toolbar.filter||"Filters"}),p&&jsx("span",{className:"w-2 h-2 rounded-full",style:{backgroundColor:"#00E5CC"}})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:g?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${g?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:g?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:g?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:i.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:m.map(f=>{let x=t===f.value&&!r,y=()=>f.value==="all"?x?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):f.icon;return jsxs(motion.button,{onClick:()=>{a(f.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:x?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${x?f.color:"text-gray-400"} flex-shrink-0`,children:y()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:f.label}),x&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},f.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?g?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:g?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#00E5CC":g?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:g?"rgba(255,255,255,0.85)":"#111827"},children:i.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function Qx({value:e,onChange:t,theme:a}){let r=Yr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let l=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:l?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:l?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Zx({theme:e,forecast:t}){let a=Yr(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,l=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,d=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},i=t?.confidencePercent,u=i!=null?i>=75?"#22C55E":i>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,p=t?.currency||"$",g=m!=null?m>=1e6?`${p}${(m/1e6).toFixed(2)}M`:m>=1e3?`${p}${(m/1e3).toFixed(1)}K`:`${p}${m.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,x=f!=null&&f!==0,y=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,b=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",n]}),o&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:d.bg,color:d.text,fontFamily:"'JetBrains Mono', monospace"},children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:u,fontFamily:"'JetBrains Mono', monospace"},children:i!=null?`${i.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:g}),x&&y&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:b.bg,color:b.text,fontFamily:"'JetBrains Mono', monospace"},children:y})]})]})]})}function ev({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:l,onShowDependenciesChange:d,rowDensity:i,onRowDensityChange:u,hasDependencies:m=true}){let[p,g]=useState(false),f=useRef(null),x=useRef(null),y=Yr(),b=Rs(f,p,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!p)return;let S=F=>{let T=F.target;f.current&&!f.current.contains(T)&&x.current&&!x.current.contains(T)&&g(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[p]);let v=y.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:v?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!m,tooltip:m?void 0:v?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:v?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:n},{key:"weekends",label:v?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:v?"Dependencias":"Dependencies",icon:GitBranch,active:l,onChange:d}],N=[{value:"compact",label:y.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:y.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>g(!p),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:p?e.accent:e.textTertiary,backgroundColor:p?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:y.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:p&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:b.top,left:b.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((S,F)=>{let T=S.icon,E=S.disabled,P=S.tooltip;return jsxs(motion.button,{onClick:()=>!E&&S.onChange?.(!S.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:E?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:E?"not-allowed":"pointer"},whileHover:E?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:F*.03},title:P,children:[jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:E?h?"rgba(255,255,255,0.2)":"#D1D5DB":S.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:S.label}),S.active&&!E&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},S.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:y.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),N.map((S,F)=>{let T=i===S.value;return jsxs(motion.button,{onClick:()=>u(S.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+F)*.03},children:[jsx("span",{style:{color:T?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:S.label}),T&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},S.value)})]})]})}),document.body)]})}function Ui({theme:e,timeScale:t,onTimeScaleChange:a,zoom:r,onZoomChange:n,currentTheme:s,onThemeChange:o,rowDensity:l,onRowDensityChange:d,showThemeSelector:i=false,showCreateTaskButton:u=false,createTaskLabel:m,onCreateTask:p,taskFilter:g="all",onTaskFilterChange:f,hideCompleted:x=false,onHideCompletedChange:y,toolbarRightContent:b,wbsLevel:h,onWbsLevelChange:v,maxWbsDepth:w=4,viewMode:N="execution",onViewModeChange:S,projectForecast:F,onExportPNG:T,onExportPDF:E,onExportExcel:P,onExportCSV:k,onExportJSON:j,onExportMSProject:U,showCriticalPath:ae=true,onShowCriticalPathChange:L,showDependencies:X=true,onShowDependenciesChange:Y,highlightWeekends:V=true,onHighlightWeekendsChange:R,showBaseline:J=false,onShowBaselineChange:Ne,onCopySnapshotLink:$e,hasDependencies:z=true}){let te=Yr(),xe=T||E||P||k||j||U,Re=!!e.glassToolbar,[De,Ee]=useState(false),Ve=useRef(null);useEffect(()=>{De&&Ve.current&&Ve.current.focus();},[De]);let ot=[{value:"day",label:te.toolbar.day},{value:"week",label:te.toolbar.week},{value:"month",label:te.toolbar.month}],he=[{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"})}],Ge=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";if(Re){let je=Ge?"rgba(255,255,255,0.08)":e.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:e.glassToolbar,borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsxs(motion.div,{className:"flex items-center rounded-full overflow-hidden",style:{backgroundColor:Ge?"#1A1A1A":e.bgSecondary,border:`1px solid ${Ge?"rgba(255,255,255,0.08)":e.border}`},animate:{width:De?220:36},transition:{type:"spring",stiffness:400,damping:30},children:[jsx(motion.button,{onClick:()=>Ee(!De),className:"flex items-center justify-center w-9 h-9 flex-shrink-0",style:{color:e.textTertiary},whileHover:{color:e.textPrimary},children:jsx(Search,{className:"w-4 h-4"})}),De&&jsx("input",{ref:Ve,type:"text",placeholder:"Search tasks...",className:"bg-transparent border-none outline-none text-[11px] pr-3 w-full",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},onBlur:()=>Ee(false),onKeyDown:He=>{He.key==="Escape"&&Ee(false);}})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),S&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:Ge?"#000000":e.bgSecondary,border:`1px solid ${Ge?"rgba(255,255,255,0.08)":e.border}`},children:[jsx(motion.button,{onClick:()=>S("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="execution"?Ge?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:N==="execution"?e.textPrimary:e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="execution"?{color:e.textSecondary}:{},children:te.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>S("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:N==="oracle"?Ge?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:N==="oracle"?"#00E5CC":e.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:N!=="oracle"?{color:e.textSecondary}:{},children:te.toolbar.viewOracle})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Qx,{value:t,onChange:a,theme:e}),jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),v&&jsx(mm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsx(gm,{theme:e,value:g,onChange:f,hideCompleted:x,onHideCompletedChange:y}),b&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),b]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:je}}),jsx(ev,{theme:e,showCriticalPath:ae,onShowCriticalPathChange:L,showBaseline:J,onShowBaselineChange:Ne,highlightWeekends:V,onHighlightWeekendsChange:R,showDependencies:X,onShowDependenciesChange:Y,rowDensity:l,onRowDensityChange:d,hasDependencies:z}),jsx(pm,{theme:e,onExportPNG:T,onExportPDF:E,onExportExcel:P,onExportMSProject:U,onCopySnapshotLink:$e}),u&&p&&jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${e.accent} 0%, ${e.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${Ge?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${Ge?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||te.toolbar.createTask})]})]})]}),F&&jsx(Zx,{theme:e,forecast:F})]})}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(Jx,{options:ot,value:t,onChange:je=>a(je),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:()=>n(Math.max(.5,r-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:e.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(r*100),"%"]}),jsx(motion.button,{onClick:()=>n(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}}),v&&jsx(mm,{theme:e,value:h??"all",onChange:v,maxDepth:w}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}}),jsx(gm,{theme:e,value:g,onChange:f,hideCompleted:x,onHideCompletedChange:y})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[b&&jsxs(Fragment,{children:[b,jsx("div",{className:"w-px h-5",style:{backgroundColor:e.borderLight}})]}),u&&p&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:p,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:m||te.toolbar.createTask})]}),(xe||i)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}})]}),jsx(pm,{theme:e,onExportPNG:T,onExportPDF:E,onExportExcel:P,onExportMSProject:U,onCopySnapshotLink:$e}),i&&jsx("div",{className:"w-px h-6",style:{backgroundColor:e.borderLight}}),i&&jsx(Xx,{options:he,value:s,onChange:je=>o(je),theme:e})]})]})}function Wi({columns:e,onToggleColumn:t,theme:a}){let[r,n]=useState(false),[s,o]=useState({x:0,y:0}),l=useRef(null),d=useRef(null);useEffect(()=>{if(!r)return;let u=m=>{l.current&&!l.current.contains(m.target)&&n(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);let i=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>{if(!r&&d.current){let u=d.current.getBoundingClientRect();o({x:u.left,y:u.bottom+4});}n(!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(oa,{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(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function Qn({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[l,d]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,m=r.length*36+8,p=8,g=window.innerWidth,f=window.innerHeight,x=t,y=a;t+u+p>g&&(x=t-u,x<p&&(x=p)),a+m+p>f&&(y=f-m-p,y<p&&(y=p)),d({x,y});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=p=>{o.current&&!o.current.contains(p.target)&&n();},m=p=>{p.key==="Escape"&&n();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",m);}},[e,n]),!e)return null;let i=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,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(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:m=>{u.disabled||(m.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var ya={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 Dm({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:l,onTaskOutdent:d,onTaskRename:i,onTaskToggleExpand:u,onOpenTaskModal:m,enableKeyboard:p=true}){let g=useRef(false),f=useCallback(v=>{g.current=v;},[]),x=useCallback(v=>{let w=[],N=S=>{for(let F of S)w.push(F),F.subtasks&&F.subtasks.length>0&&F.isExpanded&&N(F.subtasks);};return N(v),w},[]),y=useCallback(()=>{let v=x(e);for(let w of v)if(t.has(w.id))return w;return null},[e,t,x]),b=useCallback((v,w)=>{let N=x(e);if(N.length===0)return;let S=y();if(!S){a(N[0].id,false);return}let F=N.findIndex(P=>P.id===S.id);if(F===-1)return;let T=v==="up"?F-1:F+1;if(T<0||T>=N.length)return;let E=N[T];a(E.id,w);},[e,y,x,a]),h=useCallback(v=>{if(!p)return;let w=v.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||g.current){v.key==="Escape"&&(w.blur(),g.current=false);return}let F=navigator.platform.toUpperCase().indexOf("MAC")>=0?v.metaKey:v.ctrlKey,T=Array.from(t),E=y();if(v.key==="ArrowUp"){v.preventDefault(),b("up",v.shiftKey);return}if(v.key==="ArrowDown"){v.preventDefault(),b("down",v.shiftKey);return}if(E&&(v.key==="ArrowRight"||v.key==="ArrowLeft")){E.subtasks&&E.subtasks.length>0&&(v.preventDefault(),(v.key==="ArrowRight"&&!E.isExpanded||v.key==="ArrowLeft"&&E.isExpanded)&&u(E.id));return}if(v.altKey&&(v.key==="ArrowUp"||v.key==="ArrowDown")){T.length>0&&(v.preventDefault(),o(T,v.key==="ArrowUp"?"up":"down"));return}if(v.key==="Tab"&&!v.shiftKey){T.length>0&&(v.preventDefault(),l(T));return}if(v.key==="Tab"&&v.shiftKey){T.length>0&&(v.preventDefault(),d(T));return}if(v.key==="Enter"&&!v.shiftKey&&!F){E&&(v.preventDefault(),r(E.id,"below"));return}if(v.key==="Enter"&&v.shiftKey&&!F){E&&(v.preventDefault(),r(E.id,"above"));return}if(v.key==="Enter"&&F){E&&(v.preventDefault(),m(E.id));return}if(v.key==="F2"){E&&(v.preventDefault(),i(E.id));return}if(v.key==="Delete"||v.key==="Backspace"&&F){T.length>0&&(v.preventDefault(),n(T));return}if(v.key==="d"&&F&&!v.shiftKey){T.length>0&&(v.preventDefault(),s(T));return}},[p,t,y,b,r,n,s,o,l,d,i,u,m]);return useEffect(()=>{if(p)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[p,h]),{setIsEditing:f}}function Em(){let[e,t]=useState(new Set),[a,r]=useState(null),n=useCallback(m=>{t(new Set([m])),r(m);},[]),s=useCallback(m=>{t(p=>{let g=new Set(p);return g.has(m)?g.delete(m):g.add(m),g}),r(m);},[]),o=useCallback((m,p)=>{if(!a){n(m);return}let g=p.indexOf(a),f=p.indexOf(m);if(g===-1||f===-1){n(m);return}let x=Math.min(g,f),y=Math.max(g,f),b=p.slice(x,y+1);t(new Set(b)),r(m);},[a,n]),l=useCallback((m,p,g,f)=>{f?o(m,p):g?s(m):n(m);},[n,s,o]),d=useCallback((m,p)=>{p?t(g=>{let f=new Set(g);return f.add(m),f}):n(m);},[n]),i=useCallback(()=>{t(new Set),r(null);},[]),u=useCallback(m=>e.has(m),[e]);return {selectedTaskIds:e,selectTask:n,toggleTaskSelection:s,selectTaskRange:o,handleTaskClick:l,handleKeyboardSelection:d,clearSelection:i,isTaskSelected:u}}function jd(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?jd(t.subtasks):t.subtasks}))}function kn(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((l,d)=>(l.position??0)-(d.position??0));for(let l=0;l<o.length;l++){let d={...o[l],parentId:n,level:s,position:o[l].position??l};t.push(d),d.subtasks&&d.subtasks.length>0&&d.isExpanded&&a(d.subtasks,d.id,s+1);}};return a(e),t}function Zn(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Zn(a.subtasks,t);if(r)return r}}return null}function Gd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=Gd(a.subtasks,t);if(r)return r}return null}function _d(e,t){if(t.length===0)return e;let a=kn(e),r=t[0],n=a.findIndex(p=>p.id===r);if(n<=0)return e;let s=a[n-1],o=(p,g)=>{let f=[];return {tasks:p.filter(y=>{if(g.has(y.id))return f.push(y),false;if(y.subtasks){let b=o(y.subtasks,g);y.subtasks=b.tasks,f.push(...b.removed);}return true}),removed:f}},l=(p,g,f)=>p.map(x=>x.id===g?{...x,subtasks:[...x.subtasks||[],...f],isExpanded:true}:x.subtasks?{...x,subtasks:l(x.subtasks,g,f)}:x),d=new Set(t),{tasks:i,removed:u}=o(e,d),m=l(i,s.id,u);return jd(m)}function Kd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=Gd(a,r);if(!n)continue;let s=Gd(a,n.id),o=(i,u,m)=>{for(let p=0;p<i.length;p++){let g=i[p];if(g.id===u&&g.subtasks){let f=g.subtasks.findIndex(x=>x.id===m);if(f!==-1){let[x]=g.subtasks.splice(f,1);return x}}if(g.subtasks){let f=o(g.subtasks,u,m);if(f)return f}}return null},l=(i,u,m)=>{let p=i.findIndex(g=>g.id===u);if(p!==-1)return i.splice(p+1,0,m),i;for(let g of i)g.subtasks&&l(g.subtasks,u,m);return i},d=o(a,n.id,r);d&&(s&&s.subtasks?l(s.subtasks,n.id,d):l(a,n.id,d));}return jd(a)}function qd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,l,d)=>{let i=o.findIndex(m=>m.id===l);if(i===-1){for(let m of o)if(m.subtasks&&s(m.subtasks,l,d))return true;return false}let u=d==="up"?i-1:i+1;return u<0||u>=o.length?false:([o[i],o[u]]=[o[u],o[i]],o[i]={...o[i],position:i},o[u]={...o[u],position:u},true)};return s(r,n,a),r}function Yd(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function $s(e,t){let a=[...e],r=[];for(let n of t){let s=(d,i)=>d.map((u,m)=>({...u,id:`${u.id}-copy-${Date.now()}-${m}`,parentId:i,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${m}`):void 0})),o=d=>{let i=d.findIndex(g=>g.id===n);if(i===-1){for(let g of d)if(g.subtasks){let f=o(g.subtasks);if(f)return f}return null}let u=d[i],m=`${u.id}-copy-${Date.now()}`,p={...u,id:m,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,m):void 0};return d.splice(i+1,0,p),p},l=o(a);l&&r.push(l);}return {tasks:a,duplicatedTasks:r}}function Mm(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},l=d=>{let i=d.findIndex(m=>m.id===t);if(i===-1){for(let m of d)if(m.subtasks&&l(m.subtasks))return true;return false}let u=a==="above"?i:i+1;return d.splice(u,0,o),true};return l(r),{tasks:r,newTask:o}}function Xd(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Xd(r.subtasks,t,a)}:r)}function Jd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Jd(a.subtasks,t)}:a)}function Qd(e,t){let a=p=>{for(let g of p){if(g.id===t)return g;if(g.subtasks){let f=a(g.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,l=r?.endDate||s,d=p=>{for(let g of p){if(g.id===t)return (g.subtasks||[]).length;if(g.subtasks){let f=d(g.subtasks);if(f>=0)return f}}return 0},i=d(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(l),color:r?.color||"#00E5CC",position:i,parentId:t},m=p=>p.map(g=>{if(g.id===t){let f=g.subtasks||[];return {...g,subtasks:[...f,u],isExpanded:true}}return g.subtasks?{...g,subtasks:m(g.subtasks)}:g});return {tasks:m(e),newTask:u}}function Pm(e,t,a,r){if(t===a)return e;let n=Zn(e,t);if(!n)return e;if(a){let l=(d,i)=>{if(!d.subtasks)return false;for(let u of d.subtasks)if(u.id===i||l(u,i))return true;return false};if(l(n,a))return e}let s=l=>{let d=l.filter(u=>u.id!==t),i=d.length<l.length;return d.map((u,m)=>{let p=i?{...u,position:m}:u;return p.subtasks&&p.subtasks.length>0?{...p,subtasks:s(p.subtasks)}:p})},o=s(e);if(a===null){let l=r!==void 0?r:o.length;o.splice(l,0,{...n,parentId:void 0}),o=o.map((d,i)=>({...d,position:i}));}else {let l=d=>d.map(i=>{if(i.id===a){let u=i.subtasks||[],m=r!==void 0?r:u.length,p=[...u];p.splice(m,0,{...n,parentId:a});let g=p.map((f,x)=>({...f,position:x}));return {...i,subtasks:g,isExpanded:true}}return i.subtasks&&i.subtasks.length>0?{...i,subtasks:l(i.subtasks)}:i});o=l(o);}return o}function Xr(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Xr(t.subtasks),r=a.reduce((l,d)=>(d.startDate&&l.starts.push(new Date(d.startDate).getTime()),d.endDate&&l.ends.push(new Date(d.endDate).getTime()),l.progresses.push(d.progress??0),l),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((l,d)=>l+d,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function Gi({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskDblClick:o,onTaskContextMenu:l,onTaskToggle:d,scrollTop:i,columns:u,onToggleColumn:m,onColumnResize:p,onTaskUpdate:g,onBulkFill:f,onTaskIndent:x,onTaskOutdent:y,onTaskMove:b,onMultiTaskDelete:h,onTaskDuplicate:v,onTaskCreate:w,onTaskRename:N,onCreateSubtask:S,onOpenTaskModal:F,onDeleteRequest:T,onTaskReparent:E,scrollContainerRef:P,showCriticalPath:k=false}){let j=useContext(Xn),[U,ae]=useState(null),[L,X]=useState(null),[Y,V]=useState(""),R=useRef(null),[J,Ne]=useState(null),[$e,z]=useState(0),[te,xe]=useState(0),[Re,De]=useState({isOpen:false,x:0,y:0,type:"header"}),[Ee,Ve]=useState(null),[ot,he]=useState(null),[Ge,je]=useState(null),He=useRef(0),Ct=5,Dt=useRef(false),[Je,ze]=useState(null),[lt,Lt]=useState(false),ke=useRef(null),[gt,A]=useState(null),[se,B]=useState(null),[Z,O]=useState(false),ee=useRef(null);useEffect(()=>{function re(ve){ee.current&&!ee.current.contains(ve.target)&&O(false);}if(Z)return document.addEventListener("mousedown",re),()=>document.removeEventListener("mousedown",re)},[Z]),useEffect(()=>{L&&R.current&&(R.current.focus(),R.current.select());},[L]),useEffect(()=>{if(!J)return;let re=Nt=>{let ft=Nt.clientX-$e,ut=te+ft;p?.(J,ut);},ve=()=>{Ne(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",re),document.addEventListener("mouseup",ve),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",re),document.removeEventListener("mouseup",ve),document.body.style.cursor="",document.body.style.userSelect="";}},[J,$e,te,p]);let{selectedTaskIds:Ue,handleTaskClick:Ce,isTaskSelected:Ie}=Em(),{setIsEditing:Me}=Dm({tasks:e,selectedTaskIds:Ue,onTaskSelect:(re,ve)=>{let ft=kn(e).map(ut=>ut.id);Ce(re,ft,ve||false,false);},onTaskCreate:w||(()=>{}),onTaskDelete:h||(()=>{}),onTaskDuplicate:v||(()=>{}),onTaskMove:b||(()=>{}),onTaskIndent:x||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:re=>{let ve=kn(e).find(Nt=>Nt.id===re);ve&&mt(ve);},onTaskToggleExpand:d||(()=>{}),onOpenTaskModal:re=>{let ve=kn(e).find(Nt=>Nt.id===re);ve&&F&&F(ve);},enableKeyboard:true}),Pe=(re,ve=0,Nt="")=>{let ft=[],ut=[...re].sort((it,q)=>(it.position??0)-(q.position??0));for(let it=0;it<ut.length;it++){let q=ut[it],le=it+1,ge=Nt?`${Nt}.${le}`:`${le}.0`,H=q.wbsCode||ge;if(q.wbsCode=H,ft.push({task:q,level:ve}),q.subtasks&&q.subtasks.length>0&&q.isExpanded){let _e=q.wbsCode?.replace(/\.0$/,"")||(Nt?`${Nt}.${le}`:`${le}`);ft.push(...Pe(q.subtasks,ve+1,_e));}}return ft},nt=Pe(e),at=48,dt=Math.max(nt.length*a,600-at),pt=(re,ve)=>ve==="assignees"?re.assignees:ve==="startDate"?re.startDate:re.endDate,jt=(re,ve,Nt,ft)=>{re.preventDefault(),re.stopPropagation(),A({sourceTaskId:ve,column:Nt,sourceIndex:ft,targetIndex:ft}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ut=re.currentTarget.closest("[data-grid-body]"),it=$=>{let pe=ut?.getBoundingClientRect().top??0,K=Math.floor(($-pe)/a);return K=Math.max(0,Math.min(nt.length-1,K)),K<ft&&(K=ft),K},q=re.clientY,le=P?.current??null,ge=()=>{ke.current&&(cancelAnimationFrame(ke.current),ke.current=null);},H=()=>{let $=it(q);A(pe=>pe&&{...pe,targetIndex:$});},fe=()=>{if(ge(),!le)return;let $=le.getBoundingClientRect(),pe=60,K=12,Ze=q-$.top,wt=$.bottom-q;if(wt<pe&&le.scrollTop<le.scrollHeight-le.clientHeight){let kt=Math.max(1,Math.round(K*(1-Math.max(0,wt)/pe))),Zt=()=>{le.scrollTop+=kt,H(),le.scrollTop<le.scrollHeight-le.clientHeight&&(ke.current=requestAnimationFrame(Zt));};ke.current=requestAnimationFrame(Zt);}else if(Ze<pe&&le.scrollTop>0){let kt=Math.max(1,Math.round(K*(1-Math.max(0,Ze)/pe))),Zt=()=>{le.scrollTop-=kt,H(),le.scrollTop>0&&(ke.current=requestAnimationFrame(Zt));};ke.current=requestAnimationFrame(Zt);}},_e=$=>{q=$.clientY,H(),fe();},C=$=>{window.removeEventListener("mousemove",_e),window.removeEventListener("mouseup",C),ge(),document.body.style.cursor="",document.body.style.userSelect="",A(null);let pe=it($.clientY),K=nt.find(ea=>ea.task.id===ve)?.task;if(!K)return;let Ze=pt(K,Nt),wt=Math.min(ft,pe),kt=Math.max(ft,pe),Zt=[];for(let ea=wt;ea<=kt;ea++){if(ea===ft)continue;let qt=nt[ea]?.task;!qt||qt.subtasks&&qt.subtasks.length>0||Zt.push(qt.id);}Zt.length!==0&&f?.(Zt,Nt,Ze);};window.addEventListener("mousemove",_e),window.addEventListener("mouseup",C);},Mt=re=>{if(!gt)return false;let ve=Math.min(gt.sourceIndex,gt.targetIndex),Nt=Math.max(gt.sourceIndex,gt.targetIndex);return re>=ve&&re<=Nt},zt=re=>!re.startDate||!re.endDate?"-":`${Math.ceil((re.endDate.getTime()-re.startDate.getTime())/(1e3*60*60*24))}d`,mt=re=>{X(re.id),V(re.name),Me(true);},Pt=re=>{Y.trim()&&Y!==e.find(ve=>ve.id===re)?.name&&N?.(re,Y.trim()),X(null),V(""),Me(false);},Ut=()=>{X(null),V(""),Me(false);},_t=(re,ve)=>{ve.stopPropagation(),S?.(re.id);},Wt=(re,ve)=>{ve.preventDefault(),He.current=ve.clientY,Ve(re),Dt.current=false,Lt(false),ze({x:ve.clientX,y:ve.clientY});},rt=re=>{if(!Ee||(Math.abs(re.clientY-He.current)>Ct&&!Dt.current&&(Dt.current=true,Lt(true)),ze({x:re.clientX,y:re.clientY}),!Dt.current))return;if(P?.current){let it=P.current,q=it.getBoundingClientRect(),le=60,ge=12;ke.current&&(cancelAnimationFrame(ke.current),ke.current=null);let H=re.clientY-q.top,fe=q.bottom-re.clientY;if(H<le&&it.scrollTop>0){let _e=Math.round(ge*(1-H/le)),C=()=>{it.scrollTop-=_e,Dt.current&&it.scrollTop>0&&(ke.current=requestAnimationFrame(C));};ke.current=requestAnimationFrame(C);}else if(fe<le&&it.scrollTop<it.scrollHeight-it.clientHeight){let _e=Math.round(ge*(1-fe/le)),C=()=>{it.scrollTop+=_e,Dt.current&&it.scrollTop<it.scrollHeight-it.clientHeight&&(ke.current=requestAnimationFrame(C));};ke.current=requestAnimationFrame(C);}}let Nt=document.querySelectorAll("[data-task-row]"),ft=null,ut=null;Nt.forEach(it=>{let q=it.getBoundingClientRect(),le=it.getAttribute("data-task-row");if(le&&le!==Ee&&re.clientY>=q.top&&re.clientY<=q.bottom){ft=le;let ge=re.clientY-q.top,H=q.height;ge<H*.25?ut="above":ge>H*.75?ut="below":ut="child";}}),he(ft),je(ut);},ca=()=>{if(Dt.current&&Ee&&ot&&Ge){if(Ge==="child")E?.(Ee,ot);else if(Ge==="above"||Ge==="below"){let re=(ut,it,q=null)=>{for(let le of ut){if(le.id===it)return q;if(le.subtasks){let ge=re(le.subtasks,it,le.id);if(ge!==void 0)return ge}}},ve=re(e,Ee,null),Nt=re(e,ot,null),ft=(ut,it,q,le)=>{let ge=ut.findIndex(_e=>_e.id===it),H=le?ut.findIndex(_e=>_e.id===q):-1,fe=Ge==="below"?ge+1:ge;return le&&H!==-1&&H<ge&&(fe-=1),Math.max(0,fe)};if(Nt===null){let it=ft(e,ot,Ee,ve===null);E?.(Ee,null,it);}else {let ut=Zn(e,Nt);if(ut?.subtasks){let it=ve===Nt,q=ft(ut.subtasks,ot,Ee,it);E?.(Ee,Nt,q);}}}}ke.current&&(cancelAnimationFrame(ke.current),ke.current=null),Ve(null),he(null),je(null),ze(null),Dt.current=false,Lt(false);};useEffect(()=>{if(Ee)return document.addEventListener("mousemove",rt),document.addEventListener("mouseup",ca),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",ca),document.body.style.cursor="",document.body.style.userSelect="";}},[Ee,ot,Ge]);let xa=(re,ve,Nt)=>{let ft=ve.subtasks&&ve.subtasks.length>0;switch(re.id){case "name":let ut=L===ve.id,it=U===ve.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${Nt*20}px`},children:[E&&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:it?1:.3},onMouseDown:K=>Wt(ve.id,K),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),ve.subtasks&&ve.subtasks.length>0?jsx("button",{onClick:K=>{K.stopPropagation(),d?.(ve.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:ve.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"}),ut?jsx("input",{ref:R,type:"text",value:Y,onChange:K=>V(K.target.value),onKeyDown:K=>{K.key==="Enter"?Pt(ve.id):K.key==="Escape"&&Ut();},onBlur:()=>Pt(ve.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:K=>K.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:ve.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:ve.parentId?"13px":"14px",fontWeight:ve.isMilestone?600:ve.parentId?400:600,letterSpacing:ve.parentId?"0":"-0.01em"},title:ve.name,children:[ve.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:ve.wbsCode}),ve.isHighlighted&&ve.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ve.name}),ve.subtasks&&ve.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(ve.progress||0),"%"]}),k&&ve.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),k&&ve.cpmData&&jsxs("span",{style:{color:ve.cpmData.totalFloat<=0?"#EF4444":ve.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(ve.cpmData.totalFloat),"d"]})]}),it&&!ut&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:K=>K.stopPropagation(),children:[jsx("button",{onClick:K=>_t(ve,K),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:K=>{K.stopPropagation(),mt(ve);},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 le=re.id==="startDate"?"startDate":"endDate",ge=ve[le],H=se?.taskId===ve.id&&se?.field===le,fe=K=>K?(typeof K=="string"?new Date(K):K).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:K=>K.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:ft?.5:1,cursor:ft?"default":"pointer"},title:ft?"Auto-calculated from subtasks":void 0,onClick:K=>{if(!ft)if(H)B(null);else {let Ze=K.currentTarget.getBoundingClientRect();B({taskId:ve.id,field:le,month:ge?typeof ge=="string"?new Date(ge):ge:new Date,position:{top:Ze.bottom+4,left:Ze.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:fe(ge)}),ft&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),H&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>B(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:se?.position.top,left:se?.position.left},onClick:K=>K.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let K=new Date,Ze=new Date(K);Ze.setDate(K.getDate()+1);let wt=new Date(K);wt.setDate(K.getDate()+7);let kt=new Date(K);return kt.setDate(K.getDate()+14),[{label:"Hoy",date:K},{label:"Ma\xF1ana",date:Ze},{label:"Pr\xF3xima semana",date:wt},{label:"2 semanas",date:kt}].map((ea,qt)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:cr=>cr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:cr=>cr.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ve.id,{[le]:ea.date}),B(null);},children:ea.label},qt))})(),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:K=>K.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:K=>K.currentTarget.style.backgroundColor="transparent",onClick:()=>{g?.(ve.id,{[le]:void 0}),B(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:()=>B(K=>K?{...K,month:new Date(K.month.getFullYear(),K.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:se?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>B(K=>K?{...K,month:new Date(K.month.getFullYear(),K.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((K,Ze)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:K},Ze))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let K=se?.month||new Date,Ze=K.getFullYear(),wt=K.getMonth(),kt=new Date(Ze,wt,1).getDay(),Zt=new Date(Ze,wt+1,0).getDate(),ea=new Date,qt=[];for(let Ca=kt-1;Ca>=0;Ca--)qt.push({day:new Date(Ze,wt,-Ca).getDate(),date:new Date(Ze,wt-1,new Date(Ze,wt,-Ca).getDate()),isCurrentMonth:false});for(let Ca=1;Ca<=Zt;Ca++)qt.push({day:Ca,date:new Date(Ze,wt,Ca),isCurrentMonth:true});let cr=42-qt.length;for(let Ca=1;Ca<=cr;Ca++)qt.push({day:Ca,date:new Date(Ze,wt+1,Ca),isCurrentMonth:false});return qt.map((Ca,Fr)=>{let An=Ca.date.toDateString()===ea.toDateString(),Ro=(ge?typeof ge=="string"?new Date(ge):ge:null)?.toDateString()===Ca.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:Ca.isCurrentMonth?Ro?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Ro?"#00E5CC":"transparent",boxShadow:An&&!Ro?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{g?.(ve.id,{[le]:Ca.date}),B(null);},children:Ca.day},Fr)})})()})]})]})]}),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:zt(ve)})});case "assignees":if(ft)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let _e=r.filter(K=>ve.assignees?.some(Ze=>Ze.id?Ze.id===K.id:Ze.name===K.name||Ze.initials===K.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsx(mn,{assignedUsers:_e,availableUsers:r,onChange:K=>{let Ze=K.map(wt=>({id:wt.id,name:wt.name,initials:wt.initials,color:wt.color}));g?.(ve.id,{assignees:Ze});}})});case "status":if(ft){let K=ve.progress===100?"\u2713":ve.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:K})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsx(Qu,{status:ve.status||"todo",onChange:K=>{g?.(ve.id,{status:K,progress:K==="completed"?100:ve.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:ft?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ve.progress}%`,backgroundColor:ve.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:[ve.progress,"%"]})]});case "priority":let C={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},$={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},pe=C[ve.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:K=>K.stopPropagation(),children:jsx(un,{priority:pe,onChange:K=>{K&&g?.(ve.id,{priority:$[K]||"medium"});}})});default:return null}},W=re=>[{id:"hide",label:"Hide Column",icon:ya.Hide,onClick:()=>m(re),disabled:re==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ya.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ya.SortDesc,onClick:()=>{}}],ie=re=>{let ve=re.subtasks&&re.subtasks.length>0,Nt=kn(e),ft=Ue.size>1&&Ue.has(re.id),ut=ft?Nt.filter(H=>Ue.has(H.id)):[re],it=ut.map(H=>H.id),q=ut.filter(H=>!(H.subtasks&&H.subtasks.length>0)),le=ft?` (${it.length})`:"",ge=()=>{T?T(it,re.name):h?.(it);};return ve?[{id:"addSubtask",label:j?.contextMenu?.addSubtask||"Add Subtask",icon:ya.Add,onClick:()=>{S?.(re.id);}},{id:"duplicate",label:(j?.contextMenu?.duplicateTask||"Duplicate Task")+le,icon:ya.Duplicate,onClick:()=>{v?.(it);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(j?.contextMenu?.deleteTask||"Delete Task")+le,icon:ya.Delete,onClick:ge}]:[{id:"edit",label:j?.contextMenu?.editTask||"Edit Task",icon:ya.Pencil,onClick:()=>{o?.(re);}},{id:"addSubtask",label:j?.contextMenu?.addSubtask||"Add Subtask",icon:ya.Add,onClick:()=>{S?.(re.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(j?.contextMenu?.markIncomplete||"Mark Incomplete")+le,icon:ya.MarkIncomplete,onClick:()=>{q.forEach(H=>g?.(H.id,{status:"todo",progress:0}));},disabled:q.length===0||q.every(H=>H.status==="todo")},{id:"setInProgress",label:(j?.contextMenu?.setInProgress||"Set In Progress")+le,icon:ya.SetInProgress,onClick:()=>{q.forEach(H=>g?.(H.id,{status:"in-progress"}));},disabled:q.length===0||q.every(H=>H.status==="in-progress")},{id:"markComplete",label:(j?.contextMenu?.markComplete||"Mark Complete")+le,icon:ya.MarkComplete,onClick:()=>{q.forEach(H=>g?.(H.id,{status:"completed",progress:100}));},disabled:q.length===0||q.every(H=>H.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(j?.contextMenu?.duplicateTask||"Duplicate Task")+le,icon:ya.Duplicate,onClick:()=>{v?.(it);}},{id:"split",label:j?.contextMenu?.splitTask||"Split Task",icon:ya.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(j?.contextMenu?.deleteTask||"Delete Task")+le,icon:ya.Delete,onClick:ge}]},st=u.filter(re=>re.visible),Kt=st.reduce((re,ve)=>re+ve.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Kt},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${at}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:st.map((re,ve)=>{let Nt=ve===st.length-1,ft=re.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${ft?"":"justify-center"}`,style:{width:`${re.width}px`,minWidth:`${re.minWidth??(ft?200:60)}px`,maxWidth:`${re.maxWidth??2e3}px`,flexShrink:ft&&st.length===1?1:0,flexGrow:ft&&st.length===1?1:0,borderRight:Nt?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ut=>{ut.preventDefault(),De({isOpen:true,x:ut.clientX,y:ut.clientY,type:"header",columnId:re.id});},onMouseEnter:ut=>{ut.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ut=>{ut.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:re.label,children:re.label}),re.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:J===re.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ut=>{ut.preventDefault(),ut.stopPropagation(),Ne(re.id),z(ut.clientX),xe(re.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:J===re.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},re.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(Wi,{columns:u,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>O(!Z),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"})}),Z&&jsxs("div",{ref:ee,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:re=>re.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:()=>O(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","data-grid-body":true,style:{minHeight:dt},children:nt.map(({task:re,level:ve},Nt)=>{let ft=Ie(re.id),ut=Mt(Nt),it=ot===re.id,q=it&&Ge==="above",le=it&&Ge==="below",ge=it&&Ge==="child",H={};return ge&&(H.backgroundColor=`${t.accent}15`,H.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":re.id,className:`flex items-center cursor-pointer group ${Ee===re.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:ft?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:ft?t.accentLight:ge?`${t.accent}15`:Nt%2===0?t.bgPrimary:t.bgGrid,opacity:k?re.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...H},onMouseEnter:()=>ae(re.id),onMouseLeave:()=>ae(null),onClick:fe=>{let C=kn(e).map(K=>K.id),pe=navigator.platform.toUpperCase().indexOf("MAC")>=0?fe.metaKey:fe.ctrlKey;Ce(re.id,C,pe,fe.shiftKey),!pe&&!fe.shiftKey&&s?.(re);},onDoubleClick:fe=>{fe.stopPropagation(),o?.(re);},onContextMenu:fe=>{fe.preventDefault(),De({isOpen:true,x:fe.clientX,y:fe.clientY,type:"task",task:re}),l?.(re,fe);},whileHover:{backgroundColor:ft?t.accentLight:t.hoverBg},children:[q&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),le&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),st.map((fe,_e)=>{let C=_e===st.length-1,$=fe.id==="name",pe=!!(re.subtasks&&re.subtasks.length>0),K=fe.id==="assignees"||fe.id==="startDate"||fe.id==="endDate"?fe.id:null,wt=!!K&&!pe&&U===re.id&&!gt,kt=ut&&!!gt&>.column===fe.id;return jsxs("div",{className:`px-4 flex items-center ${$?"justify-start":"justify-center"}`,style:{position:"relative",width:`${fe.width}px`,minWidth:`${fe.minWidth??($?200:60)}px`,maxWidth:`${fe.maxWidth??2e3}px`,flexShrink:$&&st.length===1?1:0,flexGrow:$&&st.length===1?1:0,borderRight:C?"none":`1px solid ${U===re.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:kt?`${t.accent}22`:void 0,boxShadow:kt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[xa(fe,re,$?ve:0),wt&&K&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Zt=>jt(Zt,re.id,K,Nt),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${re.id}-${fe.id}`)})]},re.id)})}),jsx(Qn,{isOpen:Re.isOpen,x:Re.x,y:Re.y,items:Re.type==="header"&&Re.columnId?W(Re.columnId):Re.type==="task"&&Re.task?ie(Re.task):[],onClose:()=>De({...Re,isOpen:false}),theme:t}),lt&&Je&&Ee&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Je.x+12,top:Je.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let re=nt.find(ve=>ve.task.id===Ee)?.task;return re?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:re.name})}):null})()}),document.body)]})}function Bm(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,l]=useState(e),[d,i]=useState(t),[u,m]=useState(null),[p,g]=useState(null),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(0),[w,N]=useState(0),[S,F]=useState(null),[T,E]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:l,ghostWidth:d,setGhostWidth:i,connectionLine:u,setConnectionLine:m,hoveredTaskId:p,setHoveredTaskId:g,activeZone:f,setActiveZone:x,draggedSegmentIndex:y,setDraggedSegmentIndex:b,draggedSegmentStartX:h,setDraggedSegmentStartX:v,segmentDragOffsetX:w,setSegmentDragOffsetX:N,hoveredSegmentIndex:S,setHoveredSegmentIndex:F,isHovered:T,setIsHovered:E,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(ae,L)=>{r("none"),m(null),g(null),l(ae),i(L),N(0),b(null),v(0);}}}function ji({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:l,onClick:d,onDoubleClick:i,onContextMenu:u,onDateChange:m,onDependencyCreate:p,allTaskPositions:g=[],onDragMove:f,onHoverChange:x,showBaseline:y,showTaskBarLabels:b=true,showCriticalPath:h=true,readOnly:v=false,onProgressChange:w}){let N=Bm(t,r),S=useRef(null),F=useRef(false),T=useRef(null),E=useRef(null),{dragMode:P,setDragMode:k,dragOffset:j,setDragOffset:U,ghostX:ae,setGhostX:L,ghostWidth:X,setGhostWidth:Y,connectionLine:V,setConnectionLine:R,hoveredTaskId:J,setHoveredTaskId:Ne,activeZone:$e,setActiveZone:z,draggedSegmentIndex:te,setDraggedSegmentIndex:xe,draggedSegmentStartX:Re,setDraggedSegmentStartX:De,segmentDragOffsetX:Ee,setSegmentDragOffsetX:Ve,hoveredSegmentIndex:ot,setHoveredSegmentIndex:he,isHovered:Ge,setIsHovered:je,isDragging:He,isResizing:Ct,isConnecting:Dt,resetDragState:Je}=N,ze=18,lt=!!n.executionBarBg,Lt=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",ke=lt?3:6,gt=e.subtasks&&e.subtasks.length>0,A=useRef(null),[se,B]=(()=>{let q=useRef(null),[,le]=useState(0);return [q.current,ge=>{q.current=ge,le(H=>H+1);}]})(),Z=!!w&&!v&&!gt&&!e.segments&&!!e.startDate&&!!e.endDate,O=e.endDate&&(()=>{let q=new Date;q.setHours(0,0,0,0);let le=new Date(e.endDate);return le.setHours(0,0,0,0),le<q})()&&e.progress<100,ee=h&&e.isCriticalPath,Ue=n.name==="neutral"||n.today==="#1C1917",Ce=e.status==="completed"||e.progress===100,Ie={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Pe=h&&e.isCriticalPath||O?"#EF4444":e.color?e.color:e.priority&&Ie[e.priority]?Ie[e.priority]:n.taskBarPrimary,nt=v?"default":He?Dt?"crosshair":Ct?"ew-resize":"grabbing":"grab",at=v?"default":"ew-resize",pt=(q=>q>=80?20:q>=60?15:q>=50?12:10)(r),jt=r<50,Mt=r<40;useEffect(()=>{x&&(!Ge||He||e.segments)&&x(null);},[Ge,He,e.segments,x]);let zt=q=>q.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),mt=()=>{let q=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${q} day${q!==1?"s":""}`},Pt=q=>Math.round(q/s)*s,Ut=q=>{let le=Math.round(q/s),ge=new Date(o);return ge.setDate(ge.getDate()+le),ge},_t=(q,le)=>{for(let ge of g){if(ge.id===e.id)continue;let H=5;if(q>=ge.x-H&&q<=ge.x+ge.width+H&&le>=ge.y-H&&le<=ge.y+ge.height+H)return ge.id}return null},Wt=useCallback((q,le,ge)=>{if(v)return;q.preventDefault(),q.stopPropagation();let H=S.current?.ownerSVGElement;if(!H)return;let fe=H.createSVGPoint();fe.x=q.clientX,fe.y=q.clientY;let _e=fe.matrixTransform(H.getScreenCTM()?.inverse()),C=ge!==void 0?ge:t,$=le;if(!$){let pe=_e.x-C;q.shiftKey?($="connect",R({x:t+r,y:a+ze/2})):q.ctrlKey||q.metaKey?$="move":q.altKey?$=pe<r/2?"resize-start":"resize-end":Mt?pe<r/2?$="move":$="resize-end":jt?pe<=pt/2?$="resize-start":pe>=r-pt/2?$="resize-end":$="move":pe<=pt?$="resize-start":pe>=r-pt?$="resize-end":$="move";}F.current=false,k($),je(false),z(null),$==="move"?U(_e.x-C):$==="connect"?R({x:t+r,y:a+ze/2}):U(0),L(C),Y(r);},[t,r,a,ze,v]),rt=useCallback(q=>{let le=S.current?.ownerSVGElement;if(!le)return;let ge=le.closest(".gantt-timeline-scroll");if(!ge)return;let H=ge.getBoundingClientRect(),fe=60,_e=15,C=0;if(q.clientX<H.left+fe){let $=H.left+fe-q.clientX;C=-Math.min(_e,$/2);}else if(q.clientX>H.right-fe){let $=q.clientX-(H.right-fe);C=Math.min(_e,$/2);}return C!==0&&(ge.scrollLeft+=C),C!==0},[]),ca=useCallback(q=>{if(P==="none")return;F.current=true,E.current=q;let le=S.current?.ownerSVGElement;if(!le)return;if(P==="move"||P==="resize-start"||P==="resize-end"){let fe=rt(q);fe&&!T.current?T.current=window.setInterval(()=>{E.current&&(rt(E.current),ca(E.current));},16):!fe&&T.current&&(window.clearInterval(T.current),T.current=null);}let ge=le.createSVGPoint();ge.x=q.clientX,ge.y=q.clientY;let H=ge.matrixTransform(le.getScreenCTM()?.inverse());if(P==="connect"){R({x:H.x,y:H.y});let fe=_t(H.x,H.y);Ne(fe);}else if(P==="move"){let fe=H.x-j,_e=Pt(fe);L(_e),Y(r);let C=Math.round((_e-t)/s);if(f?.(e.id,C,true),e.segments&&e.segments.length>0&&te!==null){let $=_e-Re;Ve($);}}else if(P==="resize-start"){let fe=H.x,_e=Pt(fe),C=t+r-_e;C>=s&&(L(_e),Y(C));}else if(P==="resize-end"){let fe=H.x,C=Pt(fe)-t;C>=s&&Y(C);}},[P,t,r,s,j,e,Pt,te,Re,_t,Ne,R,L,Y,Ve,f,rt]),xa=useCallback(()=>{if(T.current&&(window.clearInterval(T.current),T.current=null),E.current=null,P!=="none"){if(P==="connect")J&&p&&p(e,J),R(null),Ne(null);else {let q=e.endDate.getTime()-e.startDate.getTime(),le,ge,H=true;if(P==="move"){if(le=Ut(ae),ge=new Date(le.getTime()+q),e.segments&&e.segments.length>0&&te!==null){let fe=Math.round(Ee/s),_e=e.segments.map((K,Ze)=>{if(Ze===te){let wt=new Date(K.startDate),kt=new Date(K.endDate);return wt.setDate(wt.getDate()+fe),kt.setDate(kt.getDate()+fe),{startDate:wt,endDate:kt}}return K}),C=_e.flatMap(K=>[K.startDate,K.endDate]),$=new Date(Math.min(...C.map(K=>K.getTime()))),pe=new Date(Math.max(...C.map(K=>K.getTime())));m?.({...e,segments:_e},$,pe),Je(t,r);return}}else P==="resize-start"?(le=Ut(ae),ge=e.endDate,le>ge&&(console.warn("Invalid date range: start date must be before or equal to end date"),H=false)):P==="resize-end"?(le=e.startDate,ge=Ut(ae+X),ge.setDate(ge.getDate()-1),ge<le&&(console.warn("Invalid date range: end date must be after or equal to start date"),H=false)):H=false;H&&le&&ge&&(ge.getTime()<le.getTime()?console.warn("Invalid date range: end date cannot be before start date"):m?.(e,le,ge));}f?.(e.id,0,false),Je(t,r);}},[P,ae,X,e,m,J,p,t,r,s,Ut,Ee,te,Je,f]);useEffect(()=>{if(P==="none")return;let q=ge=>{ca(ge);},le=()=>{xa();};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",le),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",le),T.current&&(window.clearInterval(T.current),T.current=null);}},[P,ca,xa]);let W=He&&!Dt?ae:t,ie=He&&!Dt?X:r,st=l.taskClass(e),Kt=24,re=h?e.isCriticalPath?1:.25:1,ve=useCallback(q=>{if(!Z)return;q.stopPropagation(),q.preventDefault();let ge=S.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;A.current={barRect:ge,initialPct:e.progress||0},q.currentTarget.setPointerCapture(q.pointerId),B(e.progress||0);},[Z,e.progress,B]),Nt=useCallback(q=>{let le=A.current;if(!le)return;let H=S.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??le.barRect;if(!H||H.width<=0)return;let fe=(q.clientX-H.left)/H.width,_e=Math.round(Math.max(0,Math.min(1,fe))*100);q.shiftKey&&(_e=Math.round(_e/25)*25),B(_e);},[B]),ft=useCallback(q=>{let le=A.current;if(!le)return;q.stopPropagation(),q.preventDefault();try{q.currentTarget.releasePointerCapture(q.pointerId);}catch{}let ge=se;A.current=null,B(null),ge!=null&&ge!==le.initialPct&&w&&w(e,ge);},[se,w,e,B]),ut=useCallback(q=>{q.stopPropagation(),q.preventDefault();},[]),it=se??(e.progress||0);return jsxs("g",{ref:S,"data-task-bar":"true",style:{opacity:re,transition:"opacity 300ms ease"},onClick:()=>{!He&&!F.current&&d?.(e),F.current=false;},onDoubleClick:q=>{!He&&!F.current&&(q.stopPropagation(),i?.(e));},onContextMenu:q=>{q.preventDefault(),u?.(e,q);},onMouseEnter:()=>!He&&je(true),onMouseMove:q=>{x&&Ge&&!He&&!e.segments&&x({task:e,x:t,y:a,width:r,height:ze,showBelow:false,mouseX:q.clientX,mouseY:q.clientY});},onMouseLeave:()=>{He||(je(false),z(null));},children:[jsx("rect",{x:t,y:a,width:r+Kt,height:ze,fill:"transparent",style:{pointerEvents:"all"}}),Ge&&!He&&!jt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:pt,height:ze,fill:$e==="resize-start"?n.accent:"transparent",opacity:$e==="resize-start"?.15:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>z("resize-start"),onMouseDown:q=>Wt(q,"resize-start")}),jsx("rect",{x:t+pt,y:a,width:r-pt*2,height:ze,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.1:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:q=>Wt(q,"move")}),jsx("rect",{x:t+r-pt,y:a,width:pt,height:ze,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.15:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:q=>Wt(q,"resize-end")})]}),Ge&&!He&&Mt&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ze,fill:$e==="move"?n.accent:"transparent",opacity:$e==="move"?.2:0,style:{cursor:v?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>z("move"),onMouseDown:q=>Wt(q,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ze,fill:$e==="resize-end"?n.accent:"transparent",opacity:$e==="resize-end"?.2:0,style:{cursor:at,pointerEvents:"all"},onMouseEnter:()=>z("resize-end"),onMouseDown:q=>Wt(q,"resize-end")}),Ge&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ze-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),He&&!Dt&&!e.segments&&jsx(motion.rect,{x:ae,y:a,width:X,height:ze,rx:ke,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),y&&e.baselineStartDate&&e.baselineEndDate&&!He&&(()=>{let q=e.baselineStartDate.getTime(),le=e.baselineEndDate.getTime(),ge=o.getTime(),H=864e5,fe=(q-ge)/H,_e=(le-q)/H,C=fe*s,$=Math.max(_e*s,s),pe=W+ie,K=C+$,Ze=e.endDate?.getTime()??0,wt=Math.ceil((Ze-le)/H),kt=wt>0,Zt=wt<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:C,y:a,width:$,height:ze,rx:ke,fill:"none",stroke:Lt?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),kt&&pe>K&&jsx("rect",{x:K,y:a,width:pe-K,height:ze,rx:0,fill:"#EF4444",opacity:.2}),kt&&jsxs("text",{x:Math.max(pe,K)+6,y:a+ze/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",wt,"d"]}),Zt&&jsxs("text",{x:pe+6,y:a+ze/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[wt,"d"]})]})})(),!e.segments&<&>&&(()=>{let le=a+(ze-8)/2,ge=4,H=e.progress||0,fe=new Date;fe.setHours(0,0,0,0);let _e=e.startDate&&fe>=e.startDate,C=e.endDate&&(()=>{let kt=new Date(e.endDate);return kt.setHours(0,0,0,0),fe>kt})(),$=e.startDate&&fe<e.startDate,pe=1;if(_e&&e.startDate&&e.endDate&&!$){let kt=new Date(e.startDate);kt.setHours(0,0,0,0);let Zt=new Date(e.endDate);Zt.setHours(0,0,0,0);let ea=Math.max(1,(Zt.getTime()-kt.getTime())/(1e3*60*60*24)),cr=Math.min((fe.getTime()-kt.getTime())/(1e3*60*60*24),ea)/ea*100;pe=cr>0?H/cr:1;}let K;H>=100?K="#00E5CC":$?K="#4B5563":C&&H<100?K="#EF4444":pe>=.95?K="#22C55E":pe>=.8?K="#F59E0B":K="#EF4444";let Ze=Math.max(H/100*ie,H>0?ge*2:0),wt=ie>100&&H>0;return jsxs("g",{"data-task-class":st,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{x:W,y:le,width:ie,height:8,rx:ge,fill:"rgba(255,255,255,0.10)"}),H>0&&jsx("rect",{x:W,y:le,width:Ze,height:8,rx:ge,fill:K}),wt&&jsxs("text",{x:W+Ze+6,y:le+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(H),"%"]})]})})(),!e.segments&<&&!gt&&jsx(motion.rect,{x:W,y:a,width:ie,height:ze,rx:ke,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":st,"data-bar-background":"true",initial:{opacity:0,scale:.95},animate:{opacity:He&&!Dt?.15:e.parentId?.6:1,scale:Ge&&!He?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:q=>Wt(q),style:{cursor:nt,pointerEvents:"all"}}),!e.segments&&!lt&&jsx(motion.rect,{x:W,y:a,width:ie,height:ze,rx:ke,fill:Pe,"data-task-class":st,initial:{opacity:0,scale:.95},animate:{opacity:He&&!Dt?.15:e.parentId?.6:Ge?.9:.8,scale:Ge&&!He?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:gt?void 0:q=>Wt(q),style:{cursor:gt?"default":nt,pointerEvents:"all"}}),lt&&(O||ee)&&!e.segments&&jsx("rect",{x:W,y:a,width:ie,height:ze,rx:ke,fill:"none",stroke:n.criticalPath,strokeWidth:2,style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),!e.segments&&it>0&&!gt&&jsx("rect",{x:W,y:a,width:Math.max(ie*(it/100),ke*2),height:ze,rx:ke,fill:Pe,opacity:1,style:{pointerEvents:"none"}}),!e.segments&&!gt&&e.progress<100&&(()=>{let q=e.progress>0?ie*(e.progress/100):0,le=W+q,ge=ie-q,H=e.progress===0?ke:0,fe=e.progress===0?W:le,_e=e.progress===0?ie:ge;return jsxs(Fragment,{children:[jsx("rect",{x:fe,y:a,width:_e,height:ze,rx:H,fill:"url(#bar-remaining-hatch)",style:{pointerEvents:"none"}}),jsx("rect",{x:fe,y:a,width:_e,height:ze,rx:H,fill:"none",stroke:"#00E5CC",strokeWidth:.8,strokeDasharray:"5 3",style:{pointerEvents:"none"}})]})})(),lt&&!e.segments&&e.progress>0&&e.progress<100&&!gt&&!He&&se===null&&(()=>{let q=W+ie*(e.progress/100),le=8,ge=e.assignees?.[0];return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("circle",{cx:q,cy:a+ze/2,r:le,fill:ge?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:q,y:a+ze/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ge?.initials||ge?.name?.charAt(0)?.toUpperCase()||""})]})})(),Z&&!He&&ie>=40&&(se!==null||it<88)&&(()=>{let q=W+ie*(it/100),le=a+ze/2,ge=se!==null,H=ge?7:Ge?6:5,fe=ge||Ge?1:.35,_e=W+ie-q,C=Math.max(4,Math.min(12,_e-10)),$=12;return jsxs("g",{children:[jsx("rect",{x:q-$,y:le-12,width:$+C,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:ve,onPointerMove:Nt,onPointerUp:ft,onPointerCancel:ft,onClick:ut,onDoubleClick:ut,onMouseDown:pe=>pe.stopPropagation()}),jsx("circle",{cx:q,cy:le,r:H,fill:"#FFFFFF",stroke:Pe,strokeWidth:2,opacity:fe,style:{pointerEvents:"none",filter:ge?`drop-shadow(0 0 4px ${Pe})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ge&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:q-20,y:le-28,width:40,height:18,rx:4,fill:Lt?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Pe,strokeWidth:1}),jsxs("text",{x:q,y:le-16,textAnchor:"middle",dominantBaseline:"central",fill:Lt?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[se,"%"]})]})]})})(),e.segments&&e.segments.map((q,le)=>{let ge=(q.startDate.getTime()-o.getTime())/864e5*s,fe=(q.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ge+s,_e=He&&P==="move"&&te===le,C=ot===le,$=_e?ge+Ee:ge;return jsxs("g",{onMouseEnter:()=>!He&&he(le),onMouseLeave:()=>!He&&he(null),children:[jsx(motion.rect,{x:$,y:a,width:fe,height:ze,rx:ke,fill:Pe,initial:{opacity:0,scale:.95},animate:{opacity:_e||e.parentId?.6:C?.9:.8,scale:C&&!He?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:pe=>{pe.stopPropagation(),xe(le),De(ge),Wt(pe,void 0,ge);},style:{cursor:nt,pointerEvents:"all"}}),jsx("rect",{x:$,y:a,width:fe*(e.progress/100),height:ze,rx:ke,fill:Pe,opacity:1,style:{pointerEvents:"none"}})]},`segment-${le}`)}),Ue&&(O||ee)&&!e.segments&&jsxs(Fragment,{children:[ee&&!O&&jsx("rect",{x:W,y:a,width:ie,height:ze,rx:ke,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),O&&jsx("rect",{x:W,y:a,width:ie,height:ze,rx:ke,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),b&&ie>60&&!e.segments&&!(lt&>)&&(()=>{let q=l.taskLabel(e),le=typeof q=="string"?q:e.name,ge=le.length>Math.floor(ie/8)?`${le.substring(0,Math.floor(ie/8))}...`:le;return jsx("text",{x:W+8,y:a+ze/2,dominantBaseline:"middle",fill:Ce?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Ce?"line-through":"none"},children:ge})})(),!He&&!e.segments&&!gt&&e.progress>0&&e.progress<100&&(lt?jsxs("text",{x:W+ie+6,y:a+ze/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):ie>100?jsxs("text",{x:W+ie-12,y:a+ze/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&ie>80&&!He&&!e.segments&&!(lt&>)&&jsxs("g",{style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:W+ie-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:W+ie-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ge||Ct)&&!Dt&&!e.segments&&!gt&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:W-2,y:a,width:16,height:ze,fill:"transparent",style:{cursor:at},onMouseEnter:()=>z("resize-start"),onMouseLeave:()=>z(null),onMouseDown:q=>{q.stopPropagation(),Wt(q,"resize-start");}}),jsx(motion.rect,{x:W+4,y:a+8,width:3,height:ze-16,rx:1.5,fill:$e==="resize-start"||P==="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:W+ie-14,y:a,width:16,height:ze,fill:"transparent",style:{cursor:at},onMouseEnter:()=>z("resize-end"),onMouseLeave:()=>z(null),onMouseDown:q=>{q.stopPropagation(),Wt(q,"resize-end");}}),jsx(motion.rect,{x:W+ie-7,y:a+8,width:3,height:ze-16,rx:1.5,fill:$e==="resize-end"||P==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Ge&&!He&&!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+ze/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>z("connect"),onMouseLeave:()=>z(null),onMouseDown:q=>{q.stopPropagation(),Wt(q,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ze/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:$e==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),Dt&&V&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+ze/2,x2:V.x,y2:V.y,stroke:J?n.statusCompleted:n.accent,strokeWidth:J?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:J?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:V.x,cy:V.y,r:J?8:6,fill:J?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),J&&jsx(motion.text,{x:V.x+15,y:V.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:V.x+10},animate:{opacity:1,x:V.x+15},transition:{duration:.2},children:"Connect"})]}),(Ge||He)&&!Dt&&!e.segments&&jsx(motion.rect,{x:W-1,y:a-1,width:ie+2,height:ze+2,rx:ke+1,fill:"none",stroke:He?n.accent:lt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:lt?1:2,opacity:He||lt?.6:.4,initial:{opacity:0},animate:{opacity:He||lt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),Ct&&jsxs(Fragment,{children:[jsx("line",{x1:ae,y1:0,x2:ae,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:ae+X,y1:0,x2:ae+X,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Ge&&!He&&!e.segments&&!x&&(()=>{let ge=a<100,H=ge?a+ze+13:a-82-13,fe=ge?`M ${W+ie/2-6} ${a+ze+3} L ${W+ie/2} ${a+ze+13} L ${W+ie/2+6} ${a+ze+3}`:`M ${W+ie/2-6} ${a-13} L ${W+ie/2} ${a-3} L ${W+ie/2+6} ${a-13}`,_e=H+22,C=H+40,$=H+55,pe=H+70,K=ge?H+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:ge?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ge?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:fe,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:W+ie/2-120,y:H,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:W+ie/2,y:_e,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:W+ie/2-110,y:C,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:W+ie/2-70,y:C,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:zt(e.startDate)}),jsx("text",{x:W+ie/2-110,y:$,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:W+ie/2-70,y:$,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:zt(e.endDate)}),jsx("text",{x:W+ie/2+10,y:C,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:W+ie/2+65,y:C,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:mt()}),jsx("text",{x:W+ie/2+10,y:$,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:W+ie/2+65,y:$,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:W+ie/2-110,y:pe,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:W+ie/2-50,y:pe,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Ze=>Ze.name).join(", ").substring(0,30),e.assignees.map(Ze=>Ze.name).join(", ").length>30?"...":""]})]}),!ge&&jsx("text",{x:W+ie/2,y:K,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:Mt?"Left: move \u2022 Right: resize":jt?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Zd=260,ts=8,$m=16,Wv=-12;function Hm({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:v,mouseX:w,mouseY:N}=e,S=v.effortMinutes!=null||v.timeLoggedMinutes!=null||v.soldEffortMinutes!=null,F=v.lastActivity!=null,T=(S?155:105)+(F?28:0),E=w+$m,P=N+Wv-T;E+Zd>window.innerWidth-ts&&(E=w-Zd-$m),E<ts&&(E=ts);let k=P<ts;k&&(P=N+20),P+T>window.innerHeight-ts&&(P=window.innerHeight-ts-T),s({left:E,top:P,showBelow:k});},[e]),!e||!n)return null;let{task:o}=e,l=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,d={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted"},i=v=>v.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let P=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`}let v=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),N=P=>`${P.getFullYear()}-${String(P.getMonth()+1).padStart(2,"0")}-${String(P.getDate()).padStart(2,"0")}`,S=0,F=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),T=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;F.getTime()<=T.getTime();){let P=F.getDay();v[P]&&!w.has(N(F))&&S++,F.setDate(F.getDate()+1);}let E=Math.max(0,S);return a==="es"?`${E} d\xEDa${E!==1?"s":""}`:`${E} day${E!==1?"s":""}`},m=v=>{if(v==null||v===0)return "N/A";let w=Math.floor(v/60),N=v%60;return w===0?`${N}m`:N===0?`${w}h`:`${w}h ${N}m`},p=t.textTertiary||"#9CA3AF",g=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",x=t.accent||"#00E5CC",y=t.bgSecondary||"#1F2937",b=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Zd,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:y,border:`1px solid ${b}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(_i,{label:d.start,value:o.startDate?i(o.startDate):"N/A",labelColor:p,valueColor:g}),jsx(_i,{label:d.duration,value:u(),labelColor:p,valueColor:g}),jsx(_i,{label:d.end,value:o.endDate?i(o.endDate):"N/A",labelColor:p,valueColor:g}),jsx(_i,{label:d.progress,value:`${o.progress}%`,labelColor:p,valueColor:g})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:p},children:[d.assignees,": "]}),jsx("span",{style:{color:g,fontWeight:500},children:o.assignees.map(v=>v.name).join(", ")})]}),l&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.estimated,":"]})," ",jsx("span",{style:{color:g,fontWeight:600},children:m(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.logged,":"]})," ",jsx("span",{style:{color:x,fontWeight:600},children:m(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:p},children:[d.quoted,":"]})," ",jsx("span",{style:{color:g,fontWeight:600},children:m(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:p,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:g},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${n.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return createPortal(h,document.body)}function
|
|
131
|
-
`)},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=Ae.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=Ae.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)=>Ae.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ae.findTaskById(e,t);return !a||!a.dependencies?[]:Ae.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>Ae.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ae.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 n=a.startDate.getTime()-r.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let n=a.endDate.getTime()-r.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let n=a.progress-r.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Ae.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,n)=>r+n.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let n=0;n<t.length;n++){let s=t[n];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;n<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Ae.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'),n=new a,s=Ae.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(d=>{let i=d.startDate&&d.endDate?Ae.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?Ae.formatDate(d.startDate):"N/A",d.endDate?Ae.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.status||"N/A"]});r(n,{head:o,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=Ae.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,l=y=>{if(!s||!y.assignees||y.assignees.length===0)return o;let b=y.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return b.length===0?o:b.reduce((h,v)=>h+v,0)/b.length},d=new Map,i=(y,b="")=>{[...y].sort((v,w)=>(v.position??0)-(w.position??0)).forEach((v,w)=>{let N=b?`${b}.${w+1}`:`${w+1}`;d.set(v.id,N),v.subtasks?.length&&i(v.subtasks,N);});};i(e);let u=s&&Object.keys(s).length>0||n.some(y=>y._costRate>0),m=n.map(y=>{let b=y.startDate&&y.endDate?Ae.calculateDuration(y.startDate,y.endDate):0,h=y.effortMinutes,v=y.timeLoggedMinutes,w=y.soldEffortMinutes,N=typeof h=="number"?+(h/60).toFixed(1):0,
|
|
130
|
+
`})]});return createPortal(h,document.body)}function _i({label:e,value:t,labelColor:a,valueColor:r}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function zs({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:l=false,onHoverChange:d,hoverOverlayOnly:i=false,colorOverride:u,strokeWidthOverride:m,glowFilter:p}){let[,g]=useState(false),[f,x]=useState(null),y=r-t,b=y>0,h=Math.abs(y)<5,v=20,w=!h&&a<=e,N,S,F=a-e,T=e+F/2;S=T;let E=8;if(o==="squared")if(h)N=`M ${e} ${t} L ${a} ${r}`;else if(w){let De=e+15,Ee=a-v,Ve=b?t+20:t-20;S=Ee;let ot=b?1:-1;N=`M ${e} ${t} L ${De-E} ${t} Q ${De} ${t} ${De} ${t+ot*E} L ${De} ${Ve-ot*E} Q ${De} ${Ve} ${De-E} ${Ve} L ${Ee+E} ${Ve} Q ${Ee} ${Ve} ${Ee} ${Ve+ot*E} L ${Ee} ${r-ot*E} Q ${Ee} ${r} ${Ee+E} ${r} L ${a} ${r}`;}else {S=a-v;let Re=b?1:-1;N=`M ${e} ${t} L ${S-E} ${t} Q ${S} ${t} ${S} ${t+Re*E} L ${S} ${r-Re*E} Q ${S} ${r} ${S+E} ${r} L ${a} ${r}`;}else N=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let P=6,k=5,j=`M ${a} ${r} L ${a-P} ${r-k/2} L ${a-P} ${r+k/2} Z`,U=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),ae=u||(U?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),L=m||1,X=n.dependencyHover||(U?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Y="#f87171",V="rgba(248, 113, 113, 0.15)",R=S,J=(t+r)/2;if(f)if(o==="squared")if(h)R=Math.max(e+10,Math.min(a-10,f.x)),J=t;else if(w){let Re=e+15,De=a-v,Ee=b?t+20:t-20,Ve=[[e,t,Re,t],[Re,t,Re,Ee],[Re,Ee,De,Ee],[De,Ee,De,r],[De,r,a,r]],ot=1/0,he={x:R,y:J};for(let Ge of Ve){let je=Ne(f.x,f.y,Ge[0],Ge[1],Ge[2],Ge[3]),He=Math.hypot(f.x-je.x,f.y-je.y);He<ot&&(ot=He,he=je);}R=he.x,J=he.y;}else {let Re=[[e,t,S,t],[S,t,S,r],[S,r,a,r]],De=1/0,Ee={x:R,y:J};for(let Ve of Re){let ot=Ne(f.x,f.y,Ve[0],Ve[1],Ve[2],Ve[3]),he=Math.hypot(f.x-ot.x,f.y-ot.y);he<De&&(De=he,Ee=ot);}R=Ee.x,J=Ee.y;}else {let Re=T,De=t,Ee=T,Ve=r,ot=1/0,he=R,Ge=J;for(let je=0;je<=1;je+=.02){let He=1-je,Ct=He*He*He*e+3*He*He*je*Re+3*He*je*je*Ee+je*je*je*a,Dt=He*He*He*t+3*He*He*je*De+3*He*je*je*Ve+je*je*je*r,Je=Math.hypot(f.x-Ct,f.y-Dt);Je<ot&&(ot=Je,he=Ct,Ge=Dt);}R=he,J=Ge;}function Ne(Re,De,Ee,Ve,ot,he){let Ge=ot-Ee,je=he-Ve,He=Ge*Ge+je*je;if(He===0)return {x:Ee,y:Ve};let Ct=((Re-Ee)*Ge+(De-Ve)*je)/He;return Ct=Math.max(0,Math.min(1,Ct)),{x:Ee+Ct*Ge,y:Ve+Ct*je}}let $e=Re=>{let De=Re.currentTarget.ownerSVGElement;if(!De)return;let Ee=De.getScreenCTM();if(!Ee)return;let Ve=Ee.inverse();x({x:Ve.a*Re.clientX+Ve.c*Re.clientY+Ve.e,y:Ve.b*Re.clientX+Ve.d*Re.clientY+Ve.f});},z=()=>{g(false),x(null),d?.(false);},te=()=>{g(true),d?.(true);},xe=Re=>s?jsxs(motion.g,{initial:Re,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:De=>{De.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:R,cy:J,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:R,cy:J,r:9,fill:V,stroke:Y,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:R-3,y1:J-3,x2:R+3,y2:J+3,stroke:Y,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:R+3,y1:J-3,x2:R-3,y2:J+3,stroke:Y,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return l?jsxs("g",{"data-dependency-line":"true",onMouseLeave:z,onMouseMove:$e,children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:N,fill:"none",stroke:X,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:N,fill:"none",stroke:X,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:j,fill:X,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:X,opacity:.9,style:{pointerEvents:"none"}}),xe({opacity:0,scale:.8})]}):i?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:te,onMouseLeave:z,onMouseMove:$e,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:N,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:X,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:N,fill:"none",stroke:X,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:j,fill:X,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:X,style:{pointerEvents:"none"}}),xe({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:te,onMouseLeave:z,onMouseMove:$e,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:N,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:N,fill:"none",stroke:ae,strokeWidth:L,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:p||"none"}}),jsx(motion.path,{d:j,fill:ae,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:ae,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Xi({task:e,x:t,y:a,theme:r,onClick:n}){let[s,o]=useState(false),l=16,d=i=>i.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(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:d(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 Ae={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 n=r.getDay();n!==0&&n!==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 n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=i=>{i.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,l=new Set,d=i=>{if(!o.has(i)){o.add(i),l.add(i);let u=r.get(i)||[];for(let m of u){if(!o.has(m)&&d(m))return true;if(l.has(m))return true}}return l.delete(i),false};return d(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,o)=>(s.position??0)-(o.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=Ae.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Ae.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=Ae.findTaskById(e,n);if(s)a.unshift(s),n=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=Ae.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
+
`)},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=Ae.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=Ae.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)=>Ae.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=Ae.findTaskById(e,t);return !a||!a.dependencies?[]:Ae.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>Ae.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>Ae.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 n=a.startDate.getTime()-r.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let n=a.endDate.getTime()-r.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let n=a.progress-r.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=Ae.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,n)=>r+n.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let n=0;n<t.length;n++){let s=t[n];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;n<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>Ae.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'),n=new a,s=Ae.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],l=s.map(d=>{let i=d.startDate&&d.endDate?Ae.calculateDuration(d.startDate,d.endDate):0;return [d.name,d.startDate?Ae.formatDate(d.startDate):"N/A",d.endDate?Ae.formatDate(d.endDate):"N/A",i>0?`${i} days`:"N/A",`${d.progress}%`,d.status||"N/A"]});r(n,{head:o,body:l,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=Ae.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,l=y=>{if(!s||!y.assignees||y.assignees.length===0)return o;let b=y.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return b.length===0?o:b.reduce((h,v)=>h+v,0)/b.length},d=new Map,i=(y,b="")=>{[...y].sort((v,w)=>(v.position??0)-(w.position??0)).forEach((v,w)=>{let N=b?`${b}.${w+1}`:`${w+1}`;d.set(v.id,N),v.subtasks?.length&&i(v.subtasks,N);});};i(e);let u=s&&Object.keys(s).length>0||n.some(y=>y._costRate>0),m=n.map(y=>{let b=y.startDate&&y.endDate?Ae.calculateDuration(y.startDate,y.endDate):0,h=y.effortMinutes,v=y.timeLoggedMinutes,w=y.soldEffortMinutes,N=typeof h=="number"?+(h/60).toFixed(1):0,S=typeof v=="number"?+(v/60).toFixed(1):0,F=typeof w=="number"?+(w/60).toFixed(1):0,T=y._costRate>0?y._costRate:l(y),E={WBS:d.get(y.id)||"","Task Name":y.name,"Start Date":y.startDate?Ae.formatDate(y.startDate):"","End Date":y.endDate?Ae.formatDate(y.endDate):"","Duration (days)":b>0?b:"","Progress (%)":y.progress,Status:y.status||"",Assignees:y.assignees?.map(k=>k.name).join(", ")||"","Estimated (h)":N||"","Logged (h)":S||"","Quoted (h)":F||""};u&&(E["$ Estimated"]=N>0&&T>0?Math.round(N*T):"",E["$ Executed"]=S>0&&T>0?Math.round(S*T):"",E["$ Quoted"]=F>0&&T>0?Math.round(F*T):"",E["Rate ($/h)"]=T>0?T:"");let P=y.weight;return E["Weight (%)"]=typeof P=="number"&&P>0?P:"",E["Is Milestone"]=y.isMilestone?"Yes":"No",E}),p=a?.projectName||"";if(p||m.length>0){let y=0,b=0,h=0,v=0,w=0,N=0,S=0,F=0,T=n.filter(k=>k.startDate).map(k=>k.startDate.getTime()),E=n.filter(k=>k.endDate).map(k=>k.endDate.getTime());for(let k of m)typeof k["Estimated (h)"]=="number"&&(y+=k["Estimated (h)"]),typeof k["Logged (h)"]=="number"&&(b+=k["Logged (h)"]),typeof k["Quoted (h)"]=="number"&&(h+=k["Quoted (h)"]),u&&(typeof k["$ Estimated"]=="number"&&(v+=k["$ Estimated"]),typeof k["$ Executed"]=="number"&&(w+=k["$ Executed"]),typeof k["$ Quoted"]=="number"&&(N+=k["$ Quoted"])),typeof k["Progress (%)"]=="number"&&(S+=k["Progress (%)"],F++);let P={WBS:"0","Task Name":`\u{1F4CB} ${p||"PROJECT TOTAL"}`,"Start Date":T.length>0?Ae.formatDate(new Date(Math.min(...T))):"","End Date":E.length>0?Ae.formatDate(new Date(Math.max(...E))):"","Duration (days)":T.length>0&&E.length>0?Ae.calculateDuration(new Date(Math.min(...T)),new Date(Math.max(...E))):"","Progress (%)":F>0?Math.round(S/F):0,Status:"",Assignees:"","Estimated (h)":+y.toFixed(1)||"","Logged (h)":+b.toFixed(1)||"","Quoted (h)":+h.toFixed(1)||""};u&&(P["$ Estimated"]=v||"",P["$ Executed"]=w||"",P["$ Quoted"]=N||"",P["Rate ($/h)"]=""),P["Is Milestone"]="No",m.unshift(P);}let g=r.utils.json_to_sheet(m),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];g["!cols"]=f;let x=r.utils.book_new();if(r.utils.book_append_sheet(x,g,"Gantt Tasks"),!t){let y=new Date,b=v=>String(v).padStart(2,"0");t=`Project_${`${y.getFullYear()}-${b(y.getMonth()+1)}-${b(y.getDate())}_${b(y.getHours())}${b(y.getMinutes())}`}.xlsx`;}r.writeFile(x,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=Ae.flattenTasks(e),n=new Map;r.forEach((p,g)=>{n.set(p.id,g+1);});let s=p=>p.toISOString().replace("Z",""),o=Ae.getEarliestStartDate(e)||new Date,l=Ae.getLatestEndDate(e)||new Date,d=r.map((p,g)=>{let f=n.get(p.id),x=p.startDate&&p.endDate?Ae.calculateDuration(p.startDate,p.endDate):0,y=(p.dependencies||[]).filter(b=>n.has(b)).map(b=>`
|
|
132
132
|
<PredecessorLink>
|
|
133
133
|
<PredecessorUID>${n.get(b)}</PredecessorUID>
|
|
134
134
|
<Type>1</Type>
|
|
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${d}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(u),m.download=a,m.click(),URL.revokeObjectURL(m.href);},calculateCriticalPath:e=>{let t=Ae.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,n=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?Ae.calculateDuration(i.startDate,i.endDate):0,m=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let f=t.find(x=>x.id===g);if(f){n(f);let x=r.get(g)?.ef||0;m=Math.max(m,x);}}let p=m+u;r.set(i.id,{es:m,ef:p});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let u=i.startDate&&i.endDate?Ae.calculateDuration(i.startDate,i.endDate):0,m=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),p=s;if(m.length>0)for(let f of m){l(f);let x=o.get(f.id)?.ls||0;p=Math.min(p,x);}let g=p-u;o.set(i.id,{ls:g,lf:p});};a.forEach(l);let d=[];for(let i of a){let u=r.get(i.id),m=o.get(i.id);if(u&&m){let p=m.ls-u.es;Math.abs(p)<.01&&d.push(i.id);}}return d},calculateCriticalPathFull:e=>{let t=new Map,r=Ae.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let n=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(n.has(g)){let f=s.get(g);f&&f.push(p.id);}}let o=new Map;for(let p of r)o.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)n.has(g)&&o.set(p.id,(o.get(p.id)||0)+1);let l=new Map,d=[],i=[];for(let p of r)(o.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();d.push(p);let g=n.get(p);if(!g||!g.startDate||!g.endDate)continue;let f=Ae.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let b of g.dependencies){let h=l.get(b);h&&(x=Math.max(x,h.ef));}l.set(p,{es:x,ef:x+f});let y=s.get(p)||[];for(let b of y){let h=(o.get(b)||1)-1;o.set(b,h),h===0&&i.push(b);}}if(d.length<r.length)return t;let u=Math.max(...Array.from(l.values()).map(p=>p.ef)),m=new Map;for(let p=d.length-1;p>=0;p--){let g=d[p];if(!g)continue;let f=n.get(g);if(!f||!f.startDate||!f.endDate)continue;let x=Ae.calculateDuration(f.startDate,f.endDate),y=s.get(g)||[],b=u;if(y.length>0)for(let h of y){let v=m.get(h);v&&(b=Math.min(b,v.ls));}m.set(g,{ls:b-x,lf:b});}for(let p of d){let g=l.get(p),f=m.get(p),x=f.ls-g.es,y=s.get(p)||[],b;y.length>0?b=Math.min(...y.map(h=>l.get(h).es))-g.ef:b=u-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=Ae.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ae.calculateCriticalPath(e).includes(t))return 0;let n=Ae.getDependentTasks(e,t);if(n.length===0){let l=Ae.getLatestEndDate(e);if(!l)return null;let d=Ae.calculateDuration(a.endDate,l);return Math.max(0,d)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,d)=>l-d)[0];if(!s)return null;let o=Ae.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ae.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Ae.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ae.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let d of o){if(n.has(d.id)||!d.startDate||!d.endDate)continue;let i=Ae.calculateDuration(d.startDate,d.endDate),u;if(a!==void 0?(u=new Date(d.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let g=new Date(s.endDate),f=new Date(g);f.setDate(f.getDate()+1),u<f&&(u=f);}let m=Ae.calculateEndDate(u,i),p=g=>g.map(f=>f.id===d.id?{...f,startDate:u,endDate:m}:f.subtasks?{...f,subtasks:p(f.subtasks)}:f);l=p(l),l=Ae.autoScheduleDependents(l,d.id,a,n);}return l},calculateCascadePreview:(e,t,a,r,n,s,o,l)=>{if(a===0)return [];let d=[],i=n.getTime(),u=1e3*60*60*24,m=Ae.findTaskById(e,t);if(!m||!m.endDate)return [];let p=(g,f,x=new Set)=>{if(x.has(g))return;x.add(g);let y=Ae.getDependentTasks(e,g);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=r.findIndex(k=>k.id===b.id);if(h===-1)continue;let v=b.startDate.getTime(),N=(b.endDate.getTime()-v)/u,F=(v-i)/u*s,T=F+f*s,S=Math.max(N*s,s),P=l+h*o+(o-18)/2;d.push({taskId:b.id,taskName:b.name,originalX:F,previewX:T,width:S,y:P,rowIndex:h,daysDelta:f,color:b.color}),p(b.id,f,x);}};return p(t,a),d},splitTask:(e,t,a,r=3)=>{let n=Ae.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.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 o=new Date(a);o.setDate(o.getDate()+r);let l=new Date(n.endDate);l.setDate(l.getDate()+r);let d=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=u=>u.map(m=>m.id===n.id?{...m,endDate:l,segments:d}:m.subtasks?{...m,subtasks:i(m.subtasks)}:m);return i(e)}};function Ki({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:l="en",templates:d,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:m,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:N,onTaskProgressDrag:D,workingDaysConfig:F}){let S=Vr(),P=useRef(null),[k,j]=useState([]),[U,ae]=useState(null),[L,X]=useState(null),[K,V]=useState(null),R=useRef(false),[J,Te]=useState(new Set),[$e,H]=useState(null),te=useCallback(B=>{if(K&&!R.current){let Z=B.target,O=false;for(;Z&&Z!==B.currentTarget;){if(Z.getAttribute?.("data-dependency-line")==="true"||Z.getAttribute?.("data-dependency-hover-overlay")==="true"){O=true;break}Z=Z.parentElement;}O||V(null);}},[K]),ye=useCallback(B=>{X(B);},[]),Re=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Se=r==="day"?60:r==="week"?20:8,Ee=Re*Se*o,Ve=B=>{let Z=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),O=Z.getUTCDay()||7;Z.setUTCDate(Z.getUTCDate()+4-O);let ee=new Date(Date.UTC(Z.getUTCFullYear(),0,1));return Math.ceil(((Z.getTime()-ee.getTime())/864e5+1)/7)},ot=B=>{let Z=B.getDay();return Z===0||Z===6},be=useMemo(()=>{let B=F?.holidayDates;return B?B instanceof Set?B:new Set(B):null},[F?.holidayDates]),Ge=B=>{if(!be)return false;let Z=`${B.getFullYear()}-${String(B.getMonth()+1).padStart(2,"0")}-${String(B.getDate()).padStart(2,"0")}`;return be.has(Z)},je=useCallback(B=>{let Z=Math.round(B/(Se*o)),O=new Date(n);return O.setDate(O.getDate()+Z),O},[n,Se,o]),He=useCallback((B,Z)=>{if(Z.startDate&&Z.endDate)return;let O=B.currentTarget.ownerSVGElement;if(!O)return;let ee=O.createSVGPoint();ee.x=B.clientX,ee.y=B.clientY;let Ue=ee.matrixTransform(O.getScreenCTM()?.inverse()),ke=je(Ue.x),Be=new Date(ke);Be.setDate(Be.getDate()+1),H(null),f?.(Z,ke,Be);},[je,f]),wt=useCallback((B,Z,O)=>{let ee=B.currentTarget.ownerSVGElement;if(!ee)return;let Ue=ee.createSVGPoint();Ue.x=B.clientX,Ue.y=B.clientY;let ke=Ue.matrixTransform(ee.getScreenCTM()?.inverse()),Be=je(ke.x),Pe=Math.round(ke.x/(Se*o))*Se*o;H({taskId:Z.id,x:Pe,y:O*a+a/2,date:Be});},[je,Se,o,a]),Nt=useCallback(()=>{H(null);},[]),Je=useMemo(()=>{let B=Ue=>Ue.map(ke=>{if(ke.subtasks&&ke.subtasks.length>0){let Be=B(ke.subtasks),Me=Be.filter(Pe=>Pe.startDate&&Pe.endDate);if(Me.length>0){let Pe=Me.map(mt=>mt.startDate.getTime()),nt=Me.map(mt=>mt.endDate.getTime()),at=new Date(Math.min(...Pe)),dt=new Date(Math.max(...nt));return {...ke,subtasks:Be,startDate:at,endDate:dt}}return {...ke,subtasks:Be}}return ke}),Z=(Ue,ke=[])=>{let Be=[...Ue].sort((Me,Pe)=>(Me.position??0)-(Pe.position??0));for(let Me of Be)ke.push(Me),Me.subtasks&&Me.subtasks.length>0&&(Me.isExpanded===void 0||Me.isExpanded)&&Z(Me.subtasks,ke);return ke},O=B(e);return Z(O)},[e]),ze=useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let Z=B.startDate.getTime(),O=B.endDate.getTime(),ee=n.getTime(),Ue=(Z-ee)/(1e3*60*60*24),ke=(O-Z)/(1e3*60*60*24)+1,Be=Ue*Se*o,Me=Math.max(Se*o,40),Pe=Math.max(ke*Se*o,Me);return {x:Be,width:Pe}},[n,Se,o]),lt=useMemo(()=>Je.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:Z,width:O}=ze(B),Ue=Je.findIndex(ke=>ke.id===B.id)*a+(a-18)/2;return {id:B.id,x:Z,y:Ue,width:O,height:18}}),[Je,ze]),At=useCallback((B,Z,O)=>{if(!O){j([]),ae(null);return}if(ae({taskId:B,daysDelta:Z}),Z===0){j([]);return}let ee=Ae.calculateCascadePreview(e,B,Z,Je,n,Se*o,a,48);j(ee);},[e,Je,n,Se,o,a,48]),Ne=useCallback((B,Z)=>{if(!U)return Z;let O=Se*o,ee=U.daysDelta*O;if(B===U.taskId)return {x:Z.x+ee,width:Z.width};let Ue=k.find(ke=>ke.taskId===B);return Ue?{x:Ue.previewX,width:Ue.width}:Z},[U,k,Se,o]),ft=useMemo(()=>{let B=[],Z=new Date(n);for(;Z<=s;){let Ue=(Z.getTime()-n.getTime())/864e5*Se*o;if(r==="day")B.push({date:new Date(Z),label:Z.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ue}),Z.setDate(Z.getDate()+1);else if(r==="week"){let ke=Ve(Z);B.push({date:new Date(Z),label:`${S.labels.week} ${ke}`,x:Ue}),Z.setDate(Z.getDate()+7);}else B.push({date:new Date(Z),label:Z.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ue}),Z.setMonth(Z.getMonth()+1);}return B},[n,s,r,Se,o,l,S.labels.week]),A=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Se*o,[n,Se,o]),ie=Math.max(Je.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.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Ee,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),ft.map((B,Z)=>jsxs("g",{children:[Z>0&&jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:B.x+8,y:48/2,fill:r==="day"&&!ot(B.date)&&Ge(B.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${Z}`)),A>=0&&A<=Ee&&jsxs("g",{children:[jsx("circle",{cx:A,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:A,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${A-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:S.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:P,width:Math.max(Ee,1e3),height:ie,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:te,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("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:ie,fill:t.bgPrimary}),Je.map((B,Z)=>jsx("rect",{x:0,y:Z*a,width:Math.max(Ee,1e3),height:a,fill:Z%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${B.id}`)),ft.map((B,Z)=>Z>0?jsx("line",{x1:B.x,y1:0,x2:B.x,y2:Je.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${Z}`):null),ft.map((B,Z)=>{let O=ft[Z+1]?.x||Ee,ee=w&&ot(B.date),Ue=r==="day"&&!ot(B.date)&&Ge(B.date);return ee||Ue?jsxs("g",{children:[jsx("rect",{x:B.x,y:0,width:O-B.x,height:Je.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:B.x,y:0,width:O-B.x,height:Je.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${Z}`):null}),Je.map((B,Z)=>{let O=B.startDate&&B.endDate;return jsx("g",{children:!O&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:Z*a,width:Ee,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ee=>He(ee,B),onMouseMove:ee=>wt(ee,B,Z),onMouseLeave:()=>{Nt();}},`clickable-${B.id}`),$e&&$e.taskId===B.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:$e.x,y1:Z*a+4,x2:$e.x,y2:Z*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:$e.x,cy:$e.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:$e.x,cy:$e.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${$e.x}, ${Z*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:$e.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!$e||$e.taskId!==B.id)&&jsx("text",{x:A>0?A:100,y:Z*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:S.labels.clickToSetDates},`placeholder-${B.id}`)]})},`row-group-${B.id}`)}),Je.map((B,Z)=>{if(!B.startDate||!B.endDate)return null;let{x:O,width:ee}=ze(B),Ue=Z*a+(a-18)/2,ke=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;if(B.isMilestone)return jsx(_i,{task:B,x:O+ee/2,y:Ue+12,theme:t,onClick:m},B.id);if(ke){let Be=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Me=8,Pe=Ue+(a-18)/2+(18-Me)/2,nt=4,at=B.progress||0,dt=new Date;dt.setHours(0,0,0,0);let mt=B.startDate&&dt>=B.startDate,Vt=B.endDate&&(()=>{let rt=new Date(B.endDate);return rt.setHours(0,0,0,0),dt>rt})(),Mt=B.startDate&&dt<B.startDate,zt=1;if(mt&&B.startDate&&B.endDate&&!Mt){let rt=new Date(B.startDate);rt.setHours(0,0,0,0);let ia=new Date(B.endDate);ia.setHours(0,0,0,0);let fa=Math.max(1,(ia.getTime()-rt.getTime())/(1e3*60*60*24)),le=Math.min((dt.getTime()-rt.getTime())/(1e3*60*60*24),fa)/fa*100;zt=le>0?at/le:1;}let gt;at>=100?gt="#00E5CC":Mt?gt="#4B5563":Vt&&at<100?gt="#EF4444":zt>=.95?gt="#22C55E":zt>=.8?gt="#F59E0B":gt="#EF4444";let Dt=Math.max(at/100*ee,at>0?nt*2:0),Ut=ee>100&&at>0,Gt=B.isCriticalPath;return jsxs("g",{onClick:()=>m?.(B),onContextMenu:rt=>{rt.preventDefault(),rt.stopPropagation(),g?.(B,rt);},onMouseMove:rt=>{ye({task:B,x:O,y:Pe,width:ee,height:Me,showBelow:Pe<100,mouseX:rt.clientX,mouseY:rt.clientY});},onMouseLeave:()=>ye(null),style:{cursor:"default",opacity:h?Gt?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:O,y:Ue,width:ee,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:O,y:Pe,width:ee,height:Me,rx:nt,fill:Be?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),at>0&&jsx("rect",{x:O,y:Pe,width:Dt,height:Me,rx:nt,fill:gt}),h&&Gt&&jsx("rect",{x:O,y:Pe,width:ee,height:Me,rx:nt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ut&&jsxs("text",{x:O+Dt+6,y:Pe+Me/2,dominantBaseline:"central",fill:Be?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(at),"%"]})]},B.id)}return jsx(Ui,{task:B,x:O,y:Ue,width:ee,theme:t,dayWidth:Se*o,startDate:n,templates:d,onClick:m,onDoubleClick:p,onContextMenu:g,onDateChange:f,onDependencyCreate:x,allTaskPositions:lt,onDragMove:At,onHoverChange:ye,showBaseline:b,showTaskBarLabels:u,showCriticalPath:h,readOnly:N?!N(B):false,onProgressChange:D},B.id)}),v&&Je.map((B,Z)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(O=>{let ee=Je.find(gt=>gt.id===O);if(!ee||!ee.startDate||!ee.endDate)return null;let Ue=Je.findIndex(gt=>gt.id===O),ke=Ne(ee.id,ze(ee)),Be=Ne(B.id,ze(B)),Me=ke.x+ke.width,Pe=Ue*a+26,nt=Be.x,at=Z*a+26,dt=`dep-${O}-${B.id}`;if(J.has(dt))return null;let mt=h&&B.isCriticalPath&&ee.isCriticalPath;return jsx(Is,{x1:Me,y1:Pe,x2:nt,y2:at,theme:t,lineStyle:i,colorOverride:h?mt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?mt?2:1:void 0,glowFilter:mt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(B.id,O),onHoverChange:gt=>{R.current=gt,gt&&V({key:dt,fromId:O,toId:B.id,exitX:Me,exitY:Pe,enterX:nt,enterY:at});}},dt)})),k.map(B=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:18,rx:6,fill:B.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(B.daysDelta)>0&&jsx("text",{x:B.previewX+B.width/2,y:B.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),v&&K&&jsx(Is,{x1:K.exitX,y1:K.exitY,x2:K.enterX,y2:K.enterY,theme:t,lineStyle:i,onDelete:()=>{let B=K.key;V(null),R.current=false,Te(Z=>new Set(Z).add(B)),y?.(K.toId,K.fromId);},hoverOverlayOnly:true,onHoverChange:B=>{R.current=B,B||V(null);}},`${K.key}-hover-overlay`),A>=0&&A<=Ee&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:A,y1:0,x2:A,y2:ie,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:A,y1:0,x2:A,y2:ie,stroke:t.today,strokeWidth:1,opacity:1})]})]}),L&&jsx(Om,{tooltipData:L,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:F})]})}var _v=['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"'],zm=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Kv=()=>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"})}),qv=()=>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"})}),Yv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Xv=()=>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 Xi({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:d}){let[i,u]=useState(false),[m,p]=useState(false),[g,f]=useState([]),[x,y]=useState(""),[b,h]=useState(false),[v,w]=useState(true),[N,D]=useState(""),[F,T]=useState(-1),[S,P]=useState(false),[k,j]=useState(0),U=useRef(null),ae=useRef(null),L=useRef(null),X=useRef(null),{enabled:K=true,placeholder:V='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:J,suggestions:Te=_v,maxHistory:$e=50,persistHistory:H,mentionableUsers:te=[]}=a,ye=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Re=ye?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Se=ye?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Ee=ye?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Ve=ye?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ot=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",be=ye?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ge=ye?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",je=ye?"rgba(0, 229, 204, 0.9)":"#00E5CC",He=ye?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",wt=ye?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Nt=ye?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",Je=ye?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",ze=ye?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",lt=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",At=ye?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Ne=ye?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",ft=ye?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",A=ye?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",ie=ye?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",B=ye?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Z="rgba(0, 229, 204, 0.04)",O=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ee=ye?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=ye?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",ke=ye?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Be=ye?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",Me=ye?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Pe=ye?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",nt=ye?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",at="rgba(0, 229, 204, 0.06)",dt=ye?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",mt=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",Vt=ye?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Mt=ye?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",zt=ye?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",gt=ye?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Dt=ye?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ut=ye?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Gt=ye?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Rt=ye?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",rt=ye?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ia=ye?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",fa=ye?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",W=ye?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",le=ye?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",st=H?.storageKey||"gantt-ai-history",jt=H?.maxMessages??5,re=te.filter($=>{if(!N)return true;let ne=N.toLowerCase();return $.name.toLowerCase().includes(ne)||$.email&&$.email.toLowerCase().includes(ne)}).slice(0,5),xe=useCallback($=>{if(y($),te.length===0)return;let ne=U.current;if(!ne)return;let Ke=ne.selectionStart||$.length,C=$.slice(0,Ke),z=C.lastIndexOf("@");if(z>=0&&((z>0?C[z-1]:" ")===" "||z===0)){let Y=C.slice(z+1);if(Y.length<=40){D(Y),T(z),P(true),j(0);return}}P(false),D(""),T(-1);},[te.length]),Tt=useCallback($=>{let ne=x.slice(0,F),Ke=x.slice(F+1+N.length),C=`${ne}@${$.name} ${Ke}`;y(C),P(false),D(""),T(-1),setTimeout(()=>U.current?.focus(),0);},[x,F,N]),bt=useCallback($=>{if(!S||re.length===0)return false;if($.key==="ArrowDown")return $.preventDefault(),j(ne=>ne<re.length-1?ne+1:0),true;if($.key==="ArrowUp")return $.preventDefault(),j(ne=>ne>0?ne-1:re.length-1),true;if($.key==="Enter"||$.key==="Tab"){$.preventDefault();let ne=re[k];return ne&&Tt(ne),true}return $.key==="Escape"?(P(false),true):false},[S,re,k,Tt]);useEffect(()=>{if(H?.enabled)try{let $=localStorage.getItem(st);if($){let Ke=JSON.parse($).map(C=>({...C,timestamp:new Date(C.timestamp)}));f(Ke.slice(-jt));}}catch($){console.warn("[GanttAIAssistant] Failed to load persisted history:",$);}},[H?.enabled,st,jt]),useEffect(()=>{if(H?.enabled&&g.length>0)try{let $=g.filter(ne=>!ne.isLoading).slice(-jt);localStorage.setItem(st,JSON.stringify($));}catch($){console.warn("[GanttAIAssistant] Failed to persist history:",$);}},[g,H?.enabled,st,jt]),useEffect(()=>{ae.current&&ae.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!m&&U.current&&setTimeout(()=>U.current?.focus(),100);},[i,m]);let pt=useCallback($=>{if($.success)switch($.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":$.taskId&&$.updates&&n?.($.taskId,$.updates);break;case "create_task":$.newTask&&s?.($.newTask);break;case "delete_task":$.taskId&&o?.($.taskId);break;case "link_tasks":$.dependencyFrom&&$.dependencyTo&&l?.($.dependencyFrom,$.dependencyTo);break;case "unlink_tasks":$.taskId&&$.dependencyFrom&&d?.($.taskId,$.dependencyFrom);break}},[n,s,o,l,d]),it=useCallback(async $=>{if(!$.trim()||b)return;let ne={id:`user-${Date.now()}`,role:"user",content:$,timestamp:new Date};f(C=>[...C.slice(-($e-1)),ne]),y(""),w(false),h(true);let Ke={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(C=>[...C,Ke]);try{if(J){let C=g.filter(ve=>!ve.isLoading&&ve.content).slice(-6).map(ve=>({role:ve.role,content:ve.content})),z=await J($,e,C);f(ve=>{let Y=ve.filter(Ct=>!Ct.isLoading),Ze={id:`assistant-${Date.now()}`,role:"assistant",content:z.message,timestamp:new Date,command:z};return [...Y,Ze]}),pt(z);}else f(C=>[...C.filter(ve=>!ve.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(C){f(z=>[...z.filter(Y=>!Y.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${C instanceof Error?C.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,$e,J,e,pt]),q=$=>{$.preventDefault(),it(x);},fe=$=>{y($),U.current?.focus();};if(useEffect(()=>{let $=ne=>{(ne.metaKey||ne.ctrlKey)&&ne.key==="k"&&(ne.preventDefault(),u(Ke=>!Ke),i||p(false)),ne.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",$),()=>document.removeEventListener("keydown",$)},[i]),useEffect(()=>{if(!i)return;let $=Ke=>{let C=Ke.target;L.current&&!L.current.contains(C)&&u(false);},ne=setTimeout(()=>{document.addEventListener("mousedown",$);},100);return ()=>{clearTimeout(ne),document.removeEventListener("mousedown",$);}},[i]),!K)return null;let ce={"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(ea,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ce[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Re,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Se}`,color:"#00E5CC",cursor:"pointer",boxShadow:Ee,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Ve}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${ot}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(zm,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:je,background:be,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ge}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,u=new Blob([i],{type:"application/xml;charset=utf-8;"}),m=document.createElement("a");m.href=URL.createObjectURL(u),m.download=a,m.click(),URL.revokeObjectURL(m.href);},calculateCriticalPath:e=>{let t=Ae.flattenTasks(e),a=t.filter(i=>i.startDate&&i.endDate);if(a.length===0)return [];let r=new Map,n=i=>{if(r.has(i.id))return;let u=i.startDate&&i.endDate?Ae.calculateDuration(i.startDate,i.endDate):0,m=0;if(i.dependencies&&i.dependencies.length>0)for(let g of i.dependencies){let f=t.find(x=>x.id===g);if(f){n(f);let x=r.get(g)?.ef||0;m=Math.max(m,x);}}let p=m+u;r.set(i.id,{es:m,ef:p});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(i=>i.ef)),o=new Map,l=i=>{if(o.has(i.id))return;let u=i.startDate&&i.endDate?Ae.calculateDuration(i.startDate,i.endDate):0,m=t.filter(f=>f.dependencies&&f.dependencies.includes(i.id)),p=s;if(m.length>0)for(let f of m){l(f);let x=o.get(f.id)?.ls||0;p=Math.min(p,x);}let g=p-u;o.set(i.id,{ls:g,lf:p});};a.forEach(l);let d=[];for(let i of a){let u=r.get(i.id),m=o.get(i.id);if(u&&m){let p=m.ls-u.es;Math.abs(p)<.01&&d.push(i.id);}}return d},calculateCriticalPathFull:e=>{let t=new Map,r=Ae.flattenTasks(e).filter(p=>p.startDate&&p.endDate);if(r.length===0)return t;let n=new Map(r.map(p=>[p.id,p])),s=new Map;for(let p of r)s.has(p.id)||s.set(p.id,[]);for(let p of r)if(p.dependencies){for(let g of p.dependencies)if(n.has(g)){let f=s.get(g);f&&f.push(p.id);}}let o=new Map;for(let p of r)o.set(p.id,0);for(let p of r)if(p.dependencies)for(let g of p.dependencies)n.has(g)&&o.set(p.id,(o.get(p.id)||0)+1);let l=new Map,d=[],i=[];for(let p of r)(o.get(p.id)||0)===0&&i.push(p.id);for(;i.length>0;){let p=i.shift();d.push(p);let g=n.get(p);if(!g||!g.startDate||!g.endDate)continue;let f=Ae.calculateDuration(g.startDate,g.endDate),x=0;if(g.dependencies)for(let b of g.dependencies){let h=l.get(b);h&&(x=Math.max(x,h.ef));}l.set(p,{es:x,ef:x+f});let y=s.get(p)||[];for(let b of y){let h=(o.get(b)||1)-1;o.set(b,h),h===0&&i.push(b);}}if(d.length<r.length)return t;let u=Math.max(...Array.from(l.values()).map(p=>p.ef)),m=new Map;for(let p=d.length-1;p>=0;p--){let g=d[p];if(!g)continue;let f=n.get(g);if(!f||!f.startDate||!f.endDate)continue;let x=Ae.calculateDuration(f.startDate,f.endDate),y=s.get(g)||[],b=u;if(y.length>0)for(let h of y){let v=m.get(h);v&&(b=Math.min(b,v.ls));}m.set(g,{ls:b-x,lf:b});}for(let p of d){let g=l.get(p),f=m.get(p),x=f.ls-g.es,y=s.get(p)||[],b;y.length>0?b=Math.min(...y.map(h=>l.get(h).es))-g.ef:b=u-g.ef,t.set(p,{earlyStart:g.es,earlyFinish:g.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(x*100)/100,freeFloat:Math.max(0,Math.round(b*100)/100),isCritical:x<=.01});}return t},calculateSlack:(e,t)=>{let a=Ae.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Ae.calculateCriticalPath(e).includes(t))return 0;let n=Ae.getDependentTasks(e,t);if(n.length===0){let l=Ae.getLatestEndDate(e);if(!l)return null;let d=Ae.calculateDuration(a.endDate,l);return Math.max(0,d)}let s=n.filter(l=>l.startDate).map(l=>l.startDate.getTime()).sort((l,d)=>l-d)[0];if(!s)return null;let o=Ae.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Ae.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Ae.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Ae.getDependentTasks(e,t);if(o.length===0)return e;let l=[...e];for(let d of o){if(n.has(d.id)||!d.startDate||!d.endDate)continue;let i=Ae.calculateDuration(d.startDate,d.endDate),u;if(a!==void 0?(u=new Date(d.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let g=new Date(s.endDate),f=new Date(g);f.setDate(f.getDate()+1),u<f&&(u=f);}let m=Ae.calculateEndDate(u,i),p=g=>g.map(f=>f.id===d.id?{...f,startDate:u,endDate:m}:f.subtasks?{...f,subtasks:p(f.subtasks)}:f);l=p(l),l=Ae.autoScheduleDependents(l,d.id,a,n);}return l},calculateCascadePreview:(e,t,a,r,n,s,o,l)=>{if(a===0)return [];let d=[],i=n.getTime(),u=1e3*60*60*24,m=Ae.findTaskById(e,t);if(!m||!m.endDate)return [];let p=(g,f,x=new Set)=>{if(x.has(g))return;x.add(g);let y=Ae.getDependentTasks(e,g);for(let b of y){if(!b.startDate||!b.endDate)continue;let h=r.findIndex(k=>k.id===b.id);if(h===-1)continue;let v=b.startDate.getTime(),N=(b.endDate.getTime()-v)/u,F=(v-i)/u*s,T=F+f*s,E=Math.max(N*s,s),P=l+h*o+(o-18)/2;d.push({taskId:b.id,taskName:b.name,originalX:F,previewX:T,width:E,y:P,rowIndex:h,daysDelta:f,color:b.color}),p(b.id,f,x);}};return p(t,a),d},splitTask:(e,t,a,r=3)=>{let n=Ae.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.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 o=new Date(a);o.setDate(o.getDate()+r);let l=new Date(n.endDate);l.setDate(l.getDate()+r);let d=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:l}],i=u=>u.map(m=>m.id===n.id?{...m,endDate:l,segments:d}:m.subtasks?{...m,subtasks:i(m.subtasks)}:m);return i(e)}};function Ji({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:l="en",templates:d,dependencyLineStyle:i="curved",showTaskBarLabels:u=true,onTaskClick:m,onTaskDblClick:p,onTaskContextMenu:g,onTaskDateChange:f,onDependencyCreate:x,onDependencyDelete:y,showBaseline:b,showCriticalPath:h=true,showDependencies:v=true,highlightWeekends:w=true,canEditTask:N,onTaskProgressDrag:S,workingDaysConfig:F}){let E=Yr(),P=useRef(null),[k,j]=useState([]),[U,ae]=useState(null),[L,X]=useState(null),[Y,V]=useState(null),R=useRef(false),[J,Ne]=useState(new Set),[$e,z]=useState(null),te=useCallback(B=>{if(Y&&!R.current){let Z=B.target,O=false;for(;Z&&Z!==B.currentTarget;){if(Z.getAttribute?.("data-dependency-line")==="true"||Z.getAttribute?.("data-dependency-hover-overlay")==="true"){O=true;break}Z=Z.parentElement;}O||V(null);}},[Y]),xe=useCallback(B=>{X(B);},[]),Re=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),De=r==="day"?60:r==="week"?20:8,Ee=Re*De*o,Ve=B=>{let Z=new Date(Date.UTC(B.getFullYear(),B.getMonth(),B.getDate())),O=Z.getUTCDay()||7;Z.setUTCDate(Z.getUTCDate()+4-O);let ee=new Date(Date.UTC(Z.getUTCFullYear(),0,1));return Math.ceil(((Z.getTime()-ee.getTime())/864e5+1)/7)},ot=B=>{let Z=B.getDay();return Z===0||Z===6},he=useMemo(()=>{let B=F?.holidayDates;return B?B instanceof Set?B:new Set(B):null},[F?.holidayDates]),Ge=B=>{if(!he)return false;let Z=`${B.getFullYear()}-${String(B.getMonth()+1).padStart(2,"0")}-${String(B.getDate()).padStart(2,"0")}`;return he.has(Z)},je=useCallback(B=>{let Z=Math.round(B/(De*o)),O=new Date(n);return O.setDate(O.getDate()+Z),O},[n,De,o]),He=useCallback((B,Z)=>{if(Z.startDate&&Z.endDate)return;let O=B.currentTarget.ownerSVGElement;if(!O)return;let ee=O.createSVGPoint();ee.x=B.clientX,ee.y=B.clientY;let Ue=ee.matrixTransform(O.getScreenCTM()?.inverse()),Ce=je(Ue.x),Ie=new Date(Ce);Ie.setDate(Ie.getDate()+1),z(null),f?.(Z,Ce,Ie);},[je,f]),Ct=useCallback((B,Z,O)=>{let ee=B.currentTarget.ownerSVGElement;if(!ee)return;let Ue=ee.createSVGPoint();Ue.x=B.clientX,Ue.y=B.clientY;let Ce=Ue.matrixTransform(ee.getScreenCTM()?.inverse()),Ie=je(Ce.x),Pe=Math.round(Ce.x/(De*o))*De*o;z({taskId:Z.id,x:Pe,y:O*a+a/2,date:Ie});},[je,De,o,a]),Dt=useCallback(()=>{z(null);},[]),Je=useMemo(()=>{let B=Ue=>Ue.map(Ce=>{if(Ce.subtasks&&Ce.subtasks.length>0){let Ie=B(Ce.subtasks),Me=Ie.filter(Pe=>Pe.startDate&&Pe.endDate);if(Me.length>0){let Pe=Me.map(pt=>pt.startDate.getTime()),nt=Me.map(pt=>pt.endDate.getTime()),at=new Date(Math.min(...Pe)),dt=new Date(Math.max(...nt));return {...Ce,subtasks:Ie,startDate:at,endDate:dt}}return {...Ce,subtasks:Ie}}return Ce}),Z=(Ue,Ce=[])=>{let Ie=[...Ue].sort((Me,Pe)=>(Me.position??0)-(Pe.position??0));for(let Me of Ie)Ce.push(Me),Me.subtasks&&Me.subtasks.length>0&&(Me.isExpanded===void 0||Me.isExpanded)&&Z(Me.subtasks,Ce);return Ce},O=B(e);return Z(O)},[e]),ze=useCallback(B=>{if(!B.startDate||!B.endDate)return {x:0,width:0};let Z=B.startDate.getTime(),O=B.endDate.getTime(),ee=n.getTime(),Ue=(Z-ee)/(1e3*60*60*24),Ce=(O-Z)/(1e3*60*60*24)+1,Ie=Ue*De*o,Me=Math.max(De*o,40),Pe=Math.max(Ce*De*o,Me);return {x:Ie,width:Pe}},[n,De,o]),lt=useMemo(()=>Je.filter(B=>B.startDate&&B.endDate).map(B=>{let{x:Z,width:O}=ze(B),Ue=Je.findIndex(Ce=>Ce.id===B.id)*a+(a-18)/2;return {id:B.id,x:Z,y:Ue,width:O,height:18}}),[Je,ze]),Lt=useCallback((B,Z,O)=>{if(!O){j([]),ae(null);return}if(ae({taskId:B,daysDelta:Z}),Z===0){j([]);return}let ee=Ae.calculateCascadePreview(e,B,Z,Je,n,De*o,a,48);j(ee);},[e,Je,n,De,o,a,48]),ke=useCallback((B,Z)=>{if(!U)return Z;let O=De*o,ee=U.daysDelta*O;if(B===U.taskId)return {x:Z.x+ee,width:Z.width};let Ue=k.find(Ce=>Ce.taskId===B);return Ue?{x:Ue.previewX,width:Ue.width}:Z},[U,k,De,o]),gt=useMemo(()=>{let B=[],Z=new Date(n);for(;Z<=s;){let Ue=(Z.getTime()-n.getTime())/864e5*De*o;if(r==="day")B.push({date:new Date(Z),label:Z.toLocaleDateString(l,{day:"numeric",month:"short"}),x:Ue}),Z.setDate(Z.getDate()+1);else if(r==="week"){let Ce=Ve(Z);B.push({date:new Date(Z),label:`${E.labels.week} ${Ce}`,x:Ue}),Z.setDate(Z.getDate()+7);}else B.push({date:new Date(Z),label:Z.toLocaleDateString(l,{month:"short",year:"numeric"}),x:Ue}),Z.setMonth(Z.getMonth()+1);}return B},[n,s,r,De,o,l,E.labels.week]),A=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*De*o,[n,De,o]),se=Math.max(Je.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.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Ee,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),gt.map((B,Z)=>jsxs("g",{children:[Z>0&&jsx("line",{x1:B.x,y1:0,x2:B.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:B.x+8,y:48/2,fill:r==="day"&&!ot(B.date)&&Ge(B.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:B.label})]},`header-${Z}`)),A>=0&&A<=Ee&&jsxs("g",{children:[jsx("circle",{cx:A,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:A,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${A-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:E.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:P,width:Math.max(Ee,1e3),height:se,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:te,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("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Ee,1e3),height:se,fill:t.bgPrimary}),Je.map((B,Z)=>jsx("rect",{x:0,y:Z*a,width:Math.max(Ee,1e3),height:a,fill:Z%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${B.id}`)),gt.map((B,Z)=>Z>0?jsx("line",{x1:B.x,y1:0,x2:B.x,y2:Je.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${Z}`):null),gt.map((B,Z)=>{let O=gt[Z+1]?.x||Ee,ee=w&&ot(B.date),Ue=r==="day"&&!ot(B.date)&&Ge(B.date);return ee||Ue?jsxs("g",{children:[jsx("rect",{x:B.x,y:0,width:O-B.x,height:Je.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:B.x,y:0,width:O-B.x,height:Je.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${Z}`):null}),Je.map((B,Z)=>{let O=B.startDate&&B.endDate;return jsx("g",{children:!O&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:Z*a,width:Ee,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:ee=>He(ee,B),onMouseMove:ee=>Ct(ee,B,Z),onMouseLeave:()=>{Dt();}},`clickable-${B.id}`),$e&&$e.taskId===B.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:$e.x,y1:Z*a+4,x2:$e.x,y2:Z*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:$e.x,cy:$e.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:$e.x,cy:$e.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${$e.x}, ${Z*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:$e.date.toLocaleDateString(l==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!$e||$e.taskId!==B.id)&&jsx("text",{x:A>0?A:100,y:Z*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:E.labels.clickToSetDates},`placeholder-${B.id}`)]})},`row-group-${B.id}`)}),Je.map((B,Z)=>{if(!B.startDate||!B.endDate)return null;let{x:O,width:ee}=ze(B),Ue=Z*a+(a-18)/2,Ce=B.subtasks&&B.subtasks.length>0&&!B.isMilestone;if(B.isMilestone)return jsx(Xi,{task:B,x:O+ee/2,y:Ue+12,theme:t,onClick:m},B.id);if(Ce){let Ie=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Me=8,Pe=Ue+(a-18)/2+(18-Me)/2,nt=4,at=B.progress||0,dt=new Date;dt.setHours(0,0,0,0);let pt=B.startDate&&dt>=B.startDate,jt=B.endDate&&(()=>{let rt=new Date(B.endDate);return rt.setHours(0,0,0,0),dt>rt})(),Mt=B.startDate&&dt<B.startDate,zt=1;if(pt&&B.startDate&&B.endDate&&!Mt){let rt=new Date(B.startDate);rt.setHours(0,0,0,0);let ca=new Date(B.endDate);ca.setHours(0,0,0,0);let xa=Math.max(1,(ca.getTime()-rt.getTime())/(1e3*60*60*24)),ie=Math.min((dt.getTime()-rt.getTime())/(1e3*60*60*24),xa)/xa*100;zt=ie>0?at/ie:1;}let mt;at>=100?mt="#00E5CC":Mt?mt="#4B5563":jt&&at<100?mt="#EF4444":zt>=.95?mt="#22C55E":zt>=.8?mt="#F59E0B":mt="#EF4444";let Pt=Math.max(at/100*ee,at>0?nt*2:0),Ut=ee>100&&at>0,_t=B.isCriticalPath;return jsxs("g",{onClick:()=>m?.(B),onContextMenu:rt=>{rt.preventDefault(),rt.stopPropagation(),g?.(B,rt);},onMouseMove:rt=>{xe({task:B,x:O,y:Pe,width:ee,height:Me,showBelow:Pe<100,mouseX:rt.clientX,mouseY:rt.clientY});},onMouseLeave:()=>xe(null),style:{cursor:"default",opacity:h?_t?1:.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:O,y:Ue,width:ee,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:O,y:Pe,width:ee,height:Me,rx:nt,fill:Ie?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)"}),at>0&&jsx("rect",{x:O,y:Pe,width:Pt,height:Me,rx:nt,fill:mt}),h&&_t&&jsx("rect",{x:O,y:Pe,width:ee,height:Me,rx:nt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ut&&jsxs("text",{x:O+Pt+6,y:Pe+Me/2,dominantBaseline:"central",fill:Ie?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(at),"%"]})]},B.id)}return jsx(ji,{task:B,x:O,y:Ue,width:ee,theme:t,dayWidth:De*o,startDate:n,templates:d,onClick:m,onDoubleClick:p,onContextMenu:g,onDateChange:f,onDependencyCreate:x,allTaskPositions:lt,onDragMove:Lt,onHoverChange:xe,showBaseline:b,showTaskBarLabels:u,showCriticalPath:h,readOnly:N?!N(B):false,onProgressChange:S},B.id)}),v&&Je.map((B,Z)=>!B.dependencies||B.dependencies.length===0||!B.startDate||!B.endDate?null:B.dependencies.map(O=>{let ee=Je.find(mt=>mt.id===O);if(!ee||!ee.startDate||!ee.endDate)return null;let Ue=Je.findIndex(mt=>mt.id===O),Ce=ke(ee.id,ze(ee)),Ie=ke(B.id,ze(B)),Me=Ce.x+Ce.width,Pe=Ue*a+26,nt=Ie.x,at=Z*a+26,dt=`dep-${O}-${B.id}`;if(J.has(dt))return null;let pt=h&&B.isCriticalPath&&ee.isCriticalPath;return jsx(zs,{x1:Me,y1:Pe,x2:nt,y2:at,theme:t,lineStyle:i,colorOverride:h?pt?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:h?pt?2:1:void 0,glowFilter:pt?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>y?.(B.id,O),onHoverChange:mt=>{R.current=mt,mt&&V({key:dt,fromId:O,toId:B.id,exitX:Me,exitY:Pe,enterX:nt,enterY:at});}},dt)})),k.map(B=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:B.previewX,y:B.y-48,width:B.width,height:18,rx:6,fill:B.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(B.daysDelta)>0&&jsx("text",{x:B.previewX+B.width/2,y:B.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:B.daysDelta>0?`+${B.daysDelta}d`:`${B.daysDelta}d`})]},`cascade-preview-${B.taskId}`)),v&&Y&&jsx(zs,{x1:Y.exitX,y1:Y.exitY,x2:Y.enterX,y2:Y.enterY,theme:t,lineStyle:i,onDelete:()=>{let B=Y.key;V(null),R.current=false,Ne(Z=>new Set(Z).add(B)),y?.(Y.toId,Y.fromId);},hoverOverlayOnly:true,onHoverChange:B=>{R.current=B,B||V(null);}},`${Y.key}-hover-overlay`),A>=0&&A<=Ee&&jsxs("g",{style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:A,y1:0,x2:A,y2:se,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:A,y1:0,x2:A,y2:se,stroke:t.today,strokeWidth:1,opacity:1})]})]}),L&&jsx(Hm,{tooltipData:L,theme:t,locale:l==="es"?"es":"en",workingDaysConfig:F})]})}var _v=['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"'],Wm=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Kv=()=>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"})}),qv=()=>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"})}),Yv=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Xv=()=>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 el({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:l,onDependencyDelete:d}){let[i,u]=useState(false),[m,p]=useState(false),[g,f]=useState([]),[x,y]=useState(""),[b,h]=useState(false),[v,w]=useState(true),[N,S]=useState(""),[F,T]=useState(-1),[E,P]=useState(false),[k,j]=useState(0),U=useRef(null),ae=useRef(null),L=useRef(null),X=useRef(null),{enabled:Y=true,placeholder:V='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:J,suggestions:Ne=_v,maxHistory:$e=50,persistHistory:z,mentionableUsers:te=[]}=a,xe=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",Re=xe?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",De=xe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Ee=xe?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",Ve=xe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ot=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",he=xe?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ge=xe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",je=xe?"rgba(0, 229, 204, 0.9)":"#00E5CC",He=xe?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",Ct=xe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Dt=xe?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",Je=xe?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",ze=xe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",lt=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Lt=xe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",ke=xe?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",gt=xe?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",A=xe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",se=xe?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",B=xe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Z="rgba(0, 229, 204, 0.04)",O=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ee=xe?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=xe?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",Ce=xe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Ie=xe?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",Me=xe?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Pe=xe?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",nt=xe?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",at="rgba(0, 229, 204, 0.06)",dt=xe?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",pt=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",jt=xe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Mt=xe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",zt=xe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",mt=xe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",Pt=xe?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ut=xe?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",_t=xe?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Wt=xe?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",rt=xe?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ca=xe?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",xa=xe?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",W=xe?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ie=xe?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",st=z?.storageKey||"gantt-ai-history",Kt=z?.maxMessages??5,re=te.filter(H=>{if(!N)return true;let fe=N.toLowerCase();return H.name.toLowerCase().includes(fe)||H.email&&H.email.toLowerCase().includes(fe)}).slice(0,5),ve=useCallback(H=>{if(y(H),te.length===0)return;let fe=U.current;if(!fe)return;let _e=fe.selectionStart||H.length,C=H.slice(0,_e),$=C.lastIndexOf("@");if($>=0&&(($>0?C[$-1]:" ")===" "||$===0)){let K=C.slice($+1);if(K.length<=40){S(K),T($),P(true),j(0);return}}P(false),S(""),T(-1);},[te.length]),Nt=useCallback(H=>{let fe=x.slice(0,F),_e=x.slice(F+1+N.length),C=`${fe}@${H.name} ${_e}`;y(C),P(false),S(""),T(-1),setTimeout(()=>U.current?.focus(),0);},[x,F,N]),ft=useCallback(H=>{if(!E||re.length===0)return false;if(H.key==="ArrowDown")return H.preventDefault(),j(fe=>fe<re.length-1?fe+1:0),true;if(H.key==="ArrowUp")return H.preventDefault(),j(fe=>fe>0?fe-1:re.length-1),true;if(H.key==="Enter"||H.key==="Tab"){H.preventDefault();let fe=re[k];return fe&&Nt(fe),true}return H.key==="Escape"?(P(false),true):false},[E,re,k,Nt]);useEffect(()=>{if(z?.enabled)try{let H=localStorage.getItem(st);if(H){let _e=JSON.parse(H).map(C=>({...C,timestamp:new Date(C.timestamp)}));f(_e.slice(-Kt));}}catch(H){console.warn("[GanttAIAssistant] Failed to load persisted history:",H);}},[z?.enabled,st,Kt]),useEffect(()=>{if(z?.enabled&&g.length>0)try{let H=g.filter(fe=>!fe.isLoading).slice(-Kt);localStorage.setItem(st,JSON.stringify(H));}catch(H){console.warn("[GanttAIAssistant] Failed to persist history:",H);}},[g,z?.enabled,st,Kt]),useEffect(()=>{ae.current&&ae.current.scrollIntoView({behavior:"smooth"});},[g]),useEffect(()=>{i&&!m&&U.current&&setTimeout(()=>U.current?.focus(),100);},[i,m]);let ut=useCallback(H=>{if(H.success)switch(H.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":H.taskId&&H.updates&&n?.(H.taskId,H.updates);break;case "create_task":H.newTask&&s?.(H.newTask);break;case "delete_task":H.taskId&&o?.(H.taskId);break;case "link_tasks":H.dependencyFrom&&H.dependencyTo&&l?.(H.dependencyFrom,H.dependencyTo);break;case "unlink_tasks":H.taskId&&H.dependencyFrom&&d?.(H.taskId,H.dependencyFrom);break}},[n,s,o,l,d]),it=useCallback(async H=>{if(!H.trim()||b)return;let fe={id:`user-${Date.now()}`,role:"user",content:H,timestamp:new Date};f(C=>[...C.slice(-($e-1)),fe]),y(""),w(false),h(true);let _e={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(C=>[...C,_e]);try{if(J){let C=g.filter(pe=>!pe.isLoading&&pe.content).slice(-6).map(pe=>({role:pe.role,content:pe.content})),$=await J(H,e,C);f(pe=>{let K=pe.filter(wt=>!wt.isLoading),Ze={id:`assistant-${Date.now()}`,role:"assistant",content:$.message,timestamp:new Date,command:$};return [...K,Ze]}),ut($);}else f(C=>[...C.filter(pe=>!pe.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(C){f($=>[...$.filter(K=>!K.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${C instanceof Error?C.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[b,$e,J,e,ut]),q=H=>{H.preventDefault(),it(x);},le=H=>{y(H),U.current?.focus();};if(useEffect(()=>{let H=fe=>{(fe.metaKey||fe.ctrlKey)&&fe.key==="k"&&(fe.preventDefault(),u(_e=>!_e),i||p(false)),fe.key==="Escape"&&i&&u(false);};return document.addEventListener("keydown",H),()=>document.removeEventListener("keydown",H)},[i]),useEffect(()=>{if(!i)return;let H=_e=>{let C=_e.target;L.current&&!L.current.contains(C)&&u(false);},fe=setTimeout(()=>{document.addEventListener("mousedown",H);},100);return ()=>{clearTimeout(fe),document.removeEventListener("mousedown",H);}},[i]),!Y)return null;let ge={"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(oa,{children:[jsx(AnimatePresence,{children:!i&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ge[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Re,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${De}`,color:"#00E5CC",cursor:"pointer",boxShadow:Ee,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${Ve}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${ot}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(Wm,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:je,background:he,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ge}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:m?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ce[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:He,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${wt}`,boxShadow:Nt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Je,borderBottom:`1px solid ${ze}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:lt,border:`1px solid ${At}`,color:"#00E5CC"},children:jsx(zm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:Ne},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p($=>!$),className:"p-1.5 rounded-lg transition-colors",style:{color:ft},onMouseEnter:$=>{$.currentTarget.style.background=ie,$.currentTarget.style.color=A;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=ft;},children:jsx(Yv,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:ft},onMouseEnter:$=>{$.currentTarget.style.background=ie,$.currentTarget.style.color=A;},onMouseLeave:$=>{$.currentTarget.style.background="transparent",$.currentTarget.style.color=ft;},children:jsx(qv,{})})]})]}),jsx(AnimatePresence,{children:!m&&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:[g.length===0&&v&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:B,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:Te.slice(0,4).map(($,ne)=>jsx("button",{onClick:()=>fe($),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Z,color:ee,border:`1px solid ${O}`},onMouseEnter:Ke=>{Ke.currentTarget.style.borderColor=Ue,Ke.currentTarget.style.color="#00E5CC";},onMouseLeave:Ke=>{Ke.currentTarget.style.borderColor=O,Ke.currentTarget.style.color=ee;},children:$.length>30?$.slice(0,30)+"...":$},ne))})]}),g.map($=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${$.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${$.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:$.role==="user"?ke:Me,color:$.role==="user"?"#00E5CC":nt,border:$.role==="user"?`1px solid ${Be}`:`1px solid ${Pe}`},children:[$.isLoading?jsx(Xv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:$.content}),$.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:$.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:$.command.success?"#10B981":"#EF4444",border:`1px solid ${$.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[$.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:$.command.type.replace(/_/g," ")})]})]})},$.id)),jsx("div",{ref:ae})]}),jsxs("form",{onSubmit:$=>{if(S&&re.length>0){$.preventDefault();return}q($);},className:"p-3 relative",style:{borderTop:`1px solid ${at}`},children:[jsx(AnimatePresence,{children:S&&re.length>0&&jsx(motion.div,{ref:X,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:Ut,border:`1px solid ${Gt}`,boxShadow:Rt,backdropFilter:"blur(12px)"},children:re.map(($,ne)=>jsxs("button",{type:"button",onClick:()=>Tt($),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:ne===k?rt:"transparent",color:ia},onMouseEnter:()=>j(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:W,border:`1px solid ${le}`,color:"#00E5CC"},children:$.name.split(" ").map(Ke=>Ke[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:$.name}),$.email&&jsx("div",{className:"text-xs truncate",style:{color:fa},children:$.email})]})]},$.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:dt,border:`1px solid ${mt}`},children:[jsx("input",{ref:U,type:"text",value:x,onChange:$=>xe($.target.value),onKeyDown:$=>{bt($);},placeholder:V,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Vt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Mt:"transparent",color:x.trim()?"#00E5CC":gt,border:x.trim()?`1px solid ${zt}`:"1px solid transparent"},children:jsx(Kv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Dt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Um(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,u=true)=>{r(m=>{let p=typeof i=="function"?i(m.present):i;if(n.current)return {...m,present:p};if(!u)return {...m,present:p};let g=[...m.past,m.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),o=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],m=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:m,present:u,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],m=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:m}});},[]),d=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:d}}function Wm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=l?o.metaKey:o.ctrlKey;if(d&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!l&&d&&o.key==="y"){o.preventDefault(),t();return}if(l&&d&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var e2={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ae.formatDate(e.startDate)} - ${Ae.formatDate(e.endDate)}`);let a=Ae.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=>Ae.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function Vm(e){return {...e2,...e}}var l2=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Km=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:d=true,showExportButton:i=true,onExportSuccess:u,projectName:m,availableUsers:p=[],templates:g,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:y,persistColumns:b,clearFiltersKey:h,aiAssistant:v,locale:w="en",customTranslations:N,showCreateTaskButton:D=false,createTaskLabel:F,onCreateTask:T,taskFilter:S,onTaskFilterChange:P,toolbarRightContent:k,showBaseline:j,viewMode:U,onViewModeChange:ae,projectForecast:L,onThemeChange:X,onTaskClick:K,onTaskDblClick:V,onTaskContextMenu:R,onTaskUpdate:J,onDependentTasksScheduled:Te,onProgressChange:$e,onTaskEdit:H,onTaskAddSubtask:te,onTaskMarkIncomplete:ye,onTaskSetInProgress:Re,onDependencyCreate:Se,onDependencyDelete:Ee,onBeforeTaskAdd:Ve,onAfterTaskAdd:ot,onBeforeTaskUpdate:be,onAfterTaskUpdate:Ge,onBeforeTaskDelete:je,onAfterTaskDelete:He,permissions:wt,onCopySnapshotLink:Nt}=a,ze=useContext(Bi)?.theme,[lt,At]=useState(ze||s||"dark"),[Ne,ft]=useState(o),[A,ie]=useState(l),[B,Z]=useState(1),[O,ee]=useState("all"),[Ue,ke]=useState(U||"execution"),Be=U??Ue,Me=useCallback(M=>{ke(M),ae?.(M);},[ae]),Pe=j??Be==="oracle",[nt,at]=useState(a.showCriticalPath!==false),[dt,mt]=useState(a.showDependencies!==false),[Vt,Mt]=useState(a.highlightWeekends!==false),zt=useCallback(M=>{at(M),a.onShowCriticalPathChange?.(M);},[a.onShowCriticalPathChange]),gt=useCallback(M=>{mt(M),a.onShowDependenciesChange?.(M);},[a.onShowDependenciesChange]),Dt=useCallback(M=>{Mt(M),a.onHighlightWeekendsChange?.(M);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(Ne);},[Ne]),useEffect(()=>{a.onZoomChange?.(B);},[B]);let Ut=useRef(a.onDateRangeChange);Ut.current=a.onDateRangeChange;let Gt=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Rt,rt]=useState(()=>{if(!y)return "all";try{let M=typeof y=="string"?y:"gantt-filter-state",I=localStorage.getItem(M);if(I){let G=JSON.parse(I);if(G.taskFilter)return G.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),ia=S??Rt,fa=P??rt,[W,le]=useState(()=>{if(!y)return false;try{let M=typeof y=="string"?y:"gantt-filter-state",I=localStorage.getItem(M);if(I){let G=JSON.parse(I);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=Gt();if(M)try{let I={taskFilter:ia,hideCompleted:W};localStorage.setItem(M,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving filter state to localStorage:",I);}},[ia,W,Gt]);let st=useRef(h);useEffect(()=>{if(st.current!==h&&h!==void 0){rt("all"),le(false);let M=Gt();if(M)try{localStorage.removeItem(M);}catch(I){console.warn("[GanttBoard] Error clearing filter state from localStorage:",I);}}st.current=h;},[h,Gt]);let[jt,re]=useState(0),[xe,Tt]=useState(false),[bt,pt]=useState(null),[it,q]=useState({isOpen:false,x:0,y:0,task:null}),[fe,ce]=useState(null),[$,ne]=useState(null);useEffect(()=>{ze&&ze!==lt&&At(ze);},[ze]),useEffect(()=>{s&&s!==lt&&At(s);},[s]);let Ke=useCallback(M=>{At(M),X?.(M);},[X]),{state:C,setState:z,undo:ve,redo:Y,canUndo:Ze,canRedo:Ct,clearHistory:St}=Um(t,50),Na=useMemo(()=>{let M=(I,G=0)=>{let Q=G;for(let ue of I)ue.subtasks?.length&&(Q=Math.max(Q,M(ue.subtasks,G+1)));return Q};return M(C)+1},[C]),xa=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),Qt=useRef(new Map),ur=useRef(false);if(!ur.current&&x){ur.current=true;let M=typeof x=="string"?x:"gantt-expanded-tasks";try{let I=localStorage.getItem(M);if(I){let G=JSON.parse(I);Array.isArray(G)&&(Qt.current=new Map(G));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let va=useCallback(()=>{let M=xa();if(M)try{let I=Array.from(Qt.current.entries());localStorage.setItem(M,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[xa]),Nr=useRef(0),Sn=useRef(C);useEffect(()=>{Sn.current=C;},[C]);let xo=useRef(false),Po=useCallback(M=>{ee(M),Nr.current+=1,z(I=>{let G=(ue,we=0)=>ue.map(et=>{let tt=M==="all"||we<M-1;return et.subtasks?.length&&Qt.current.set(et.id,tt),{...et,isExpanded:tt,subtasks:et.subtasks?G(et.subtasks,we+1):void 0}}),Q=G(I);return va(),Q});},[z,va]);useEffect(()=>{if(Nr.current>0){Nr.current-=1;return}let M=G=>{let Q=new Map;for(let ue of G){let we=ue.id;Q.get(we)||Q.set(we,ue);}return Array.from(Q.values())},I=G=>G.map(Q=>{let ue=Qt.current.get(Q.id),we=ue!==void 0?{...Q,isExpanded:ue}:Q;if(we.subtasks?.length){let et=M(we.subtasks);return {...we,subtasks:I(et)}}return we});if(Qt.current.size>0)z(Gr(I(t)));else {let G=Q=>Q.map(ue=>ue.subtasks?.length?{...ue,subtasks:M(G(ue.subtasks))}:ue);z(Gr(G(t)));}},[t,z]);let En=useRef(t),ti=useRef(true);useEffect(()=>{if(ti.current){ti.current=false,En.current=C;return}if(xo.current){xo.current=false,En.current=C;return}if(!r)return;let M=JSON.stringify(En.current),I=JSON.stringify(C);M!==I&&(En.current=C,r(C));},[C,r]);let Ja=useMemo(()=>$d(w,N),[w,N]),cs=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Or=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[$r,Fr]=useState(()=>{let M=cs(Ja);if(!b)return M;try{let I=typeof b=="string"?b:"gantt-columns-state",G=localStorage.getItem(I);if(!G)return M;let Q=JSON.parse(G),ue=new Map(Q.map(we=>[we.id,we]));return M.map(we=>{let et=ue.get(we.id);return et?{...we,visible:et.visible??we.visible,width:et.width??we.width}:we})}catch(I){return console.warn("[GanttBoard] Error loading columns state from localStorage:",I),M}}),Mn=useRef(Or);useEffect(()=>{if(Mn.current===Or)return;Mn.current=Or;let M=cs(Ja);if(!Or){Fr(M);return}try{let I=localStorage.getItem(Or);if(!I){Fr(M);return}let G=JSON.parse(I),Q=new Map(G.map(ue=>[ue.id,ue]));Fr(M.map(ue=>{let we=Q.get(ue.id);return we?{...ue,visible:we.visible??ue.visible,width:we.width??ue.width}:ue}));}catch(I){console.warn("[GanttBoard] Error reloading columns state from localStorage:",I),Fr(M);}},[Or,cs,Ja]),useEffect(()=>{if(Or&&Mn.current===Or)try{let M=$r.map(I=>({id:I.id,visible:I.visible,width:I.width}));localStorage.setItem(Or,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving columns state to localStorage:",M);}},[$r,Or]),useEffect(()=>{Fr(M=>M.map(I=>({...I,label:Ja.columns[I.id==="name"?"taskName":I.id]||I.label})));},[Ja]);let Fo=useMemo(()=>$r.filter(I=>I.visible).reduce((I,G)=>I+G.width,0),[$r]),tn=useRef($r.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=$r.filter(Q=>Q.visible),I=M.map(Q=>Q.id).join(","),G=tn.current;if(I!==G){let Q=M.some(we=>we.id!=="name"),ue=G.includes(",");Q?!ue&&Q&&pt(null):pt(null),tn.current=I;}},[$r]);let E=60,oe=.6,he=useMemo(()=>{let I=Fo+E,G=typeof window<"u"?window.innerWidth*oe:800,Q=Math.max(I,G);return bt!==null?Math.max(200,Math.min(bt,Q)):Math.max(200,I)},[bt,Fo]),De=useRef(null),Le=useRef(null),qe=useRef(null),me=useRef(null),_e=useRef(null),Fe=useMemo(()=>sm(lt),[lt]),ut=useMemo(()=>({theme:Fe,themeName:lt}),[Fe,lt]),Kt=useMemo(()=>Vm(g),[g]),Et=useMemo(()=>{if(!f||!nt)return C;let M=Ae.calculateCriticalPathFull(C),I=G=>G.map(Q=>{let ue=M.get(Q.id),we=Q.subtasks?I(Q.subtasks):void 0,et=we?.some(pa=>pa.isCriticalPath||pa.subtasks&&pa.subtasks.some(Zt=>Zt.isCriticalPath))||false,tt=ue?ue.isCritical:et;return {...Q,isCriticalPath:tt,cpmData:ue||void 0,subtasks:we}});return I(C)},[C,f,nt]),Ft=useMemo(()=>Ae.flattenTasks(C).some(I=>I.dependencies&&I.dependencies.length>0),[C]),Ca=useMemo(()=>{let M=(I,G="")=>[...I].sort((ue,we)=>(ue.position??0)-(we.position??0)).map((ue,we)=>{let et=we+1,tt=G?`${G}.${et}`:`${et}.0`,pa=G?`${G}.${et}`:`${et}`;return {...ue,wbsCode:tt,subtasks:ue.subtasks?.length?M(ue.subtasks,pa):ue.subtasks}});return M(Et)},[Et]),La=useMemo(()=>{if(ia==="all"&&!W)return Ca;let M=I=>{let G=[];for(let Q of I){let ue=Q.subtasks?.length?M(Q.subtasks):void 0,we=false;if(W)we=Q.progress<100;else switch(ia){case "all":we=true;break;case "incomplete":we=Q.progress<100;break;case "in_progress":we=Q.progress>0&&Q.progress<100;break;case "completed":we=Q.progress===100;break}(we||ue&&ue.length>0)&&G.push({...Q,subtasks:ue});}return G};return M(Ca)},[Ca,ia,W]),Ia=l2(A);Wm({undo:ve,redo:Y,canUndo:Ze,canRedo:Ct,enabled:true}),useImperativeHandle(n,()=>({getTask:M=>Ae.findTaskById(C,M),addTask:(M,I)=>{z(G=>{if(!I)return [...G,{...M,level:0}];let Q=ue=>ue.map(we=>we.id===I?{...we,subtasks:[...we.subtasks||[],{...M,parentId:I,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(G)});},updateTask:(M,I)=>{z(G=>{let Q=ue=>ue.map(we=>we.id===M?{...we,...I}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(G)});},deleteTask:M=>{z(I=>{let G=Q=>Q.filter(ue=>ue.id===M?false:(ue.subtasks&&(ue.subtasks=G(ue.subtasks)),true));return G(I)});},deleteTasks:M=>{z(I=>Kd(I,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let I=Ae.findTaskById(C,M);I&&a.onTaskDuplicate(I);}else z(I=>As(I,[M]).tasks);},splitTask:(M,I,G=3)=>{z(Q=>Ae.splitTask(Q,M,I,G));},calculateEndDate:Ae.calculateEndDate,calculateDuration:Ae.calculateDuration,validateDependency:(M,I)=>!Ae.validateDependencies(C,M,I),getAllTasks:()=>Ae.flattenTasks(C),getTasksByStatus:M=>Ae.flattenTasks(C).filter(I=>I.status===M),getTasksByParent:M=>M?Ae.findTaskById(C,M)?.subtasks||[]:C.filter(G=>!G.parentId),getCriticalPath:()=>Ae.flattenTasks(C).filter(M=>M.isCriticalPath),indentTask:M=>{z(I=>Gr(Gd(I,[M])));},outdentTask:M=>{z(I=>Gr(jd(I,[M])));},moveTask:(M,I)=>{z(G=>_d(G,[M],I));},createSubtask:async M=>{let{tasks:I,newTask:G}=Xd(C,M);if(Ve){let Q=Ve({...G,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}z(Gr(I)),ot&&ot({...G,parentId:M});},scrollToTask:M=>{let G=Ae.flattenTasks(C).findIndex(Q=>Q.id===M);if(G!==-1&&De.current){let Q=G*Ia;De.current.scrollTo({top:Q,behavior:"smooth"}),qe.current&&qe.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,I=2e3)=>{},expandTask:M=>{z(I=>{let G=Q=>Q.map(ue=>ue.id===M?{...ue,isExpanded:true}:ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue);return G(I)});},collapseTask:M=>{z(I=>{let G=Q=>Q.map(ue=>ue.id===M?{...ue,isExpanded:false}:ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue);return G(I)});},expandAll:()=>{z(M=>{let I=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(M)});},collapseAll:()=>{z(M=>{let I=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(M)});},collapseToLevel:M=>{Po(M);},undo:ve,redo:Y,canUndo:()=>Ze,canRedo:()=>Ct,clearHistory:St,exportToPNG:async()=>{if(!me.current||!De.current||!qe.current)throw new Error("Gantt container not found");let M=me.current,I=De.current,G=Le.current||I.querySelector(".gantt-grid-scroll"),Q=qe.current,ue=G?.scrollTop||0,we=Q.scrollTop,et=M.style.overflow,tt=M.style.height,pa=I.style.overflow;try{let Zt=G?.querySelector(".gantt-taskgrid-content"),ba=Q.querySelector("svg"),pr=Zt?.scrollHeight||G?.scrollHeight||600,Ar=ba?.getBoundingClientRect().height||Q.scrollHeight,rn=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(pr,Ar)+20;G&&(G.scrollTop=0),Q.scrollTop=0,M.style.overflow="visible",M.style.height=`${rn}px`,I.style.overflow="visible",await new Promise(An=>setTimeout(An,100));let io=await toPng(M,{backgroundColor:Fe.bgPrimary,pixelRatio:2,filter:An=>{if(!(An instanceof Element))return !0;let oi=window.getComputedStyle(An),ps=parseInt(oi.zIndex,10);return (isNaN(ps)||ps<50)&&oi.position!=="fixed"}});return await(await fetch(io)).blob()}finally{M.style.overflow=et,M.style.height=tt,I.style.overflow=pa,G&&(G.scrollTop=ue),Q.scrollTop=we;}},exportToPDF:async M=>{await Ae.exportToPDF(C,M);},exportToExcel:async M=>{await Ae.exportToExcel(C,M,Pl.current);},exportToJSON:()=>Ae.exportToJSON(C),exportToCSV:()=>Ae.exportToCSV(C),importFromJSON:M=>{let I=Ae.importFromJSON(M);z(I);},getTasks:()=>C,refresh:()=>{z(M=>[...M]);},clearAll:()=>{z([]);},scrollToToday:()=>{let M=qe.current,I=_e.current;if(!M||!I)return;let Q=(new Date().getTime()-I.startDate.getTime())/(1e3*60*60*24),ue=I.timeScale==="day"?60:I.timeScale==="week"?20:8,we=Q*ue*I.zoom,et=M.clientWidth,tt=Math.max(0,we-et/2);M.scrollTo({left:tt,behavior:"smooth"});}}),[C,ve,Y,Ze,Ct,St,Fe,Ia]);let _t=useCallback(M=>{Fr(I=>I.map(G=>G.id===M?{...G,visible:!G.visible}:G));},[]),na=useCallback((M,I)=>{Fr(G=>G.map(Q=>{if(Q.id!==M)return Q;let ue=Q.minWidth??100,we=Q.maxWidth??800,et=Math.max(ue,Math.min(we,I));return {...Q,width:et}}));},[]),qr=useCallback(M=>{z(I=>{let G=Yd(I,M),Q=ue=>{for(let we of ue){if(we.id===M){Qt.current.set(M,we.isExpanded??true);return}we.subtasks?.length&&Q(we.subtasks);}};return Q(G),va(),G}),a.onTaskToggleExpand?.(M);},[a,va]),Da=useCallback((M,I)=>{if(be&&be(M,I)===false)return;let Q=Ae.findTaskById(C,M)?.progress,ue=et=>et.map(tt=>tt.id===M?{...tt,...I}:tt.subtasks?{...tt,subtasks:ue(tt.subtasks)}:tt);z(et=>ue(et));let we=Ae.findTaskById(ue(C),M);we&&(J?.(we),Ge?.(we),I.progress!==void 0&&Q!==void 0&&I.progress!==Q&&$e?.(M,Q,I.progress));},[C,J,be,Ge,$e]),ai=useCallback((M,I,G)=>{if(M.length===0)return;let Q=new Set(M),ue=we=>we.map(et=>{let tt=Q.has(et.id)?{...et,[I]:G}:et;return tt.subtasks?{...tt,subtasks:ue(tt.subtasks)}:tt});z(we=>{let et=ue(we);return a.onBulkFill?.(M,I,G,et),et});},[a]),ri=useCallback(M=>{M.length!==0&&(Nr.current+=1,xo.current=true,z(I=>Gr(Gd(I,M))),a.onTaskIndent?.(M[0]));},[a]),Dl=useCallback(M=>{M.length!==0&&(Nr.current+=1,xo.current=true,z(I=>Gr(jd(I,M))),a.onTaskOutdent?.(M[0]));},[a]),Ao=useCallback((M,I,G)=>{Nr.current+=1,xo.current=true,z(Q=>Gr(Em(Q,M,I,G))),a.onTaskReparent?.(M,I,G);},[a]),an=useCallback((M,I)=>{M.length!==0&&(Nr.current+=1,xo.current=true,z(G=>_d(G,M,I)),a.onTaskMove?.(M[0],I));},[a]),Sl=useCallback(async M=>{let I=[];for(let G of M)je&&await Promise.resolve(je(G))===false||I.push(G);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):(z(G=>Gr(Kd(G,I))),I.forEach(G=>a.onTaskDelete?.(G))),He&&I.forEach(G=>He(G)));},[a,je,He]),Ef=useCallback(M=>{a.onTaskDuplicate?M.forEach(I=>{let G=Ae.findTaskById(C,I);G&&a.onTaskDuplicate(G);}):z(I=>As(I,M).tasks);},[a,C]),Mf=useCallback((M,I)=>{z(G=>{let{tasks:Q,newTask:ue}=Sm(G,M,I);return Ve&&Ve(ue)===false?G:(a.onTaskCreate?.(ue.parentId,ue.position||0),ot?.(ue),Q)});},[a,Ve,ot]),Pf=useCallback((M,I)=>{z(G=>qd(G,M,I)),a.onTaskRename?.(M,I);},[a]),El=useCallback(M=>{let{onTaskAddSubtask:I}=a;if(I){let G=qn(C,M);if(G){I(G);return}}z(G=>{let{tasks:Q}=Xd(G,M);return a.onTaskCreate?.(M,0),Q});},[a,C]),Ff=useCallback((M,I)=>{let G=Math.max(0,Math.min(100,Math.round(I))),Q={progress:G};G===100?Q.status="completed":G>0?Q.status="in-progress":Q.status="todo",Da(M.id,Q);},[Da]),Af=useCallback((M,I,G)=>{let Q=!M.startDate&&!M.endDate,ue=M.startDate?Math.round((I.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,we=Zt=>Zt.map(ba=>ba.id===M.id?{...ba,startDate:I,endDate:G,...M.segments&&{segments:M.segments}}:ba.subtasks?{...ba,subtasks:we(ba.subtasks)}:ba),et=we(C),tt=et;et=Ae.autoScheduleDependents(et,M.id,ue),et=Gr(et),z(et);let pa={...M,startDate:I,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(M,I,G):J?.(pa),Te&&ue!==0){let Zt=Ae.flattenTasks(tt),ba=Ae.flattenTasks(et),pr=[];for(let Ar of ba){if(Ar.id===M.id)continue;let Lo=Zt.find(io=>io.id===Ar.id);if(!Lo)continue;let Fn=Ar.startDate?.getTime()!==Lo.startDate?.getTime(),rn=Ar.endDate?.getTime()!==Lo.endDate?.getTime();(Fn||rn)&&pr.push(Ar);}pr.length>0&&Te(pr);}},[C,J,Te,a]),Lf=useCallback((M,I)=>{R?.(M,I),q({isOpen:true,x:I.clientX,y:I.clientY,task:M});},[R]),If=useCallback((M,I)=>{let G=Ae.splitTask(C,M.id,I);z(G),q({isOpen:false,x:0,y:0,task:null});},[C]),pu=useCallback(M=>{let I=Ae.findTaskById(C,M.id)||M;V?.(I),H||ce(I);},[C,V,H]),mu=useCallback((M,I,G)=>{let Q=new Map,ue=Zt=>{Zt.forEach(ba=>{ba.dependencies&&Q.set(ba.id,ba.dependencies),ba.subtasks&&ue(ba.subtasks);});};ue(G);let we=Q.get(I)||[];Q.set(I,[...we,M]);let et=new Set,tt=new Set,pa=Zt=>{if(!et.has(Zt)){et.add(Zt),tt.add(Zt);let ba=Q.get(Zt)||[];for(let pr of ba){if(!et.has(pr)&&pa(pr))return true;if(tt.has(pr))return true}}return tt.delete(Zt),false};return pa(I)},[]),gu=useCallback((M,I)=>{if(mu(M.id,I,Sn.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:L,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:m?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ge[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:He,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${Ct}`,boxShadow:Dt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Je,borderBottom:`1px solid ${ze}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:lt,border:`1px solid ${Lt}`,color:"#00E5CC"},children:jsx(Wm,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:ke},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>p(H=>!H),className:"p-1.5 rounded-lg transition-colors",style:{color:gt},onMouseEnter:H=>{H.currentTarget.style.background=se,H.currentTarget.style.color=A;},onMouseLeave:H=>{H.currentTarget.style.background="transparent",H.currentTarget.style.color=gt;},children:jsx(Yv,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:gt},onMouseEnter:H=>{H.currentTarget.style.background=se,H.currentTarget.style.color=A;},onMouseLeave:H=>{H.currentTarget.style.background="transparent",H.currentTarget.style.color=gt;},children:jsx(qv,{})})]})]}),jsx(AnimatePresence,{children:!m&&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:[g.length===0&&v&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:B,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:Ne.slice(0,4).map((H,fe)=>jsx("button",{onClick:()=>le(H),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Z,color:ee,border:`1px solid ${O}`},onMouseEnter:_e=>{_e.currentTarget.style.borderColor=Ue,_e.currentTarget.style.color="#00E5CC";},onMouseLeave:_e=>{_e.currentTarget.style.borderColor=O,_e.currentTarget.style.color=ee;},children:H.length>30?H.slice(0,30)+"...":H},fe))})]}),g.map(H=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${H.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${H.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:H.role==="user"?Ce:Me,color:H.role==="user"?"#00E5CC":nt,border:H.role==="user"?`1px solid ${Ie}`:`1px solid ${Pe}`},children:[H.isLoading?jsx(Xv,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:H.content}),H.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:H.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:H.command.success?"#10B981":"#EF4444",border:`1px solid ${H.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[H.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:H.command.type.replace(/_/g," ")})]})]})},H.id)),jsx("div",{ref:ae})]}),jsxs("form",{onSubmit:H=>{if(E&&re.length>0){H.preventDefault();return}q(H);},className:"p-3 relative",style:{borderTop:`1px solid ${at}`},children:[jsx(AnimatePresence,{children:E&&re.length>0&&jsx(motion.div,{ref:X,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:Ut,border:`1px solid ${_t}`,boxShadow:Wt,backdropFilter:"blur(12px)"},children:re.map((H,fe)=>jsxs("button",{type:"button",onClick:()=>Nt(H),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:fe===k?rt:"transparent",color:ca},onMouseEnter:()=>j(fe),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:W,border:`1px solid ${ie}`,color:"#00E5CC"},children:H.name.split(" ").map(_e=>_e[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:H.name}),H.email&&jsx("div",{className:"text-xs truncate",style:{color:xa},children:H.email})]})]},H.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:dt,border:`1px solid ${pt}`},children:[jsx("input",{ref:U,type:"text",value:x,onChange:H=>ve(H.target.value),onKeyDown:H=>{ft(H);},placeholder:V,disabled:b,className:"flex-1 bg-transparent text-sm outline-none",style:{color:jt,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!x.trim()||b,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:x.trim()?Mt:"transparent",color:x.trim()?"#00E5CC":mt,border:x.trim()?`1px solid ${zt}`:"1px solid transparent"},children:jsx(Kv,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:Pt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function Vm(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((i,u=true)=>{r(m=>{let p=typeof i=="function"?i(m.present):i;if(n.current)return {...m,present:p};if(!u)return {...m,present:p};let g=[...m.past,m.present];return g.length>t&&g.shift(),{past:g,present:p,future:[]}});},[t]),o=useCallback(()=>{r(i=>{if(i.past.length===0)return i;let u=i.past[i.past.length-1],m=i.past.slice(0,i.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:m,present:u,future:[i.present,...i.future]}});},[]),l=useCallback(()=>{r(i=>{if(i.future.length===0)return i;let u=i.future[0],m=i.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...i.past,i.present],present:u,future:m}});},[]),d=useCallback(()=>{r(i=>({past:[],present:i.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:l,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:d}}function Gm({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let l=navigator.platform.toUpperCase().indexOf("MAC")>=0,d=l?o.metaKey:o.ctrlKey;if(d&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!l&&d&&o.key==="y"){o.preventDefault(),t();return}if(l&&d&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var e2={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Ae.formatDate(e.startDate)} - ${Ae.formatDate(e.endDate)}`);let a=Ae.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=>Ae.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function jm(e){return {...e2,...e}}var l2=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Ym=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:l="comfortable",showThemeSelector:d=true,showExportButton:i=true,onExportSuccess:u,projectName:m,availableUsers:p=[],templates:g,enableAutoCriticalPath:f=true,persistExpandedState:x,persistFilter:y,persistColumns:b,clearFiltersKey:h,aiAssistant:v,locale:w="en",customTranslations:N,showCreateTaskButton:S=false,createTaskLabel:F,onCreateTask:T,taskFilter:E,onTaskFilterChange:P,toolbarRightContent:k,showBaseline:j,viewMode:U,onViewModeChange:ae,projectForecast:L,onThemeChange:X,onTaskClick:Y,onTaskDblClick:V,onTaskContextMenu:R,onTaskUpdate:J,onDependentTasksScheduled:Ne,onProgressChange:$e,onTaskEdit:z,onTaskAddSubtask:te,onTaskMarkIncomplete:xe,onTaskSetInProgress:Re,onDependencyCreate:De,onDependencyDelete:Ee,onBeforeTaskAdd:Ve,onAfterTaskAdd:ot,onBeforeTaskUpdate:he,onAfterTaskUpdate:Ge,onBeforeTaskDelete:je,onAfterTaskDelete:He,permissions:Ct,onCopySnapshotLink:Dt}=a,ze=useContext(Hi)?.theme,[lt,Lt]=useState(ze||s||"dark"),[ke,gt]=useState(o),[A,se]=useState(l),[B,Z]=useState(1),[O,ee]=useState("all"),[Ue,Ce]=useState(U||"execution"),Ie=U??Ue,Me=useCallback(M=>{Ce(M),ae?.(M);},[ae]),Pe=j??Ie==="oracle",[nt,at]=useState(a.showCriticalPath!==false),[dt,pt]=useState(a.showDependencies!==false),[jt,Mt]=useState(a.highlightWeekends!==false),zt=useCallback(M=>{at(M),a.onShowCriticalPathChange?.(M);},[a.onShowCriticalPathChange]),mt=useCallback(M=>{pt(M),a.onShowDependenciesChange?.(M);},[a.onShowDependenciesChange]),Pt=useCallback(M=>{Mt(M),a.onHighlightWeekendsChange?.(M);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(ke);},[ke]),useEffect(()=>{a.onZoomChange?.(B);},[B]);let Ut=useRef(a.onDateRangeChange);Ut.current=a.onDateRangeChange;let _t=useCallback(()=>y?typeof y=="string"?y:"gantt-filter-state":null,[y]),[Wt,rt]=useState(()=>{if(!y)return "all";try{let M=typeof y=="string"?y:"gantt-filter-state",I=localStorage.getItem(M);if(I){let G=JSON.parse(I);if(G.taskFilter)return G.taskFilter}}catch(M){console.warn("[GanttBoard] Error loading filter state from localStorage:",M);}return "all"}),ca=E??Wt,xa=P??rt,[W,ie]=useState(()=>{if(!y)return false;try{let M=typeof y=="string"?y:"gantt-filter-state",I=localStorage.getItem(M);if(I){let G=JSON.parse(I);if(typeof G.hideCompleted=="boolean")return G.hideCompleted}}catch(M){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",M);}return false});useEffect(()=>{let M=_t();if(M)try{let I={taskFilter:ca,hideCompleted:W};localStorage.setItem(M,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving filter state to localStorage:",I);}},[ca,W,_t]);let st=useRef(h);useEffect(()=>{if(st.current!==h&&h!==void 0){rt("all"),ie(false);let M=_t();if(M)try{localStorage.removeItem(M);}catch(I){console.warn("[GanttBoard] Error clearing filter state from localStorage:",I);}}st.current=h;},[h,_t]);let[Kt,re]=useState(0),[ve,Nt]=useState(false),[ft,ut]=useState(null),[it,q]=useState({isOpen:false,x:0,y:0,task:null}),[le,ge]=useState(null),[H,fe]=useState(null);useEffect(()=>{ze&&ze!==lt&&Lt(ze);},[ze]),useEffect(()=>{s&&s!==lt&&Lt(s);},[s]);let _e=useCallback(M=>{Lt(M),X?.(M);},[X]),{state:C,setState:$,undo:pe,redo:K,canUndo:Ze,canRedo:wt,clearHistory:kt}=Vm(t,50),Zt=useMemo(()=>{let M=(I,G=0)=>{let Q=G;for(let ce of I)ce.subtasks?.length&&(Q=Math.max(Q,M(ce.subtasks,G+1)));return Q};return M(C)+1},[C]),ea=useCallback(()=>x?typeof x=="string"?x:"gantt-expanded-tasks":null,[x]),qt=useRef(new Map),cr=useRef(false);if(!cr.current&&x){cr.current=true;let M=typeof x=="string"?x:"gantt-expanded-tasks";try{let I=localStorage.getItem(M);if(I){let G=JSON.parse(I);Array.isArray(G)&&(qt.current=new Map(G));}}catch(I){console.warn("[GanttBoard] Error loading expanded state from localStorage:",I);}}let Ca=useCallback(()=>{let M=ea();if(M)try{let I=Array.from(qt.current.entries());localStorage.setItem(M,JSON.stringify(I));}catch(I){console.warn("[GanttBoard] Error saving expanded state to localStorage:",I);}},[ea]),Fr=useRef(0),An=useRef(C);useEffect(()=>{An.current=C;},[C]);let To=useRef(false),Ro=useCallback(M=>{ee(M),Fr.current+=1,$(I=>{let G=(ce,we=0)=>ce.map(et=>{let tt=M==="all"||we<M-1;return et.subtasks?.length&&qt.current.set(et.id,tt),{...et,isExpanded:tt,subtasks:et.subtasks?G(et.subtasks,we+1):void 0}}),Q=G(I);return Ca(),Q});},[$,Ca]);useEffect(()=>{if(Fr.current>0){Fr.current-=1;return}let M=G=>{let Q=new Map;for(let ce of G){let we=ce.id;Q.get(we)||Q.set(we,ce);}return Array.from(Q.values())},I=G=>G.map(Q=>{let ce=qt.current.get(Q.id),we=ce!==void 0?{...Q,isExpanded:ce}:Q;if(we.subtasks?.length){let et=M(we.subtasks);return {...we,subtasks:I(et)}}return we});if(qt.current.size>0)$(Xr(I(t)));else {let G=Q=>Q.map(ce=>ce.subtasks?.length?{...ce,subtasks:M(G(ce.subtasks))}:ce);$(Xr(G(t)));}},[t,$]);let Ln=useRef(t),ii=useRef(true);useEffect(()=>{if(ii.current){ii.current=false,Ln.current=C;return}if(To.current){To.current=false,Ln.current=C;return}if(!r)return;let M=JSON.stringify(Ln.current),I=JSON.stringify(C);M!==I&&(Ln.current=C,r(C));},[C,r]);let Za=useMemo(()=>zd(w,N),[w,N]),fs=useCallback(M=>[{id:"name",label:M.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:M.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:M.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:M.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:M.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:M.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:M.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:M.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),Vr=useMemo(()=>b?typeof b=="string"?b:"gantt-columns-state":null,[b]),[Gr,Or]=useState(()=>{let M=fs(Za);if(!b)return M;try{let I=typeof b=="string"?b:"gantt-columns-state",G=localStorage.getItem(I);if(!G)return M;let Q=JSON.parse(G),ce=new Map(Q.map(we=>[we.id,we]));return M.map(we=>{let et=ce.get(we.id);return et?{...we,visible:et.visible??we.visible,width:et.width??we.width}:we})}catch(I){return console.warn("[GanttBoard] Error loading columns state from localStorage:",I),M}}),In=useRef(Vr);useEffect(()=>{if(In.current===Vr)return;In.current=Vr;let M=fs(Za);if(!Vr){Or(M);return}try{let I=localStorage.getItem(Vr);if(!I){Or(M);return}let G=JSON.parse(I),Q=new Map(G.map(ce=>[ce.id,ce]));Or(M.map(ce=>{let we=Q.get(ce.id);return we?{...ce,visible:we.visible??ce.visible,width:we.width??ce.width}:ce}));}catch(I){console.warn("[GanttBoard] Error reloading columns state from localStorage:",I),Or(M);}},[Vr,fs,Za]),useEffect(()=>{if(Vr&&In.current===Vr)try{let M=Gr.map(I=>({id:I.id,visible:I.visible,width:I.width}));localStorage.setItem(Vr,JSON.stringify(M));}catch(M){console.warn("[GanttBoard] Error saving columns state to localStorage:",M);}},[Gr,Vr]),useEffect(()=>{Or(M=>M.map(I=>({...I,label:Za.columns[I.id==="name"?"taskName":I.id]||I.label})));},[Za]);let Oo=useMemo(()=>Gr.filter(I=>I.visible).reduce((I,G)=>I+G.width,0),[Gr]),sn=useRef(Gr.filter(M=>M.visible).map(M=>M.id).join(","));useEffect(()=>{let M=Gr.filter(Q=>Q.visible),I=M.map(Q=>Q.id).join(","),G=sn.current;if(I!==G){let Q=M.some(we=>we.id!=="name"),ce=G.includes(",");Q?!ce&&Q&&ut(null):ut(null),sn.current=I;}},[Gr]);let D=60,oe=.6,ye=useMemo(()=>{let I=Oo+D,G=typeof window<"u"?window.innerWidth*oe:800,Q=Math.max(I,G);return ft!==null?Math.max(200,Math.min(ft,Q)):Math.max(200,I)},[ft,Oo]),Se=useRef(null),Fe=useRef(null),qe=useRef(null),me=useRef(null),Ke=useRef(null),Be=useMemo(()=>lm(lt),[lt]),yt=useMemo(()=>({theme:Be,themeName:lt}),[Be,lt]),ta=useMemo(()=>jm(g),[g]),St=useMemo(()=>{if(!f||!nt)return C;let M=Ae.calculateCriticalPathFull(C),I=G=>G.map(Q=>{let ce=M.get(Q.id),we=Q.subtasks?I(Q.subtasks):void 0,et=we?.some(ba=>ba.isCriticalPath||ba.subtasks&&ba.subtasks.some(ra=>ra.isCriticalPath))||false,tt=ce?ce.isCritical:et;return {...Q,isCriticalPath:tt,cpmData:ce||void 0,subtasks:we}});return I(C)},[C,f,nt]),Et=useMemo(()=>Ae.flattenTasks(C).some(I=>I.dependencies&&I.dependencies.length>0),[C]),Ta=useMemo(()=>{let M=(I,G="")=>[...I].sort((ce,we)=>(ce.position??0)-(we.position??0)).map((ce,we)=>{let et=we+1,tt=G?`${G}.${et}`:`${et}.0`,ba=G?`${G}.${et}`:`${et}`;return {...ce,wbsCode:tt,subtasks:ce.subtasks?.length?M(ce.subtasks,ba):ce.subtasks}});return M(St)},[St]),Ea=useMemo(()=>{if(ca==="all"&&!W)return Ta;let M=I=>{let G=[];for(let Q of I){let ce=Q.subtasks?.length?M(Q.subtasks):void 0,we=false;if(W)we=Q.progress<100;else switch(ca){case "all":we=true;break;case "incomplete":we=Q.progress<100;break;case "in_progress":we=Q.progress>0&&Q.progress<100;break;case "completed":we=Q.progress===100;break}(we||ce&&ce.length>0)&&G.push({...Q,subtasks:ce});}return G};return M(Ta)},[Ta,ca,W]),Ya=l2(A);Gm({undo:pe,redo:K,canUndo:Ze,canRedo:wt,enabled:true}),useImperativeHandle(n,()=>({getTask:M=>Ae.findTaskById(C,M),addTask:(M,I)=>{$(G=>{if(!I)return [...G,{...M,level:0}];let Q=ce=>ce.map(we=>we.id===I?{...we,subtasks:[...we.subtasks||[],{...M,parentId:I,level:(we.level||0)+1}],isExpanded:true}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(G)});},updateTask:(M,I)=>{$(G=>{let Q=ce=>ce.map(we=>we.id===M?{...we,...I}:we.subtasks?{...we,subtasks:Q(we.subtasks)}:we);return Q(G)});},deleteTask:M=>{$(I=>{let G=Q=>Q.filter(ce=>ce.id===M?false:(ce.subtasks&&(ce.subtasks=G(ce.subtasks)),true));return G(I)});},deleteTasks:M=>{$(I=>Yd(I,M));},duplicateTask:M=>{if(a.onTaskDuplicate){let I=Ae.findTaskById(C,M);I&&a.onTaskDuplicate(I);}else $(I=>$s(I,[M]).tasks);},splitTask:(M,I,G=3)=>{$(Q=>Ae.splitTask(Q,M,I,G));},calculateEndDate:Ae.calculateEndDate,calculateDuration:Ae.calculateDuration,validateDependency:(M,I)=>!Ae.validateDependencies(C,M,I),getAllTasks:()=>Ae.flattenTasks(C),getTasksByStatus:M=>Ae.flattenTasks(C).filter(I=>I.status===M),getTasksByParent:M=>M?Ae.findTaskById(C,M)?.subtasks||[]:C.filter(G=>!G.parentId),getCriticalPath:()=>Ae.flattenTasks(C).filter(M=>M.isCriticalPath),indentTask:M=>{$(I=>Xr(_d(I,[M])));},outdentTask:M=>{$(I=>Xr(Kd(I,[M])));},moveTask:(M,I)=>{$(G=>qd(G,[M],I));},createSubtask:async M=>{let{tasks:I,newTask:G}=Qd(C,M);if(Ve){let Q=Ve({...G,parentId:M});if((Q instanceof Promise?await Q:Q)===false)return}$(Xr(I)),ot&&ot({...G,parentId:M});},scrollToTask:M=>{let G=Ae.flattenTasks(C).findIndex(Q=>Q.id===M);if(G!==-1&&Se.current){let Q=G*Ya;Se.current.scrollTo({top:Q,behavior:"smooth"}),qe.current&&qe.current.scrollTo({top:Q,behavior:"smooth"});}},highlightTask:(M,I=2e3)=>{},expandTask:M=>{$(I=>{let G=Q=>Q.map(ce=>ce.id===M?{...ce,isExpanded:true}:ce.subtasks?{...ce,subtasks:G(ce.subtasks)}:ce);return G(I)});},collapseTask:M=>{$(I=>{let G=Q=>Q.map(ce=>ce.id===M?{...ce,isExpanded:false}:ce.subtasks?{...ce,subtasks:G(ce.subtasks)}:ce);return G(I)});},expandAll:()=>{$(M=>{let I=G=>G.map(Q=>({...Q,isExpanded:true,subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(M)});},collapseAll:()=>{$(M=>{let I=G=>G.map(Q=>({...Q,isExpanded:false,subtasks:Q.subtasks?I(Q.subtasks):void 0}));return I(M)});},collapseToLevel:M=>{Ro(M);},undo:pe,redo:K,canUndo:()=>Ze,canRedo:()=>wt,clearHistory:kt,exportToPNG:async()=>{if(!me.current||!Se.current||!qe.current)throw new Error("Gantt container not found");let M=me.current,I=Se.current,G=Fe.current||I.querySelector(".gantt-grid-scroll"),Q=qe.current,ce=G?.scrollTop||0,we=Q.scrollTop,et=M.style.overflow,tt=M.style.height,ba=I.style.overflow;try{let ra=G?.querySelector(".gantt-taskgrid-content"),va=Q.querySelector("svg"),br=ra?.scrollHeight||G?.scrollHeight||600,$r=va?.getBoundingClientRect().height||Q.scrollHeight,dn=(M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(br,$r)+20;G&&(G.scrollTop=0),Q.scrollTop=0,M.style.overflow="visible",M.style.height=`${dn}px`,I.style.overflow="visible",await new Promise(On=>setTimeout(On,100));let mo=await toPng(M,{backgroundColor:Be.bgPrimary,pixelRatio:2,filter:On=>{if(!(On instanceof Element))return !0;let li=window.getComputedStyle(On),ys=parseInt(li.zIndex,10);return (isNaN(ys)||ys<50)&&li.position!=="fixed"}});return await(await fetch(mo)).blob()}finally{M.style.overflow=et,M.style.height=tt,I.style.overflow=ba,G&&(G.scrollTop=ce),Q.scrollTop=we;}},exportToPDF:async M=>{await Ae.exportToPDF(C,M);},exportToExcel:async M=>{await Ae.exportToExcel(C,M,Al.current);},exportToJSON:()=>Ae.exportToJSON(C),exportToCSV:()=>Ae.exportToCSV(C),importFromJSON:M=>{let I=Ae.importFromJSON(M);$(I);},getTasks:()=>C,refresh:()=>{$(M=>[...M]);},clearAll:()=>{$([]);},scrollToToday:()=>{let M=qe.current,I=Ke.current;if(!M||!I)return;let Q=(new Date().getTime()-I.startDate.getTime())/(1e3*60*60*24),ce=I.timeScale==="day"?60:I.timeScale==="week"?20:8,we=Q*ce*I.zoom,et=M.clientWidth,tt=Math.max(0,we-et/2);M.scrollTo({left:tt,behavior:"smooth"});}}),[C,pe,K,Ze,wt,kt,Be,Ya]);let aa=useCallback(M=>{Or(I=>I.map(G=>G.id===M?{...G,visible:!G.visible}:G));},[]),pa=useCallback((M,I)=>{Or(G=>G.map(Q=>{if(Q.id!==M)return Q;let ce=Q.minWidth??100,we=Q.maxWidth??800,et=Math.max(ce,Math.min(we,I));return {...Q,width:et}}));},[]),Vt=useCallback(M=>{$(I=>{let G=Jd(I,M),Q=ce=>{for(let we of ce){if(we.id===M){qt.current.set(M,we.isExpanded??true);return}we.subtasks?.length&&Q(we.subtasks);}};return Q(G),Ca(),G}),a.onTaskToggleExpand?.(M);},[a,Ca]),At=useCallback((M,I)=>{if(he&&he(M,I)===false)return;let Q=Ae.findTaskById(C,M)?.progress,ce=et=>et.map(tt=>tt.id===M?{...tt,...I}:tt.subtasks?{...tt,subtasks:ce(tt.subtasks)}:tt);$(et=>ce(et));let we=Ae.findTaskById(ce(C),M);we&&(J?.(we),Ge?.(we),I.progress!==void 0&&Q!==void 0&&I.progress!==Q&&$e?.(M,Q,I.progress));},[C,J,he,Ge,$e]),za=useCallback((M,I,G)=>{if(M.length===0)return;let Q=new Set(M),ce=we=>we.map(et=>{let tt=Q.has(et.id)?{...et,[I]:G}:et;return tt.subtasks?{...tt,subtasks:ce(tt.subtasks)}:tt});$(we=>{let et=ce(we);return a.onBulkFill?.(M,I,G,et),et});},[a]),hr=useCallback(M=>{M.length!==0&&(Fr.current+=1,To.current=true,$(I=>Xr(_d(I,M))),a.onTaskIndent?.(M[0]));},[a]),kr=useCallback(M=>{M.length!==0&&(Fr.current+=1,To.current=true,$(I=>Xr(Kd(I,M))),a.onTaskOutdent?.(M[0]));},[a]),fr=useCallback((M,I,G)=>{Fr.current+=1,To.current=true,$(Q=>Xr(Pm(Q,M,I,G))),a.onTaskReparent?.(M,I,G);},[a]),er=useCallback((M,I)=>{M.length!==0&&(Fr.current+=1,To.current=true,$(G=>qd(G,M,I)),a.onTaskMove?.(M[0],I));},[a]),No=useCallback(async M=>{let I=[];for(let G of M)je&&await Promise.resolve(je(G))===false||I.push(G);I.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(I):($(G=>Xr(Yd(G,I))),I.forEach(G=>a.onTaskDelete?.(G))),He&&I.forEach(G=>He(G)));},[a,je,He]),bs=useCallback(M=>{a.onTaskDuplicate?M.forEach(I=>{let G=Ae.findTaskById(C,I);G&&a.onTaskDuplicate(G);}):$(I=>$s(I,M).tasks);},[a,C]),ln=useCallback((M,I)=>{$(G=>{let{tasks:Q,newTask:ce}=Mm(G,M,I);return Ve&&Ve(ce)===false?G:(a.onTaskCreate?.(ce.parentId,ce.position||0),ot?.(ce),Q)});},[a,Ve,ot]),Pf=useCallback((M,I)=>{$(G=>Xd(G,M,I)),a.onTaskRename?.(M,I);},[a]),Pl=useCallback(M=>{let{onTaskAddSubtask:I}=a;if(I){let G=Zn(C,M);if(G){I(G);return}}$(G=>{let{tasks:Q}=Qd(G,M);return a.onTaskCreate?.(M,0),Q});},[a,C]),Ff=useCallback((M,I)=>{let G=Math.max(0,Math.min(100,Math.round(I))),Q={progress:G};G===100?Q.status="completed":G>0?Q.status="in-progress":Q.status="todo",At(M.id,Q);},[At]),Af=useCallback((M,I,G)=>{let Q=!M.startDate&&!M.endDate,ce=M.startDate?Math.round((I.getTime()-M.startDate.getTime())/(1e3*60*60*24)):0,we=ra=>ra.map(va=>va.id===M.id?{...va,startDate:I,endDate:G,...M.segments&&{segments:M.segments}}:va.subtasks?{...va,subtasks:we(va.subtasks)}:va),et=we(C),tt=et;et=Ae.autoScheduleDependents(et,M.id,ce),et=Xr(et),$(et);let ba={...M,startDate:I,endDate:G};if(Q&&a?.onTaskDateChange?a.onTaskDateChange(M,I,G):J?.(ba),Ne&&ce!==0){let ra=Ae.flattenTasks(tt),va=Ae.flattenTasks(et),br=[];for(let $r of va){if($r.id===M.id)continue;let $o=ra.find(mo=>mo.id===$r.id);if(!$o)continue;let Rn=$r.startDate?.getTime()!==$o.startDate?.getTime(),dn=$r.endDate?.getTime()!==$o.endDate?.getTime();(Rn||dn)&&br.push($r);}br.length>0&&Ne(br);}},[C,J,Ne,a]),Lf=useCallback((M,I)=>{R?.(M,I),q({isOpen:true,x:I.clientX,y:I.clientY,task:M});},[R]),If=useCallback((M,I)=>{let G=Ae.splitTask(C,M.id,I);$(G),q({isOpen:false,x:0,y:0,task:null});},[C]),gu=useCallback(M=>{let I=Ae.findTaskById(C,M.id)||M;V?.(I),z||ge(I);},[C,V,z]),fu=useCallback((M,I,G)=>{let Q=new Map,ce=ra=>{ra.forEach(va=>{va.dependencies&&Q.set(va.id,va.dependencies),va.subtasks&&ce(va.subtasks);});};ce(G);let we=Q.get(I)||[];Q.set(I,[...we,M]);let et=new Set,tt=new Set,ba=ra=>{if(!et.has(ra)){et.add(ra),tt.add(ra);let va=Q.get(ra)||[];for(let br of va){if(!et.has(br)&&ba(br))return true;if(tt.has(br))return true}}return tt.delete(ra),false};return ba(I)},[]),bu=useCallback((M,I)=>{if(fu(M.id,I,An.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let G=Q=>Q.map(ue=>{if(ue.id===I){let we=ue.dependencies||[];if(!we.includes(M.id))return {...ue,dependencies:[...we,M.id]}}return ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue});Nr.current+=1,z(Q=>G(Q)),Se?.(M.id,I);},[Se,mu]),fu=useCallback((M,I)=>{let G=Q=>Q.map(ue=>{if(ue.id===M&&ue.dependencies){let we=ue.dependencies.filter(et=>et!==I);return {...ue,dependencies:we}}return ue.subtasks?{...ue,subtasks:G(ue.subtasks)}:ue});Nr.current+=1,z(Q=>G(Q)),Ee?.(M,I);},[Ee]),{startDate:vo,endDate:Ml}=useMemo(()=>{let M=C.filter(we=>we.startDate&&we.endDate);if(M.length===0){let we=new Date,et=new Date(we);et.setDate(et.getDate()-30);let tt=new Date(we);return tt.setDate(tt.getDate()+60),{startDate:et,endDate:tt}}let I=M.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),G=new Date(Math.min(...I.map(we=>we.getTime()))),Q=new Date(Math.max(...I.map(we=>we.getTime()))),ue=Ne==="day"?7:Ne==="week"?14:30;return G.setDate(G.getDate()-ue),Q.setDate(Q.getDate()+ue),{startDate:G,endDate:Q}},[C,Ne]);useEffect(()=>{Ut.current?.(vo,Ml);},[vo,Ml]);let Bf=useCallback(async()=>{if(!me.current||!De.current||!qe.current)return;await new Promise(rn=>setTimeout(rn,200));let M=me.current,I=De.current,G=Le.current||I.querySelector(".gantt-grid-scroll"),Q=qe.current,ue=G?.scrollTop||0,we=G?.scrollLeft||0,et=Q.scrollTop,tt=Q.scrollLeft,pa=M.style.overflow,Zt=M.style.height,ba=G?.style.overflow||"",pr=Q.style.overflow,Ar=I.style.overflow,Lo=M.style.width,Fn=Q.style.width;try{let rn=G?.querySelector(".gantt-taskgrid-content"),io=Q.querySelector("svg"),Ll=io?.getAttribute("height")?parseInt(io.getAttribute("height"),10):io?.getBoundingClientRect().height||0,An=rn?.scrollHeight||G?.scrollHeight||600,oi=Math.max(Ll,Q.scrollHeight),ps=io?.getAttribute("width")?parseInt(io.getAttribute("width"),10):io?.getBoundingClientRect().width||Q.scrollWidth,Vf=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Il=Math.max(An,oi,Ll),xu=Vf+Il+50,vu=(G?.offsetWidth||I.offsetWidth||300)+ps+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,M.style.overflow="visible",M.style.height=`${xu}px`,M.style.width=`${vu}px`,I.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${Il+50}px`),Q.style.overflow="visible",Q.style.height=`${Il+50}px`,Q.style.width=`${ps+10}px`,await new Promise(ni=>setTimeout(ni,150));let Gf=await toPng(M,{backgroundColor:Fe.bgPrimary,pixelRatio:2,width:vu,height:xu,skipFonts:!1,filter:ni=>{if(!(ni instanceof Element))return !0;let wu=window.getComputedStyle(ni),ku=parseInt(wu.zIndex,10);return !(!isNaN(ku)&&ku>=50||wu.position==="fixed")}}),Bl=document.createElement("a");Bl.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Bl.href=Gf,Bl.click();}finally{M.style.overflow=pa,M.style.height=Zt,M.style.width=Lo,I.style.overflow=Ar,G&&(G.style.overflow=ba,G.style.height="",G.scrollTop=ue,G.scrollLeft=we),Q.style.overflow=pr,Q.style.height="",Q.style.width=Fn,Q.scrollTop=et,Q.scrollLeft=tt;}u?.("png");},[Fe,u]),Rf=useCallback(async()=>{await Ae.exportToPDF(C),u?.("pdf");},[C,u]),Pl=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});Pl.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let Of=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let M=new Date,I=ue=>String(ue).padStart(2,"0"),G=`${M.getFullYear()}-${I(M.getMonth()+1)}-${I(M.getDate())}_${I(M.getHours())}${I(M.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ae.exportToExcel(C,`${Q}_${G}.xlsx`,Pl.current),u?.("excel");},[C,m,u,a.onExportExcel]),$f=useCallback(()=>{let M=Ae.exportToCSV(C),I=new Blob([M],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(I),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href),u?.("csv");},[C,u]),Hf=useCallback(()=>{let M=Ae.exportToJSON(C),I=new Blob([M],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(I),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href),u?.("json");},[C,u]),zf=useCallback(()=>{Ae.exportToMSProject(C,"Gantt Project","project.xml"),u?.("msproject");},[C,u]),Uf=M=>{M.preventDefault(),Tt(true);},Pn=useRef(false),[Fl,bu]=useState(false),us=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=qe.current,I=De.current?.querySelector(".gantt-grid-scroll");if(!M||!I)return;let G=()=>{if(Pn.current)return;Pn.current=true;let tt=M.scrollTop;re(tt),I.scrollTop=tt,requestAnimationFrame(()=>{Pn.current=false;});},Q=()=>{if(Pn.current)return;Pn.current=true;let tt=I.scrollTop;re(tt),M.scrollTop=tt,requestAnimationFrame(()=>{Pn.current=false;});},ue=tt=>{if(xe&&I){let Zt=I.parentElement?.getBoundingClientRect()?.left||0,ba=tt.clientX-Zt,pr=200,Ar=Fo+E,Lo=window.innerWidth*oe,Fn=Math.max(Ar,Lo);ba>=pr&&ba<=Fn&&pt(ba);}if(Fl&&M){let pa=tt.clientX-us.current.x,Zt=tt.clientY-us.current.y;M.scrollLeft=us.current.scrollLeft-pa,M.scrollTop=us.current.scrollTop-Zt;}},we=()=>{Tt(false),bu(false);},et=tt=>{if(tt.button!==0)return;let pa=tt.target;pa.closest("[data-task-bar]")||pa.closest("[data-dependency-line]")||pa.closest("button")||pa.closest('[role="button"]')||pa.tagName==="rect"&&pa.getAttribute("data-clickable")==="true"||(bu(true),us.current={x:tt.clientX,y:tt.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},tt.preventDefault());};return M.addEventListener("scroll",G),I.addEventListener("scroll",Q),M.addEventListener("mousedown",et),document.addEventListener("mousemove",ue),document.addEventListener("mouseup",we),()=>{M.removeEventListener("scroll",G),I.removeEventListener("scroll",Q),M.removeEventListener("mousedown",et),document.removeEventListener("mousemove",ue),document.removeEventListener("mouseup",we);}},[xe,Fl,Fo]),_e.current={startDate:vo,timeScale:Ne,zoom:B};let Al=a.onTodayVisibilityChange,hu=useRef(null);useEffect(()=>{if(!Al)return;let M=qe.current;if(!M)return;let I=Ne==="day"?60:Ne==="week"?20:8,G=()=>{let we=(new Date().getTime()-vo.getTime())/(1e3*60*60*24)*I*B,et=M.scrollLeft,tt=et+M.clientWidth,pa=we>=et&&we<=tt;hu.current!==pa&&(hu.current=pa,Al(pa));};return G(),M.addEventListener("scroll",G,{passive:true}),window.addEventListener("resize",G),()=>{M.removeEventListener("scroll",G),window.removeEventListener("resize",G);}},[Al,vo,Ne,B]);let yu=useRef(false),Wf=useRef(null);return useLayoutEffect(()=>{if(yu.current||C.length===0||!qe.current)return;yu.current=true,Wf.current=vo;let M=qe.current,I=new Date,G=Ne==="day"?60:Ne==="week"?20:8,Q=(I.getTime()-vo.getTime())/(1e3*60*60*24),ue=M.clientWidth,et=Q*G*B-ue/2;Q>=0&&ue>0&&(M.scrollLeft=Math.max(0,et));},[C.length,vo,Ne,B]),jsx(jn.Provider,{value:Ja,children:jsx(zl.Provider,{value:ut,children:jsxs("div",{ref:me,className:"flex flex-col h-full w-full",style:{backgroundColor:Fe.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Fe.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Fe.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Oi,{theme:Fe,timeScale:Ne,onTimeScaleChange:ft,zoom:B,onZoomChange:Z,currentTheme:lt,onThemeChange:Ke,rowDensity:A,onRowDensityChange:ie,showThemeSelector:d,showCreateTaskButton:D&&wt?.canCreateTask!==false&&!wt?.canCreateSubtaskOnly,createTaskLabel:F,onCreateTask:T,taskFilter:ia,onTaskFilterChange:fa,hideCompleted:W,onHideCompletedChange:le,toolbarRightContent:k,wbsLevel:O,onWbsLevelChange:Po,maxWbsDepth:Na,viewMode:Be,onViewModeChange:Me,projectForecast:L,onExportPNG:i?Bf:void 0,onExportPDF:i?Rf:void 0,onExportExcel:i?Of:void 0,onExportCSV:i?$f:void 0,onExportJSON:i?Hf:void 0,onExportMSProject:i?zf:void 0,showCriticalPath:nt,onShowCriticalPathChange:zt,showDependencies:dt,onShowDependenciesChange:gt,highlightWeekends:Vt,onHighlightWeekendsChange:Dt,showBaseline:Pe,onShowBaselineChange:M=>{M&&Be!=="oracle"&&Me("oracle"),!M&&Be==="oracle"&&Me("execution");},onCopySnapshotLink:Nt,hasDependencies:Ft})}),jsxs("div",{ref:De,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Le,className:"gantt-grid-scroll flex-shrink-0",style:{width:he,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(zi,{tasks:La,theme:Fe,rowHeight:Ia,availableUsers:p,templates:Kt,showCriticalPath:nt,onTaskClick:K,onTaskDblClick:pu,onTaskContextMenu:R,onTaskToggle:qr,scrollTop:jt,columns:$r,onToggleColumn:_t,onColumnResize:na,onTaskUpdate:Da,onBulkFill:ai,onTaskIndent:ri,onTaskOutdent:Dl,onTaskMove:an,onMultiTaskDelete:Sl,onTaskDuplicate:Ef,onTaskCreate:Mf,onTaskRename:Pf,onCreateSubtask:El,onOpenTaskModal:K?M=>K(M):void 0,onDeleteRequest:(M,I)=>ne({taskIds:M,taskName:I}),onTaskReparent:Ao,scrollContainerRef:Le})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:Fe.border,zIndex:15},onMouseDown:Uf}),jsx("div",{ref:qe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Fl?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ki,{tasks:La,theme:Fe,rowHeight:Ia,timeScale:Ne,startDate:vo,endDate:Ml,zoom:B,locale:w,templates:Kt,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:K,onTaskDblClick:pu,onTaskContextMenu:Lf,onTaskDateChange:Af,onTaskProgressDrag:Ff,onDependencyCreate:gu,onDependencyDelete:fu,showBaseline:Pe,showCriticalPath:nt,showDependencies:dt,highlightWeekends:Vt,canEditTask:wt?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),it.task&&jsx(Kn,{isOpen:it.isOpen,x:it.x,y:it.y,theme:Fe,onClose:()=>q({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=it.task;if(!M)return [];let I=Ae.findTaskById(C,M.id)||M,G=I.subtasks&&I.subtasks.length>0,Q=wt?.canCreateTask!==false,ue=wt?.canDeleteTask!==false;if(G){let Zt=[],ba=wt?.canDuplicateTask!==false;return Q&&Zt.push({id:"addSubtask",label:Ja.contextMenu?.addSubtask||"Add Subtask",icon:ga.Add,onClick:()=>{te?te(I):El(I.id);}}),ba&&Zt.push({id:"duplicate",label:Ja.contextMenu?.duplicateTask||"Duplicate Task",icon:ga.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(I):z(pr=>As(pr,[I.id]).tasks),q({isOpen:false,x:0,y:0,task:null});}}),ue&&(Zt.length>0&&Zt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Zt.push({id:"delete",label:Ja.contextMenu?.deleteTask||"Delete Task",icon:ga.Delete,onClick:()=>{ne({taskIds:[I.id],taskName:I.name});}})),Zt}let we=wt?.canUpdateTask!==false,et=wt?.canDuplicateTask!==false,tt=[];return we&&tt.push({id:"edit",label:Ja.contextMenu?.editTask||"Edit Task",icon:ga.Pencil,onClick:()=>{H?H(I):ce(I);}}),Q&&tt.push({id:"addSubtask",label:Ja.contextMenu?.addSubtask||"Add Subtask",icon:ga.Add,onClick:()=>{te?te(I):El(I.id);}}),tt.length>0&&we&&tt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),we&&(tt.push({id:"markIncomplete",label:Ja.contextMenu?.markIncomplete||"Mark Incomplete",icon:ga.MarkIncomplete,onClick:()=>{ye?ye(I):Da(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"}),tt.push({id:"setInProgress",label:Ja.contextMenu?.setInProgress||"Set In Progress",icon:ga.SetInProgress,onClick:()=>{Re?Re(I):Da(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"}),tt.push({id:"markComplete",label:Ja.contextMenu?.markComplete||"Mark Complete",icon:ga.MarkComplete,onClick:()=>{Da(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"})),(et||we&&I.startDate&&I.endDate)&&tt.length>0&&tt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),et&&tt.push({id:"duplicate",label:Ja.contextMenu?.duplicateTask||"Duplicate Task",icon:ga.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(I):z(Zt=>As(Zt,[I.id]).tasks),q({isOpen:false,x:0,y:0,task:null});}}),we&&I.startDate&&I.endDate&&tt.push({id:"split",label:Ja.contextMenu?.splitTask||"Split Task",icon:ga.Split,onClick:()=>{let Zt=I.startDate.getTime(),ba=I.endDate.getTime(),pr=Zt+(ba-Zt)/2,Ar=new Date(pr);If(I,Ar);}}),ue&&(tt.length>0&&tt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),tt.push({id:"delete",label:Ja.contextMenu?.deleteTask||"Delete Task",icon:ga.Delete,onClick:()=>{ne({taskIds:[I.id],taskName:I.name});}})),tt})()}),jsx(Co,{task:fe,isOpen:!!fe,onClose:()=>ce(null),onTaskUpdate:M=>{fe&&(Da(fe.id,M),ce(null));},theme:lt==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsx(AnimatePresence,{children:$&&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:()=>ne(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:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Fe.bgSecondary,border:`1px solid ${Fe.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Fe.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:Fe.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ja.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Fe.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:Fe.textSecondary,fontFamily:"Inter, sans-serif"},children:$.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:Fe.textPrimary},children:[$.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Fe.textPrimary},children:['"',$.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Fe.bgPrimary,borderTop:`1px solid ${Fe.border}`},children:[jsx("button",{onClick:()=>ne(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Fe.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=Fe.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Sl($.taskIds),ne(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:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsx(Xi,{tasks:C,theme:Fe,config:v,onTasksUpdate:z,onTaskUpdate:Da,onTaskCreate:M=>{z(I=>[...I,M]);},onTaskDelete:M=>{Sl([M]);},onDependencyCreate:(M,I)=>{let G=Ae.findTaskById(C,M);G&&gu(G,I);},onDependencyDelete:fu})]})})})});function x2(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 v2(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),d=parseInt(a[2],10);return l*60+d}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var Zd=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],ec=[{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 Xm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=a?"edit":"create",theme:d="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:m,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:f,defaultStatus:x}){let y=[...Zd,...i.filter(A=>!Zd.some(ie=>ie.id===A.id))],b=xt[d]||xt.dark,[h,v]=useState(false),[w,N]=useState(false),[D,F]=useState(false),[T,S]=useState(false),[P,k]=useState({top:0,left:0}),[j,U]=useState(null),[ae,L]=useState(new Date),[X$1,K]=useState({top:0,left:0}),[V,R]=useState(false),[J,Te]=useState([]),[$e,H]=useState(false),[te,ye]=useState(""),Re=useRef(null),Se=useRef(null),Ee=useRef(null),Ve=useRef(null),ot=useRef(null),[be,Ge]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[je,He]=useState({});useEffect(()=>{a?(Ge({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||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(Ge({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),Te([]));},[a,e,x]),useEffect(()=>{let A=ie=>{Re.current&&!Re.current.contains(ie.target)&&v(false),Se.current&&!Se.current.contains(ie.target)&&N(false),Ee.current&&!Ee.current.contains(ie.target)&&F(false),Ve.current&&!Ve.current.contains(ie.target)&&S(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let wt=()=>{let A={};return be.name.trim()||(A.name="El nombre es requerido"),be.startDate&&be.endDate&&be.startDate>be.endDate&&(A.endDate="La fecha de fin debe ser posterior a la de inicio"),He(A),Object.keys(A).length===0},Nt=async A=>{if(A.preventDefault(),!!wt())try{let ie=l==="create"&&J.length>0?{...be,pendingFiles:J}:be;await s(ie),Te([]),t();}catch(ie){console.error("Error submitting task:",ie);}},Je=(A,ie)=>{Ge(B=>{let Z={...B,[A]:ie};if(A==="status"){let O=ie;O==="todo"?Z.progress=0:O==="in-progress"?(B.progress===0||B.progress===100)&&(Z.progress=50):O==="completed"||O==="closed"?Z.progress=100:(O==="in-review"||O==="review")&&(Z.progress=75);}if(A==="progress"){let O=typeof ie=="number"?ie:parseInt(ie,10);O===100&&B.status!=="completed"?Z.status="completed":O>0&&O<100&&B.status==="todo"?Z.status="in-progress":O===0&&B.status!=="todo"&&(Z.status="todo");}return Z}),je[A]&&He(B=>{let Z={...B};return delete Z[A],Z});},ze=y.find(A=>A.id===be.status)??Zd[0],lt=ec.find(A=>A.id===be.priority)??ec[1],At=cn.find(A=>A.value===be.color)??cn[0],Ne=d==="dark",ft={backgroundColor:Ne?"#1d1f27":b.bgSecondary,border:`1px solid ${Ne?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.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 z-[9999]",style:{backgroundColor:Ne?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},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-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":d,style:{backgroundColor:Ne?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ne?"rgba(65,71,84,0.1)":b.border}`,boxShadow:Ne?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:A=>A.stopPropagation(),children:jsxs("form",{onSubmit:Nt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:be.name,onChange:A=>Je("name",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),je.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),je.name]}),jsx("textarea",{value:be.description||"",onChange:A=>Je("description",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Re,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ft,borderColor:ze.color,backgroundColor:`${ze.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:ze.color}}),jsx("span",{style:{color:ze.color},children:ze.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:ze.color}})]}),jsx(AnimatePresence,{children:h&&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 overflow-hidden",style:{backgroundColor:Ne?"#0a0a0a":b.bgPrimary,backdropFilter:Ne?"blur(16px)":void 0,border:`1px solid ${Ne?"#262626":b.border}`,boxShadow:Ne?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("status",A.id),v(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:A.color}}),A.title,be.status===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),jsxs("div",{ref:Se,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&N(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ft,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:lt.color}}),jsx("span",{children:lt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&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 overflow-hidden",style:{backgroundColor:Ne?"#0a0a0a":b.bgPrimary,backdropFilter:Ne?"blur(16px)":void 0,border:`1px solid ${Ne?"#262626":b.border}`,boxShadow:Ne?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:ec.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:ie=>ie.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ie=>ie.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("priority",A.id),N(false);},children:[jsx("span",{children:A.icon}),A.label,be.priority===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),n.length>0&&jsxs("div",{ref:Ee,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&F(!D),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ft,disabled:o,children:[be.assignees&&be.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:be.assignees.slice(0,3).map((A,ie)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:A.color||b.accent,borderColor:b.bgSecondary},children:A.initials},ie))}),be.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",be.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.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",style:{backgroundColor:Ne?"#0a0a0a":b.bgPrimary,backdropFilter:Ne?"blur(16px)":void 0,border:`1px solid ${Ne?"#262626":b.border}`,boxShadow:Ne?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(A=>{let ie=be.assignees?.some(B=>B.name===A.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{let B=ie?(be.assignees||[]).filter(Z=>Z.name!==A.name):[...be.assignees||[],{name:A.name,avatar:A.avatar,initials:A.name.split(" ").map(Z=>Z[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Je("assignees",B);},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:b.accent},children:A.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:A.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:ie&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},A.id)})})})]}),jsxs("div",{ref:Ve,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(T)S(false);else {if(Ve.current){let A=Ve.current.getBoundingClientRect(),ie=window.innerHeight,B=120,O=ie-A.bottom<B?A.top-B-8:A.bottom+8;k({top:O,left:A.left});}S(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ft,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:be.color}}),jsx("span",{children:At.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(ea,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>S(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:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:Ne?"#0a0a0a":b.bgPrimary,backdropFilter:Ne?"blur(16px)":void 0,border:`1px solid ${Ne?"#262626":b.border}`,boxShadow:Ne?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:A=>A.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:cn.slice(0,18).map(A=>{let ie=be.color===A.value;return jsx("button",{type:"button",onClick:B=>{B.preventDefault(),B.stopPropagation(),Je("color",A.value),S(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:A.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:A.value,outline:ie?`2px solid ${A.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},A.value)})})})})]})})]}),u.length>0||m?jsx(Oo,{selectedTags:be.tags||[],availableTags:u,onChange:A=>Je("tags",A),onCreateTag:m,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Ne?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${Ne?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:ot,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!be.isMilestone)if(j==="start")U(null);else {if(ot.current){let A=ot.current.getBoundingClientRect();K({top:A.bottom+8,left:Math.max(16,A.left-40)});}U("start"),L(be.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ft,opacity:be.isMilestone?.5:1,cursor:be.isMilestone?"not-allowed":"pointer"},disabled:o||be.isMilestone,children:be.startDate?be.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!be.isMilestone)if(j==="end")U(null);else {if(ot.current){let A=ot.current.getBoundingClientRect();K({top:A.bottom+8,left:Math.max(16,A.left-40)});}U("end"),L(be.endDate||be.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ft,opacity:be.isMilestone?.5:1,cursor:be.isMilestone?"not-allowed":"pointer"},disabled:o||be.isMilestone,children:be.endDate?be.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:j&&jsxs(ea,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>U(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:`${X$1.top}px`,left:`${X$1.left}px`,zIndex:99999,backgroundColor:Ne?"#0a0a0a":b.bgPrimary,border:`1px solid ${Ne?"#262626":b.border}`,boxShadow:Ne?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Ne?"#262626":b.border}`},children:[(()=>{let A=new Date,ie=new Date(A);ie.setDate(A.getDate()+1);let B=new Date(A);B.setDate(A.getDate()+7);let Z=new Date(A);return Z.setDate(A.getDate()+14),[{label:"Hoy",date:A},{label:"Ma\xF1ana",date:ie},{label:"Pr\xF3xima semana",date:B},{label:"2 semanas",date:Z}].map((ee,Ue)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:ke=>ke.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:ke=>ke.currentTarget.style.backgroundColor="transparent",onClick:()=>{j==="start"?(Je("startDate",ee.date),(!be.endDate||ee.date>be.endDate)&&Je("endDate",ee.date),U("end")):(Je("endDate",ee.date),(!be.startDate||ee.date<be.startDate)&&Je("startDate",ee.date),U(null));},children:ee.label},Ue))})(),jsx("div",{style:{borderTop:`1px solid ${b.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:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("startDate",void 0),Je("endDate",void 0),U(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:()=>L(new Date(ae.getFullYear(),ae.getMonth()-1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ae.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>L(new Date(ae.getFullYear(),ae.getMonth()+1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((A,ie)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:A},ie))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=ae.getFullYear(),ie=ae.getMonth(),B=new Date(A,ie,1).getDay(),Z=new Date(A,ie+1,0).getDate(),O=new Date,ee=[];for(let ke=B-1;ke>=0;ke--)ee.push({day:new Date(A,ie,-ke).getDate(),date:new Date(A,ie-1,new Date(A,ie,-ke).getDate()),isCurrentMonth:false});for(let ke=1;ke<=Z;ke++)ee.push({day:ke,date:new Date(A,ie,ke),isCurrentMonth:true});let Ue=42-ee.length;for(let ke=1;ke<=Ue;ke++)ee.push({day:ke,date:new Date(A,ie+1,ke),isCurrentMonth:false});return ee.map((ke,Be)=>{let Me=ke.date.toDateString()===O.toDateString(),Pe=be.startDate?.toDateString()===ke.date.toDateString(),nt=be.endDate?.toDateString()===ke.date.toDateString(),at=be.startDate&&be.endDate&&ke.date>=be.startDate&&ke.date<=be.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ke.isCurrentMonth?Pe||nt?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Pe?b.accent:nt?"#7C3AED":at?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Me&&!Pe&&!nt?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{j==="start"?(Je("startDate",ke.date),be.endDate&&ke.date>be.endDate&&Je("endDate",ke.date),U("end")):(Je("endDate",ke.date),be.startDate&&ke.date<be.startDate&&Je("startDate",ke.date),U(null));},children:ke.day},Be)})})()})]})]})]})})]}),je.endDate&&jsx("span",{className:"text-xs text-red-400",children:je.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[be.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Ne?"#33343c":"#E5E7EB"},onClick:A=>{if(o)return;let ie=A.currentTarget.getBoundingClientRect(),B=Math.round((A.clientX-ie.left)/ie.width*100/5)*5;Je("progress",Math.max(0,Math.min(100,B)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${be.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Ne?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!V),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${V?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:V&&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:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:be.effortMinutes?x2(be.effortMinutes):"",onChange:A=>{let ie=v2(A.target.value);Je("effortMinutes",ie);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),r.length>0&&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:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:be.parentId||"",onChange:A=>Je("parentId",A.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(A=>A.id!==a?.id).map(A=>jsx("option",{value:A.id,children:A.name},A.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:be.location||"",onChange:A=>Je("location",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:be.equipment||"",onChange:A=>Je("equipment",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(g||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:b.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:b.textTertiary},children:["Adjuntos ",l==="create"?J.length>0&&`(${J.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(mo,{cardId:"pending",attachments:J.map((A,ie)=>({id:`pending-${ie}`,cardId:"pending",name:A.name,size:A.size,type:A.type,url:URL.createObjectURL(A),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:A=>Te(ie=>[...ie,...A]),onDelete:A=>{let ie=parseInt(A.replace("pending-",""),10);Te(B=>B.filter((Z,O)=>O!==ie));},maxSizeMB:10,maxFiles:20}):jsx(mo,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?A=>g(a.id,A):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&J.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[J.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",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:be.isMilestone,onChange:A=>Je("isMilestone",A.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.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:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),be.dependencies&&be.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:be.dependencies.map(A=>{let ie=r.find(B=>B.id===A);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[ie?.name||A.slice(0,8),jsx("button",{type:"button",onClick:()=>{let B=(be.dependencies||[]).filter(Z=>Z!==A);Je("dependencies",B);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{type:"button",onClick:()=>{H(!$e),ye("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:$e&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{H(false),ye("");}}),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 overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Ne?"#0a0a0a":b.bgPrimary,backdropFilter:Ne?"blur(16px)":void 0,border:`1px solid ${Ne?"#262626":b.border}`,boxShadow:Ne?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:te,onChange:A=>ye(A.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(A=>A.id!==a?.id).filter(A=>te===""||A.name.toLowerCase().includes(te.toLowerCase())).map(A=>{let ie=be.dependencies?.includes(A.id);return jsxs("button",{type:"button",onClick:()=>{let B=be.dependencies||[],Z;ie?Z=B.filter(O=>O!==A.id):Z=[...B,A.id],Je("dependencies",Z);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:ie?`${b.accent}10`:"transparent"},onMouseEnter:B=>{ie||(B.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:B=>{B.currentTarget.style.backgroundColor=ie?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:ie?b.accent:"transparent",borderColor:ie?b.accent:b.borderLight},children:ie&&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:b.textPrimary},children:A.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:A.id.slice(0,8)})]})]},A.id)}),r.filter(A=>A.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Ne?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:Ne?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:A=>A.currentTarget.style.color=b.textPrimary,onMouseLeave:A=>A.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:A=>!o&&(A.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:A=>!o&&(A.currentTarget.style.filter="brightness(1)"),children:o?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 Jm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let G=Q=>Q.map(ce=>{if(ce.id===I){let we=ce.dependencies||[];if(!we.includes(M.id))return {...ce,dependencies:[...we,M.id]}}return ce.subtasks?{...ce,subtasks:G(ce.subtasks)}:ce});Fr.current+=1,$(Q=>G(Q)),De?.(M.id,I);},[De,fu]),hu=useCallback((M,I)=>{let G=Q=>Q.map(ce=>{if(ce.id===M&&ce.dependencies){let we=ce.dependencies.filter(et=>et!==I);return {...ce,dependencies:we}}return ce.subtasks?{...ce,subtasks:G(ce.subtasks)}:ce});Fr.current+=1,$(Q=>G(Q)),Ee?.(M,I);},[Ee]),{startDate:Do,endDate:Fl}=useMemo(()=>{let M=C.filter(we=>we.startDate&&we.endDate);if(M.length===0){let we=new Date,et=new Date(we);et.setDate(et.getDate()-30);let tt=new Date(we);return tt.setDate(tt.getDate()+60),{startDate:et,endDate:tt}}let I=M.flatMap(we=>[we.startDate,we.endDate]).filter(we=>we!==void 0),G=new Date(Math.min(...I.map(we=>we.getTime()))),Q=new Date(Math.max(...I.map(we=>we.getTime()))),ce=ke==="day"?7:ke==="week"?14:30;return G.setDate(G.getDate()-ce),Q.setDate(Q.getDate()+ce),{startDate:G,endDate:Q}},[C,ke]);useEffect(()=>{Ut.current?.(Do,Fl);},[Do,Fl]);let Bf=useCallback(async()=>{if(!me.current||!Se.current||!qe.current)return;await new Promise(dn=>setTimeout(dn,200));let M=me.current,I=Se.current,G=Fe.current||I.querySelector(".gantt-grid-scroll"),Q=qe.current,ce=G?.scrollTop||0,we=G?.scrollLeft||0,et=Q.scrollTop,tt=Q.scrollLeft,ba=M.style.overflow,ra=M.style.height,va=G?.style.overflow||"",br=Q.style.overflow,$r=I.style.overflow,$o=M.style.width,Rn=Q.style.width;try{let dn=G?.querySelector(".gantt-taskgrid-content"),mo=Q.querySelector("svg"),Bl=mo?.getAttribute("height")?parseInt(mo.getAttribute("height"),10):mo?.getBoundingClientRect().height||0,On=dn?.scrollHeight||G?.scrollHeight||600,li=Math.max(Bl,Q.scrollHeight),ys=mo?.getAttribute("width")?parseInt(mo.getAttribute("width"),10):mo?.getBoundingClientRect().width||Q.scrollWidth,Vf=M.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,Rl=Math.max(On,li,Bl),wu=Vf+Rl+50,ku=(G?.offsetWidth||I.offsetWidth||300)+ys+10;G&&(G.scrollTop=0,G.scrollLeft=0),Q.scrollTop=0,Q.scrollLeft=0,M.style.overflow="visible",M.style.height=`${wu}px`,M.style.width=`${ku}px`,I.style.overflow="visible",G&&(G.style.overflow="visible",G.style.height=`${Rl+50}px`),Q.style.overflow="visible",Q.style.height=`${Rl+50}px`,Q.style.width=`${ys+10}px`,await new Promise(di=>setTimeout(di,150));let Gf=await toPng(M,{backgroundColor:Be.bgPrimary,pixelRatio:2,width:ku,height:wu,skipFonts:!1,filter:di=>{if(!(di instanceof Element))return !0;let Cu=window.getComputedStyle(di),Tu=parseInt(Cu.zIndex,10);return !(!isNaN(Tu)&&Tu>=50||Cu.position==="fixed")}}),Ol=document.createElement("a");Ol.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,Ol.href=Gf,Ol.click();}finally{M.style.overflow=ba,M.style.height=ra,M.style.width=$o,I.style.overflow=$r,G&&(G.style.overflow=va,G.style.height="",G.scrollTop=ce,G.scrollLeft=we),Q.style.overflow=br,Q.style.height="",Q.style.width=Rn,Q.scrollTop=et,Q.scrollLeft=tt;}u?.("png");},[Be,u]),Rf=useCallback(async()=>{await Ae.exportToPDF(C),u?.("pdf");},[C,u]),Al=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m});Al.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:m};let Of=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let M=new Date,I=ce=>String(ce).padStart(2,"0"),G=`${M.getFullYear()}-${I(M.getMonth()+1)}-${I(M.getDate())}_${I(M.getHours())}${I(M.getMinutes())}`,Q=m?m.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Ae.exportToExcel(C,`${Q}_${G}.xlsx`,Al.current),u?.("excel");},[C,m,u,a.onExportExcel]),$f=useCallback(()=>{let M=Ae.exportToCSV(C),I=new Blob([M],{type:"text/csv;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(I),G.download="gantt-chart.csv",G.click(),URL.revokeObjectURL(G.href),u?.("csv");},[C,u]),Hf=useCallback(()=>{let M=Ae.exportToJSON(C),I=new Blob([M],{type:"application/json;charset=utf-8;"}),G=document.createElement("a");G.href=URL.createObjectURL(I),G.download="gantt-chart.json",G.click(),URL.revokeObjectURL(G.href),u?.("json");},[C,u]),zf=useCallback(()=>{Ae.exportToMSProject(C,"Gantt Project","project.xml"),u?.("msproject");},[C,u]),Uf=M=>{M.preventDefault(),Nt(true);},Bn=useRef(false),[Ll,yu]=useState(false),hs=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let M=qe.current,I=Se.current?.querySelector(".gantt-grid-scroll");if(!M||!I)return;let G=()=>{if(Bn.current)return;Bn.current=true;let tt=M.scrollTop;re(tt),I.scrollTop=tt,requestAnimationFrame(()=>{Bn.current=false;});},Q=()=>{if(Bn.current)return;Bn.current=true;let tt=I.scrollTop;re(tt),M.scrollTop=tt,requestAnimationFrame(()=>{Bn.current=false;});},ce=tt=>{if(ve&&I){let ra=I.parentElement?.getBoundingClientRect()?.left||0,va=tt.clientX-ra,br=200,$r=Oo+D,$o=window.innerWidth*oe,Rn=Math.max($r,$o);va>=br&&va<=Rn&&ut(va);}if(Ll&&M){let ba=tt.clientX-hs.current.x,ra=tt.clientY-hs.current.y;M.scrollLeft=hs.current.scrollLeft-ba,M.scrollTop=hs.current.scrollTop-ra;}},we=()=>{Nt(false),yu(false);},et=tt=>{if(tt.button!==0)return;let ba=tt.target;ba.closest("[data-task-bar]")||ba.closest("[data-dependency-line]")||ba.closest("button")||ba.closest('[role="button"]')||ba.tagName==="rect"&&ba.getAttribute("data-clickable")==="true"||(yu(true),hs.current={x:tt.clientX,y:tt.clientY,scrollLeft:M.scrollLeft,scrollTop:M.scrollTop},tt.preventDefault());};return M.addEventListener("scroll",G),I.addEventListener("scroll",Q),M.addEventListener("mousedown",et),document.addEventListener("mousemove",ce),document.addEventListener("mouseup",we),()=>{M.removeEventListener("scroll",G),I.removeEventListener("scroll",Q),M.removeEventListener("mousedown",et),document.removeEventListener("mousemove",ce),document.removeEventListener("mouseup",we);}},[ve,Ll,Oo]),Ke.current={startDate:Do,timeScale:ke,zoom:B};let Il=a.onTodayVisibilityChange,xu=useRef(null);useEffect(()=>{if(!Il)return;let M=qe.current;if(!M)return;let I=ke==="day"?60:ke==="week"?20:8,G=()=>{let we=(new Date().getTime()-Do.getTime())/(1e3*60*60*24)*I*B,et=M.scrollLeft,tt=et+M.clientWidth,ba=we>=et&&we<=tt;xu.current!==ba&&(xu.current=ba,Il(ba));};return G(),M.addEventListener("scroll",G,{passive:true}),window.addEventListener("resize",G),()=>{M.removeEventListener("scroll",G),window.removeEventListener("resize",G);}},[Il,Do,ke,B]);let vu=useRef(false),Wf=useRef(null);return useLayoutEffect(()=>{if(vu.current||C.length===0||!qe.current)return;vu.current=true,Wf.current=Do;let M=qe.current,I=new Date,G=ke==="day"?60:ke==="week"?20:8,Q=(I.getTime()-Do.getTime())/(1e3*60*60*24),ce=M.clientWidth,et=Q*G*B-ce/2;Q>=0&&ce>0&&(M.scrollLeft=Math.max(0,et));},[C.length,Do,ke,B]),jsx(Xn.Provider,{value:Za,children:jsx(Wl.Provider,{value:yt,children:jsxs("div",{ref:me,className:"flex flex-col h-full w-full",style:{backgroundColor:Be.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...Be.dotGrid&&{backgroundImage:`radial-gradient(circle, ${Be.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[jsx("div",{style:{position:"relative",zIndex:100},children:jsx(Ui,{theme:Be,timeScale:ke,onTimeScaleChange:gt,zoom:B,onZoomChange:Z,currentTheme:lt,onThemeChange:_e,rowDensity:A,onRowDensityChange:se,showThemeSelector:d,showCreateTaskButton:S&&Ct?.canCreateTask!==false&&!Ct?.canCreateSubtaskOnly,createTaskLabel:F,onCreateTask:T,taskFilter:ca,onTaskFilterChange:xa,hideCompleted:W,onHideCompletedChange:ie,toolbarRightContent:k,wbsLevel:O,onWbsLevelChange:Ro,maxWbsDepth:Zt,viewMode:Ie,onViewModeChange:Me,projectForecast:L,onExportPNG:i?Bf:void 0,onExportPDF:i?Rf:void 0,onExportExcel:i?Of:void 0,onExportCSV:i?$f:void 0,onExportJSON:i?Hf:void 0,onExportMSProject:i?zf:void 0,showCriticalPath:nt,onShowCriticalPathChange:zt,showDependencies:dt,onShowDependenciesChange:mt,highlightWeekends:jt,onHighlightWeekendsChange:Pt,showBaseline:Pe,onShowBaselineChange:M=>{M&&Ie!=="oracle"&&Me("oracle"),!M&&Ie==="oracle"&&Me("execution");},onCopySnapshotLink:Dt,hasDependencies:Et})}),jsxs("div",{ref:Se,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Fe,className:"gantt-grid-scroll flex-shrink-0",style:{width:ye,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(Gi,{tasks:Ea,theme:Be,rowHeight:Ya,availableUsers:p,templates:ta,showCriticalPath:nt,onTaskClick:Y,onTaskDblClick:gu,onTaskContextMenu:R,onTaskToggle:Vt,scrollTop:Kt,columns:Gr,onToggleColumn:aa,onColumnResize:pa,onTaskUpdate:At,onBulkFill:za,onTaskIndent:hr,onTaskOutdent:kr,onTaskMove:er,onMultiTaskDelete:No,onTaskDuplicate:bs,onTaskCreate:ln,onTaskRename:Pf,onCreateSubtask:Pl,onOpenTaskModal:Y?M=>Y(M):void 0,onDeleteRequest:(M,I)=>fe({taskIds:M,taskName:I}),onTaskReparent:fr,scrollContainerRef:Fe})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:Be.border,zIndex:15},onMouseDown:Uf}),jsx("div",{ref:qe,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:Ll?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Ji,{tasks:Ea,theme:Be,rowHeight:Ya,timeScale:ke,startDate:Do,endDate:Fl,zoom:B,locale:w,templates:ta,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:Y,onTaskDblClick:gu,onTaskContextMenu:Lf,onTaskDateChange:Af,onTaskProgressDrag:Ff,onDependencyCreate:bu,onDependencyDelete:hu,showBaseline:Pe,showCriticalPath:nt,showDependencies:dt,highlightWeekends:jt,canEditTask:Ct?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),it.task&&jsx(Qn,{isOpen:it.isOpen,x:it.x,y:it.y,theme:Be,onClose:()=>q({isOpen:false,x:0,y:0,task:null}),items:(()=>{let M=it.task;if(!M)return [];let I=Ae.findTaskById(C,M.id)||M,G=I.subtasks&&I.subtasks.length>0,Q=Ct?.canCreateTask!==false,ce=Ct?.canDeleteTask!==false;if(G){let ra=[],va=Ct?.canDuplicateTask!==false;return Q&&ra.push({id:"addSubtask",label:Za.contextMenu?.addSubtask||"Add Subtask",icon:ya.Add,onClick:()=>{te?te(I):Pl(I.id);}}),va&&ra.push({id:"duplicate",label:Za.contextMenu?.duplicateTask||"Duplicate Task",icon:ya.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(I):$(br=>$s(br,[I.id]).tasks),q({isOpen:false,x:0,y:0,task:null});}}),ce&&(ra.length>0&&ra.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ra.push({id:"delete",label:Za.contextMenu?.deleteTask||"Delete Task",icon:ya.Delete,onClick:()=>{fe({taskIds:[I.id],taskName:I.name});}})),ra}let we=Ct?.canUpdateTask!==false,et=Ct?.canDuplicateTask!==false,tt=[];return we&&tt.push({id:"edit",label:Za.contextMenu?.editTask||"Edit Task",icon:ya.Pencil,onClick:()=>{z?z(I):ge(I);}}),Q&&tt.push({id:"addSubtask",label:Za.contextMenu?.addSubtask||"Add Subtask",icon:ya.Add,onClick:()=>{te?te(I):Pl(I.id);}}),tt.length>0&&we&&tt.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),we&&(tt.push({id:"markIncomplete",label:Za.contextMenu?.markIncomplete||"Mark Incomplete",icon:ya.MarkIncomplete,onClick:()=>{xe?xe(I):At(I.id,{status:"todo",progress:0});},disabled:I.status==="todo"}),tt.push({id:"setInProgress",label:Za.contextMenu?.setInProgress||"Set In Progress",icon:ya.SetInProgress,onClick:()=>{Re?Re(I):At(I.id,{status:"in-progress"});},disabled:I.status==="in-progress"}),tt.push({id:"markComplete",label:Za.contextMenu?.markComplete||"Mark Complete",icon:ya.MarkComplete,onClick:()=>{At(I.id,{status:"completed",progress:100});},disabled:I.status==="completed"})),(et||we&&I.startDate&&I.endDate)&&tt.length>0&&tt.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),et&&tt.push({id:"duplicate",label:Za.contextMenu?.duplicateTask||"Duplicate Task",icon:ya.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(I):$(ra=>$s(ra,[I.id]).tasks),q({isOpen:false,x:0,y:0,task:null});}}),we&&I.startDate&&I.endDate&&tt.push({id:"split",label:Za.contextMenu?.splitTask||"Split Task",icon:ya.Split,onClick:()=>{let ra=I.startDate.getTime(),va=I.endDate.getTime(),br=ra+(va-ra)/2,$r=new Date(br);If(I,$r);}}),ce&&(tt.length>0&&tt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),tt.push({id:"delete",label:Za.contextMenu?.deleteTask||"Delete Task",icon:ya.Delete,onClick:()=>{fe({taskIds:[I.id],taskName:I.name});}})),tt})()}),jsx(Mo,{task:le,isOpen:!!le,onClose:()=>ge(null),onTaskUpdate:M=>{le&&(At(le.id,M),ge(null));},theme:lt==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:p,availableTasks:t}),jsx(AnimatePresence,{children:H&&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:()=>fe(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:M=>M.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:Be.bgSecondary,border:`1px solid ${Be.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${Be.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:Be.textPrimary,fontFamily:"Inter, sans-serif"},children:[Za.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:Be.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:Be.textSecondary,fontFamily:"Inter, sans-serif"},children:H.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:Be.textPrimary},children:[H.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:Be.textPrimary},children:['"',H.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:Be.bgPrimary,borderTop:`1px solid ${Be.border}`},children:[jsx("button",{onClick:()=>fe(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:Be.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor=Be.hoverBg;},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{No(H.taskIds),fe(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:M=>{M.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),v?.enabled&&jsx(el,{tasks:C,theme:Be,config:v,onTasksUpdate:$,onTaskUpdate:At,onTaskCreate:M=>{$(I=>[...I,M]);},onTaskDelete:M=>{No([M]);},onDependencyCreate:(M,I)=>{let G=Ae.findTaskById(C,M);G&&bu(G,I);},onDependencyDelete:hu})]})})})});function x2(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 v2(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),d=parseInt(a[2],10);return l*60+d}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var tc=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],ac=[{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 Qm({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:l=a?"edit":"create",theme:d="dark",customStatuses:i=[],availableTags:u=[],onCreateTag:m,attachments:p=[],onUploadAttachments:g,onDeleteAttachment:f,defaultStatus:x}){let y=[...tc,...i.filter(A=>!tc.some(se=>se.id===A.id))],b=xt[d]||xt.dark,[h,v]=useState(false),[w,N]=useState(false),[S,F]=useState(false),[T,E]=useState(false),[P,k]=useState({top:0,left:0}),[j,U]=useState(null),[ae,L]=useState(new Date),[X$1,Y]=useState({top:0,left:0}),[V,R]=useState(false),[J,Ne]=useState([]),[$e,z]=useState(false),[te,xe]=useState(""),Re=useRef(null),De=useRef(null),Ee=useRef(null),Ve=useRef(null),ot=useRef(null),[he,Ge]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[je,He]=useState({});useEffect(()=>{a?(Ge({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||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(Ge({name:"",description:"",progress:0,status:x||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),Ne([]));},[a,e,x]),useEffect(()=>{let A=se=>{Re.current&&!Re.current.contains(se.target)&&v(false),De.current&&!De.current.contains(se.target)&&N(false),Ee.current&&!Ee.current.contains(se.target)&&F(false),Ve.current&&!Ve.current.contains(se.target)&&E(false);};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);let Ct=()=>{let A={};return he.name.trim()||(A.name="El nombre es requerido"),he.startDate&&he.endDate&&he.startDate>he.endDate&&(A.endDate="La fecha de fin debe ser posterior a la de inicio"),He(A),Object.keys(A).length===0},Dt=async A=>{if(A.preventDefault(),!!Ct())try{let se=l==="create"&&J.length>0?{...he,pendingFiles:J}:he;await s(se),Ne([]),t();}catch(se){console.error("Error submitting task:",se);}},Je=(A,se)=>{Ge(B=>{let Z={...B,[A]:se};if(A==="status"){let O=se;O==="todo"?Z.progress=0:O==="in-progress"?(B.progress===0||B.progress===100)&&(Z.progress=50):O==="completed"||O==="closed"?Z.progress=100:(O==="in-review"||O==="review")&&(Z.progress=75);}if(A==="progress"){let O=typeof se=="number"?se:parseInt(se,10);O===100&&B.status!=="completed"?Z.status="completed":O>0&&O<100&&B.status==="todo"?Z.status="in-progress":O===0&&B.status!=="todo"&&(Z.status="todo");}return Z}),je[A]&&He(B=>{let Z={...B};return delete Z[A],Z});},ze=y.find(A=>A.id===he.status)??tc[0],lt=ac.find(A=>A.id===he.priority)??ac[1],Lt=fn.find(A=>A.value===he.color)??fn[0],ke=d==="dark",gt={backgroundColor:ke?"#1d1f27":b.bgSecondary,border:`1px solid ${ke?"rgba(65,71,84,0.1)":b.borderLight}`,color:b.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 z-[9999]",style:{backgroundColor:ke?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},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-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":d,style:{backgroundColor:ke?"#0a0a0a":b.bgPrimary,border:`1px solid ${ke?"rgba(65,71,84,0.1)":b.border}`,boxShadow:ke?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:A=>A.stopPropagation(),children:jsxs("form",{onSubmit:Dt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:he.name,onChange:A=>Je("name",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:b.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),je.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),je.name]}),jsx("textarea",{value:he.description||"",onChange:A=>Je("description",A.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:b.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":b.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:Re,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&v(!h),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...gt,borderColor:ze.color,backgroundColor:`${ze.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:ze.color}}),jsx("span",{style:{color:ze.color},children:ze.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:ze.color}})]}),jsx(AnimatePresence,{children:h&&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 overflow-hidden",style:{backgroundColor:ke?"#0a0a0a":b.bgPrimary,backdropFilter:ke?"blur(16px)":void 0,border:`1px solid ${ke?"#262626":b.border}`,boxShadow:ke?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:y.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("status",A.id),v(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:A.color}}),A.title,he.status===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),jsxs("div",{ref:De,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&N(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:gt,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:lt.color}}),jsx("span",{children:lt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:w&&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 overflow-hidden",style:{backgroundColor:ke?"#0a0a0a":b.bgPrimary,backdropFilter:ke?"blur(16px)":void 0,border:`1px solid ${ke?"#262626":b.border}`,boxShadow:ke?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:ac.map(A=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:se=>se.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:se=>se.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("priority",A.id),N(false);},children:[jsx("span",{children:A.icon}),A.label,he.priority===A.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:b.accent}})]},A.id))})})]}),n.length>0&&jsxs("div",{ref:Ee,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&F(!S),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:gt,disabled:o,children:[he.assignees&&he.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:he.assignees.slice(0,3).map((A,se)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:A.color||b.accent,borderColor:b.bgSecondary},children:A.initials},se))}),he.assignees.length>3&&jsxs("span",{style:{color:b.textTertiary},children:["+",he.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:b.textTertiary}}),jsx("span",{style:{color:b.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:S&&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",style:{backgroundColor:ke?"#0a0a0a":b.bgPrimary,backdropFilter:ke?"blur(16px)":void 0,border:`1px solid ${ke?"#262626":b.border}`,boxShadow:ke?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(A=>{let se=he.assignees?.some(B=>B.name===A.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:b.textPrimary},onMouseEnter:B=>B.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:B=>B.currentTarget.style.backgroundColor="transparent",onClick:()=>{let B=se?(he.assignees||[]).filter(Z=>Z.name!==A.name):[...he.assignees||[],{name:A.name,avatar:A.avatar,initials:A.name.split(" ").map(Z=>Z[0]).join("").toUpperCase().slice(0,2),color:b.accent}];Je("assignees",B);},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:b.accent},children:A.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:A.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:se&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:b.accent}})})]},A.id)})})})]}),jsxs("div",{ref:Ve,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(T)E(false);else {if(Ve.current){let A=Ve.current.getBoundingClientRect(),se=window.innerHeight,B=120,O=se-A.bottom<B?A.top-B-8:A.bottom+8;k({top:O,left:A.left});}E(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:gt,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:he.color}}),jsx("span",{children:Lt.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:b.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(oa,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>E(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:`${P.top}px`,left:`${P.left}px`,zIndex:99999,backgroundColor:ke?"#0a0a0a":b.bgPrimary,backdropFilter:ke?"blur(16px)":void 0,border:`1px solid ${ke?"#262626":b.border}`,boxShadow:ke?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:A=>A.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:fn.slice(0,18).map(A=>{let se=he.color===A.value;return jsx("button",{type:"button",onClick:B=>{B.preventDefault(),B.stopPropagation(),Je("color",A.value),E(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:A.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:A.value,outline:se?`2px solid ${A.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},A.value)})})})})]})})]}),u.length>0||m?jsx(Wo,{selectedTags:he.tags||[],availableTags:u,onChange:A=>Je("tags",A),onCreateTag:m,theme:b,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:ke?"#191b22":b.bgSecondary,borderRadius:8,border:`1px solid ${ke?"rgba(65,71,84,0.05)":b.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:ot,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!he.isMilestone)if(j==="start")U(null);else {if(ot.current){let A=ot.current.getBoundingClientRect();Y({top:A.bottom+8,left:Math.max(16,A.left-40)});}U("start"),L(he.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...gt,opacity:he.isMilestone?.5:1,cursor:he.isMilestone?"not-allowed":"pointer"},disabled:o||he.isMilestone,children:he.startDate?he.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:b.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!he.isMilestone)if(j==="end")U(null);else {if(ot.current){let A=ot.current.getBoundingClientRect();Y({top:A.bottom+8,left:Math.max(16,A.left-40)});}U("end"),L(he.endDate||he.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...gt,opacity:he.isMilestone?.5:1,cursor:he.isMilestone?"not-allowed":"pointer"},disabled:o||he.isMilestone,children:he.endDate?he.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:j&&jsxs(oa,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>U(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:`${X$1.top}px`,left:`${X$1.left}px`,zIndex:99999,backgroundColor:ke?"#0a0a0a":b.bgPrimary,border:`1px solid ${ke?"#262626":b.border}`,boxShadow:ke?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:A=>A.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${ke?"#262626":b.border}`},children:[(()=>{let A=new Date,se=new Date(A);se.setDate(A.getDate()+1);let B=new Date(A);B.setDate(A.getDate()+7);let Z=new Date(A);return Z.setDate(A.getDate()+14),[{label:"Hoy",date:A},{label:"Ma\xF1ana",date:se},{label:"Pr\xF3xima semana",date:B},{label:"2 semanas",date:Z}].map((ee,Ue)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:b.textPrimary},onMouseEnter:Ce=>Ce.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:Ce=>Ce.currentTarget.style.backgroundColor="transparent",onClick:()=>{j==="start"?(Je("startDate",ee.date),(!he.endDate||ee.date>he.endDate)&&Je("endDate",ee.date),U("end")):(Je("endDate",ee.date),(!he.startDate||ee.date<he.startDate)&&Je("startDate",ee.date),U(null));},children:ee.label},Ue))})(),jsx("div",{style:{borderTop:`1px solid ${b.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:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",onClick:()=>{Je("startDate",void 0),Je("endDate",void 0),U(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:()=>L(new Date(ae.getFullYear(),ae.getMonth()-1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:b.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:b.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:ae.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>L(new Date(ae.getFullYear(),ae.getMonth()+1)),className:"p-1 rounded",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:b.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((A,se)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:b.textTertiary},children:A},se))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let A=ae.getFullYear(),se=ae.getMonth(),B=new Date(A,se,1).getDay(),Z=new Date(A,se+1,0).getDate(),O=new Date,ee=[];for(let Ce=B-1;Ce>=0;Ce--)ee.push({day:new Date(A,se,-Ce).getDate(),date:new Date(A,se-1,new Date(A,se,-Ce).getDate()),isCurrentMonth:false});for(let Ce=1;Ce<=Z;Ce++)ee.push({day:Ce,date:new Date(A,se,Ce),isCurrentMonth:true});let Ue=42-ee.length;for(let Ce=1;Ce<=Ue;Ce++)ee.push({day:Ce,date:new Date(A,se+1,Ce),isCurrentMonth:false});return ee.map((Ce,Ie)=>{let Me=Ce.date.toDateString()===O.toDateString(),Pe=he.startDate?.toDateString()===Ce.date.toDateString(),nt=he.endDate?.toDateString()===Ce.date.toDateString(),at=he.startDate&&he.endDate&&Ce.date>=he.startDate&&Ce.date<=he.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Ce.isCurrentMonth?Pe||nt?"#FFF":b.textPrimary:b.textTertiary,backgroundColor:Pe?b.accent:nt?"#7C3AED":at?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:Me&&!Pe&&!nt?`inset 0 0 0 1px ${b.accent}`:"none"},onClick:()=>{j==="start"?(Je("startDate",Ce.date),he.endDate&&Ce.date>he.endDate&&Je("endDate",Ce.date),U("end")):(Je("endDate",Ce.date),he.startDate&&Ce.date<he.startDate&&Je("startDate",Ce.date),U(null));},children:Ce.day},Ie)})})()})]})]})]})})]}),je.endDate&&jsx("span",{className:"text-xs text-red-400",children:je.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:b.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[he.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:ke?"#33343c":"#E5E7EB"},onClick:A=>{if(o)return;let se=A.currentTarget.getBoundingClientRect(),B=Math.round((A.clientX-se.left)/se.width*100/5)*5;Je("progress",Math.max(0,Math.min(100,B)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${he.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${ke?"rgba(65,71,84,0.05)":b.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!V),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:b.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${V?"":"-rotate-90"}`,style:{color:b.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:V&&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:b.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:he.effortMinutes?x2(he.effortMinutes):"",onChange:A=>{let se=v2(A.target.value);Je("effortMinutes",se);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`}})]}),r.length>0&&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:b.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:he.parentId||"",onChange:A=>Je("parentId",A.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(A=>A.id!==a?.id).map(A=>jsx("option",{value:A.id,children:A.name},A.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:he.location||"",onChange:A=>Je("location",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:b.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:he.equipment||"",onChange:A=>Je("equipment",A.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textPrimary,border:`1px solid ${b.borderLight}`},disabled:o})]})]}),(g||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:b.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:b.textTertiary},children:["Adjuntos ",l==="create"?J.length>0&&`(${J.length})`:p.length>0&&`(${p.length})`]})]}),l==="create"?jsx(yo,{cardId:"pending",attachments:J.map((A,se)=>({id:`pending-${se}`,cardId:"pending",name:A.name,size:A.size,type:A.type,url:URL.createObjectURL(A),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:A=>Ne(se=>[...se,...A]),onDelete:A=>{let se=parseInt(A.replace("pending-",""),10);Ne(B=>B.filter((Z,O)=>O!==se));},maxSizeMB:10,maxFiles:20}):jsx(yo,{cardId:a?.id||"new",attachments:p,onUpload:g&&a?.id?A=>g(a.id,A):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),l==="create"&&J.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:b.textTertiary},children:[J.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",onMouseEnter:A=>A.currentTarget.style.backgroundColor=b.hoverBg,onMouseLeave:A=>A.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:he.isMilestone,onChange:A=>Je("isMilestone",A.target.checked),className:"w-4 h-4 rounded",style:{accentColor:b.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:b.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:b.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),he.dependencies&&he.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:he.dependencies.map(A=>{let se=r.find(B=>B.id===A);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${b.accent}20`,color:b.accent},children:[se?.name||A.slice(0,8),jsx("button",{type:"button",onClick:()=>{let B=(he.dependencies||[]).filter(Z=>Z!==A);Je("dependencies",B);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},A)})}),jsxs("button",{type:"button",onClick:()=>{z(!$e),xe("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:b.bgSecondary,color:b.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:$e&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{z(false),xe("");}}),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 overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:ke?"#0a0a0a":b.bgPrimary,backdropFilter:ke?"blur(16px)":void 0,border:`1px solid ${ke?"#262626":b.border}`,boxShadow:ke?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${b.border}`},children:jsx("input",{type:"text",value:te,onChange:A=>xe(A.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:b.bgSecondary,color:b.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(A=>A.id!==a?.id).filter(A=>te===""||A.name.toLowerCase().includes(te.toLowerCase())).map(A=>{let se=he.dependencies?.includes(A.id);return jsxs("button",{type:"button",onClick:()=>{let B=he.dependencies||[],Z;se?Z=B.filter(O=>O!==A.id):Z=[...B,A.id],Je("dependencies",Z);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:se?`${b.accent}10`:"transparent"},onMouseEnter:B=>{se||(B.currentTarget.style.backgroundColor=b.hoverBg);},onMouseLeave:B=>{B.currentTarget.style.backgroundColor=se?`${b.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:se?b.accent:"transparent",borderColor:se?b.accent:b.borderLight},children:se&&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:b.textPrimary},children:A.name}),jsx("span",{className:"text-[10px]",style:{color:b.textTertiary},children:A.id.slice(0,8)})]})]},A.id)}),r.filter(A=>A.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:b.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${ke?"rgba(65,71,84,0.1)":b.border}`,backgroundColor:ke?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:b.textTertiary},onMouseEnter:A=>A.currentTarget.style.color=b.textPrimary,onMouseLeave:A=>A.currentTarget.style.color=b.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:A=>!o&&(A.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:A=>!o&&(A.currentTarget.style.filter="brightness(1)"),children:o?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 Zm=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -406,39 +406,39 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
406
406
|
|
|
407
407
|
Always try to match task names case-insensitively and handle partial matches.
|
|
408
408
|
If you can't find a task by name, search through the provided task list.
|
|
409
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
410
|
-
${
|
|
409
|
+
If ambiguous, ask for clarification in the message field.`;function eg(e){return `CURRENT TASKS:
|
|
410
|
+
${tg(e).map(r=>{let n=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",o=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${n} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${o}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Zm(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Eo(e,t){let a=Zm(e),r=t.toLowerCase().trim(),n=a.find(l=>l.name.toLowerCase()===r);if(n)return n;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(l=>{let d=l.name.toLowerCase();return o.every(i=>d.includes(i))})}function tc(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 n=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let g={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}[n[1].toLowerCase()];if(g!==void 0){let f=new Date(r),x=f.getDay(),y=g-x;return y<=0&&(y+=7),f.setDate(f.getDate()+y),f}}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),g=s[2].toLowerCase(),f=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?f.setDate(f.getDate()+p):g==="week"||g==="semana"||g==="semanas"?f.setDate(f.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&f.setMonth(f.getMonth()+p),f}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),g=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,g,p)}let d={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),g=d[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(f,g,p)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let p=u[m[1].toLowerCase()],g=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):r.getFullYear();if(p!==void 0)return new Date(f,p,g)}return null}function ac(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),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function rc(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 eg(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 tg(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(),u=r[2].trim(),m=Eo(t,i),p=tc(u);if(!m)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:m.id,taskName:m.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(p);return f.setDate(f.getDate()+g),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:p,endDate:f},message:`Moved "${m.name}" to ${p.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),m=Eo(t,i),p=ac(u);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(m.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:g},message:`Extended "${m.name}" by ${p} days. New end date: ${g.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(),u=s[2].trim(),m=Eo(t,i),p=rc(u);return m?p===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:p},message:`Set "${m.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 o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),m=Eo(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:u},message:`Renamed "${m.name}" to "${u}".`,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(),u=l[2].trim(),m=Eo(t,i),p=Eo(t,u);return m?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:m.id,dependencyTo:p.id,message:`Linked "${m.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let d=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]){let i=d[1].trim(),u=Eo(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 ag(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 w2(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 k2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Zi(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let m=a.find(p=>p.id===u);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Zi(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},l=o(e.startDate),d=o(e.endDate),i=e.metadata?.isMilestone===true||l&&d&&Math.abs(d.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:d,progress:e.progress||0,status:w2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function rg(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:k2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function og(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Zi(r,e,t))}var oc={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},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"}},nc={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},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"}},el={en:oc,es:nc};function sc(e){return el[e]||el.en}function tl(e,t){let a=sc(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 ic=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function ng(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 sg({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let g=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let d=ng(e),i=ic[0],u=ic.find(g=>g.value===d)??i,m=u.icon,p=g=>{switch(ng(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(m,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:c("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),o(!s);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(m,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:c("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:c("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:ic.map(g=>{let f=g.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),o(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",d===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:c("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var lc=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function lg({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let u=m=>{l.current&&!l.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let d=lc.find(u=>u.value===e)??lc[4],i=r==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:c("w-4 h-4",d.color)}),jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),o(!s);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:c("w-4 h-4",d.color)}),jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]}),jsx(ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:c("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:lc.map(u=>jsxs("button",{onClick:m=>{m.stopPropagation(),t(u.value),o(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:c("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function Hs(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function dc(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],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-[#00E5CC]"}function cc({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,l]=useState(false),[d,i]=useState(""),u=useRef(null),m=useRef(null);useEffect(()=>{let x=y=>{u.current&&!u.current.contains(y.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let p=t.filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),g=x=>e.some(y=>y.name===x),f=x=>{if(a){if(g(x.name))a(e.filter(y=>y.name!==x.name));else {let y={name:x.name,initials:Hs(x.name),color:x.color||dc(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,y]);}l(false),i("");}};return s||!a?e.length===0?jsx("span",{className:c("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,y)=>jsx("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&dc(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Hs(x.name)},`${x.name}-${y}`)),e.length>3&&jsxs("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),l(!o);},className:c("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:c("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:c("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,y)=>jsx("div",{className:c("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&dc(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Hs(x.name)},`${x.name}-${y}`)),e.length>2&&jsxs("span",{className:c("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:m,type:"text",value:d,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,y)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||Hs(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:b=>{b.stopPropagation(),a(e.filter(h=>h.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${y}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let y=g(x.name);return jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{y||(b.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):Hs(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),y&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function gg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:d}){let[i,u]=useState(false),[m,p]=useState(n),[g,f]=useState(()=>{let k=n==="start"?e:t;if(k){let j=k instanceof Date?k:new Date(k);return new Date(j.getFullYear(),j.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),y=useRef(null),b=useRef(null),[h,v]=useState(null),w=e?e instanceof Date?e:new Date(e):null,N=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let k=j=>{let U=j.target;x.current&&x.current.contains(U)||b.current&&b.current.contains(U)||u(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),useLayoutEffect(()=>{if(!i){v(null);return}let k=()=>{let j=y.current?.getBoundingClientRect();if(!j)return;let U=520,ae=360,L=window.innerHeight-j.bottom,X=L<ae&&j.top>L,K=X?j.top-4:j.bottom+4,V=Math.min(Math.max(j.left,8),window.innerWidth-U-8);v({top:K,left:V,flipUp:X});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[i]),useEffect(()=>{i&&p(r?n:"start");},[i,r,n]);let D=k=>k?k.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):d||"-",F=useCallback(()=>{let k=g.getFullYear(),j=g.getMonth(),U=new Date(k,j,1),L=new Date(k,j+1,0).getDate(),X=U.getDay(),K=[],R=new Date(k,j,0).getDate();for(let Te=X-1;Te>=0;Te--)K.push({date:new Date(k,j-1,R-Te),isCurrentMonth:false});for(let Te=1;Te<=L;Te++)K.push({date:new Date(k,j,Te),isCurrentMonth:true});let J=42-K.length;for(let Te=1;Te<=J;Te++)K.push({date:new Date(k,j+1,Te),isCurrentMonth:false});return K},[g]),T=k=>{if(r)n==="start"?a(k,N||void 0):a(w||void 0,k),u(false);else if(m==="start"){let j=N&&k>N?k:N;a(k,j||void 0),p("end");}else {let j=w&&k<w?k:w;a(j||void 0,k),u(false);}},S=()=>{let k=new Date,j=new Date(k);j.setDate(k.getDate()+1);let U=new Date(k);U.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let ae=new Date(k);ae.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let L=new Date(k);L.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let K=new Date(k);return K.setDate(k.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:j,display:j.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:U,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ae,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:K,display:K.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let k=r&&n==="start"?w:N;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:D(k)})]})}let P=r&&n==="start"?w:N;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{ref:y,onClick:k=>{k.stopPropagation(),u(!i);let j=n==="start"?w:N;j&&f(new Date(j.getFullYear(),j.getMonth(),1));},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:D(P)})]}),i&&h&&createPortal(jsxs("div",{ref:b,className:c("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:k=>k.stopPropagation(),children:[jsxs("div",{className:c("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[S().map((k,j)=>jsxs("button",{className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(k.date),children:[jsx("span",{children:k.label}),jsx("span",{className:c("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},j)),jsx("div",{className:c("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,N||void 0):a(w||void 0,void 0):a(void 0,void 0),u(false);},className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:c("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:m==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:c("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(new Date),className:c("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>f(new Date(g.getFullYear(),g.getMonth()-1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:c("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(g.getFullYear(),g.getMonth()+1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:c("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:F().map((k,j)=>{let U=k.date.toDateString()===new Date().toDateString(),ae=w?.toDateString()===k.date.toDateString(),L=N?.toDateString()===k.date.toDateString(),X=ae||L,K=!r&&w&&N&&k.date>=w&&k.date<=N;return jsx("button",{onClick:()=>T(new Date(k.date)),className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),U&&"ring-2 ring-[#00E5CC]",ae&&"bg-[#00E5CC] text-white",L&&!ae&&"bg-[#7C3AED] text-white",K&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},j)})})]})]}),document.body)]})}function nl({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let d=e?e instanceof Date?e:new Date(e):null;return jsx(gg,{startDate:s==="start"?d:o||null,endDate:s==="end"?d:l||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function ts(e=600){let[t,a]=useState(false),r=useRef(null),n=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:n}}function sl(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[l,d]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,p=e,g=p-m,f=r/n;d(true);for(let x=1;x<=n;x++){let y=setTimeout(()=>{let b=x/n,h=1-Math.pow(1-b,3),v=Math.round(m+g*h);o(v),x===n&&(d(false),o(p));},f*x);u.current.push(y);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:l}}function fg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,l]=useState(0),d=useRef(null),i=useRef(null),u=useCallback(g=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(g),l(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,y=Math.min(x/a*100,100);l(y);},16),d.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),m=useCallback(()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:m}}function hg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=useState(false),[d,i]=useState(""),u=useRef(null),{isFlashing:m,triggerFlash:p}=ts(),{displayValue:g,isAnimating:f}=sl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(r||!t)return;w.stopPropagation();let N=w.currentTarget.getBoundingClientRect(),D=w.clientX-N.left,F=Math.round(D/N.width*100),T=Math.max(0,Math.min(100,F));T!==e&&(t(T),s&&p());},y=useCallback(w=>{r||!t||(w.stopPropagation(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let b=useCallback(()=>{l(false);let w=parseInt(d,10);if(!isNaN(w)&&t){let N=Math.max(0,Math.min(100,w));N!==e&&(t(N),s&&p());}},[d,t,e,s,p]),h=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),v=g??e;return jsxs("div",{className:c("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsx("div",{onClick:x,className:c("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:c("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${v}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:u,value:d,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:c("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:c("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:y,className:c("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[v,"%"]})]})}function vg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[l,d]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{d(e);},[e]);let u=()=>{l!==e&&t?.(l),o(false);},m=p=>{p.key==="Enter"?u():p.key==="Escape"&&(d(e),o(false));};return n||!t?jsx("span",{className:c("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>d(p.target.value),onBlur:u,onKeyDown:m,onClick:p=>p.stopPropagation(),className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),o(true);},className:c("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Cg({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:d=true}){let[i,u]=useState(false),[m,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:f,triggerFlash:x}=ts(),{displayValue:y,isAnimating:b}=sl(e,{enabled:l&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let w=parseFloat(m);if(!isNaN(w)){let N=w;n!==void 0&&(N=Math.max(n,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),d&&x());}u(false);},v=w=>{w.key==="Enter"?h():w.key==="Escape"&&(p(e?.toString()||""),u(false));};return o||!t?jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:r}):i?jsx("input",{ref:g,type:"number",value:m,onChange:w=>p(w.target.value),onBlur:h,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),u(true);},className:c("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",y===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:r})}function Tg({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,l]=useState(false),d=useRef(null);return useEffect(()=>{let i=u=>{d.current&&!d.current.contains(u.target)&&l(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!a?jsx("span",{className:c("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!o);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:c("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:c("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:c("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-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:c("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),l(false);},className:c("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"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-[#00E5CC]"})]},i))})]})}function Dg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:d,startChange:i,cancelChange:u}=fg(t,{delay:s}),m=g=>{g.stopPropagation(),!r&&t&&(n?l?u():i(!e):t(!e));},p=l?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:m,disabled:r||!t,className:c("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] 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-[#050505]":"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:`${d/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:g=>{g.stopPropagation(),u();},className:c("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 Mg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:c("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=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-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className:c("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function s1(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 i1(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),d=parseInt(a[2],10);return l*60+d}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),d=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+d}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Pr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:d="hours",hourlyRate:i=0,financialOverride:u}){let[m,p]=useState(false),[g,f]=useState(""),x=useRef(null),{isFlashing:y,triggerFlash:b}=ts(),h=d==="financial"&&(i>0||u!=null),v=u??(e?e/60*i:0),w=h&&(u!=null?u>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:s1(e,r);useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),S=e%60;T>0&&S>0?f(`${T}h ${S}m`):T>0?f(`${T}h`):f(`${S}m`);}else f("");},[e,m]);let N=()=>{let T=i1(g);T!==e&&(t?.(T),o&&b()),p(false);},D=T=>{T.key==="Enter"?N():T.key==="Escape"&&p(false);};if(l)return 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:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let F=h?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(F,{className:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):m?jsx("input",{ref:x,type:"text",value:g,onChange:T=>f(T.target.value),onBlur:N,onKeyDown:D,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),p(true);},className:c("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",y&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(F,{className:c("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function Lg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:c("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=d=>d.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let d=n==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:d?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:d?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:c("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Bg({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:d=0}){let i=a==="es",u=l==="financial"&&d>0,m=K=>u?`$${Math.round(K*d).toLocaleString("en-US")}`:`${K}h`,[p,g]=useState(false),[f,x]=useState(false),[y,b]=useState(null),h=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,N=e.soldEffortMinutes||0,D=Math.round(v/60*10)/10,F=Math.round(w/60*10)/10,T=w>0?v/w*100:0,S=T>100?Math.round((v-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!y)return;let K=V=>{h.current&&!h.current.contains(V.target)&&(x(false),b(null));};return document.addEventListener("mousedown",K),()=>document.removeEventListener("mousedown",K)},[f,y]);let k=K=>{if(K.stopPropagation(),r&&!n&&!s){b("log");return}if(r||n||s){x(V=>!V),b(null);return}o&&o(e);},j=K=>{x(false),b(K);},U=async(K,V)=>{y==="log"&&r&&K?r(e,K,V):y==="estimate"&&n?n(e,K):y==="quoted"&&s&&s(e,K),b(null);},ae=r||n||s||o,L=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(K=>K.show),X=y==="estimate"?w:y==="quoted"?N:void 0;return w===0&&v===0&&N===0?jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:K=>K.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:c("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&ae&&jsx("button",{onClick:k,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:K=>{K.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",K.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:K=>{K.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",K.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(K=>jsxs("button",{onClick:V=>{V.stopPropagation(),j(K.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(K.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),K.label]},K.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(co,{mode:y,locale:a,isDark:t,currentValue:X||void 0,onSave:U,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:K=>K.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let K=v===0,R=(w>0?v/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:K?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(D)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(F)]}),S>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:R?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:R?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(S)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),ae&&jsx("button",{onClick:k,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:K=>{K.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",K.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:K=>{K.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",K.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(K=>jsxs("button",{onClick:V=>{V.stopPropagation(),j(K.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(K.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),K.label]},K.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(co,{mode:y,locale:a,isDark:t,currentValue:X||void 0,onSave:U,onClose:()=>b(null)})})})})]})}function g1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function f1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function Rg({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:c(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:c(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Og({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=g1(e);if(u.length===0)return null;let m=u.slice(0,3),p=u.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:m.map((g,f)=>jsx(Rg,{assignee:g,size:24,isDark:t},g.name+f))}),p>0&&jsxs("span",{className:c("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:c("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,d=!!o&&l>0,i=d?f1(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Rg,{assignee:s,size:28,isDark:t}),jsx("span",{className:c("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),d&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var b1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Hg({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:c("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxs("span",{className:c("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",b1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function F1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function A1(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 _g({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:d,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:m,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:f,onTaskIndent:x,onTaskOutdent:y}){let b=useRef(null),h=r==="es"?Wg.es:Wg.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let S=b.current;if(!S)return;let P=S.getBoundingClientRect(),k=8,j=e.x,U=e.y;e.y+P.height>window.innerHeight-k&&(U=Math.max(k,e.y-P.height)),e.x+P.width>window.innerWidth-k&&(j=Math.max(k,window.innerWidth-P.width-k)),(j!==e.x||U!==e.y)&&w({left:j,top:U});},[e.x,e.y,e.isOpen]),useEffect(()=>{let S=k=>{b.current&&!b.current.contains(k.target)&&t();},P=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",S),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let N=()=>{if(!e.task)return [];let S=[];return n&&S.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),S.push({id:"sep1",label:"",icon:null,separator:true}),l&&(S.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.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:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),S.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.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:h.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:h.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:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&S.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],U=k.some(ae=>ae.name===P.name)?k.filter(ae=>ae.name!==P.name):[...k,{name:P.name,initials:F1(P.name),color:P.color||A1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:U}),t();}}))})),m&&S.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),p&&S.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&S.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),S.push({id:"sep2",label:"",icon:null,separator:true}),s&&S.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||y)&&(S.push({id:"sep3",label:"",icon:null,separator:true}),f&&(S.push({id:"move-up",label:h.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),S.push({id:"move-down",label:h.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&S.push({id:"indent",label:h.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),y&&S.push({id:"outdent",label:h.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),o&&S.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),S},D=()=>{if(!e.columnId)return [];let S=[];return i&&(S.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),S.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),d&&e.columnId!=="name"&&(S.push({id:"sep-hide",label:"",icon:null,separator:true}),S.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{d(e.columnId),t();}})),S},F=e.type==="task"?N():D(),T={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:T,className:c("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:F.map(S=>S.separator?jsx("div",{className:c("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},S.id):S.submenu?jsx(L1,{item:S,isDark:a},S.id):jsxs("button",{onClick:S.onClick,className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",S.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:c(S.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:S.icon}),S.label]},S.id))})}function L1({item:e,isDark:t}){let[a,r]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:c("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:c("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Wg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",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",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",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",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var e0={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"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{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"})},X1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function a0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:l}){let[d,i]=useState(""),[u,m]=useState(null),[p,g]=useState(null),f=useRef(null),x=l==="es"?t0.es:t0.en;useLayoutEffect(()=>{if(!e||!f.current)return;let F=()=>{if(!f.current)return;let T=f.current.parentElement;if(T){let j=T.getBoundingClientRect();g({top:j.bottom+4,right:window.innerWidth-j.right});}let S=f.current.getBoundingClientRect(),k=window.innerHeight-S.top-20;m(Math.max(300,k));};return requestAnimationFrame(F),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[e]),useEffect(()=>{if(!e)return;let F=setTimeout(()=>{let T=P=>{f.current&&!f.current.contains(P.target)&&t();},S=P=>{P.key==="Escape"&&t();};document.addEventListener("mousedown",T),document.addEventListener("keydown",S),f._cleanup=()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",S);};},100);return ()=>{clearTimeout(F),f._cleanup&&f._cleanup();}},[e,t]);let y=useMemo(()=>{let F=new Set([...X1]);return a.forEach(T=>{T.type&&T.type!=="assignees"&&F.add(T.type);}),Array.from(F)},[a]);if(!e)return null;let b=F=>{let T=x.columns[F];if(T)return T;let S=a.find(P=>P.type===F);return S?.label?S.label:F},h=F=>{if(F==="name")return;let T=a.map(S=>S.id===F?{...S,visible:!S.visible}:S);n(T);},v=(F,T)=>{let S=a.find(k=>k.type===F&&(!T||k.customFieldId===T));if(S){h(S.id);return}let P={id:T||F,type:F,label:T?r.find(k=>k.id===T)?.name||F:b(F),width:120,visible:true,sortable:true,resizable:true,customFieldId:T};n([...a,P]);},w=y.filter(F=>F!=="assignees"&&b(F).toLowerCase().includes(d.toLowerCase())),N=r.filter(F=>F.name.toLowerCase().includes(d.toLowerCase())),D=o?"#00E5FF":"#00E5CC";return jsxs("div",{ref:f,style:{...u?{maxHeight:`${u}px`}:{},...p?{top:p.top,right:p.right}:{},background:o?"#111114":"#FFFFFF",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:o?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:o?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",F.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:o?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:d,onChange:F=>i(F.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:o?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:F=>{F&&F.style.setProperty("--focus-border",D);},onFocus:F=>{F.currentTarget.style.borderColor=D,F.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:F=>{F.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",F.currentTarget.style.background=o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:F=>F.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:w.map(F=>{let T=a.find(k=>k.type===F&&!k.customFieldId),S=T?.visible??false,P=F==="name";return jsxs("button",{onClick:()=>{P||(T?h(T.id):v(F));},disabled:P,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:P?.4:1,cursor:P?"not-allowed":"pointer"},onMouseEnter:k=>{P||(k.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?D:"transparent",border:S?`1.5px solid ${D}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${D}40`:"none"},children:S&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:S?D:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:e0[F]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:S?500:400,color:S?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:b(F),children:b(F)})]},F)})})]}),N.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:N.map(F=>{let S=a.find(P=>P.customFieldId===F.id)?.visible??false;return jsxs("button",{onClick:()=>v(F.type,F.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:P=>{P.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?D:"transparent",border:S?`1.5px solid ${D}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${D}40`:"none"},children:S&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:S?D:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:e0[F.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:S?500:400,color:S?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:F.name})]},F.id)})})]})]})]})}var t0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var nw=[{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 n0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[l,d]=useState("text"),[i,u]=useState([""]),m=n==="es"?o0.es:o0.en;useEffect(()=>{e&&(o(""),d("text"),u([""]));},[e]),useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let p=()=>{if(!s.trim())return;let y={name:s.trim(),type:l};l==="dropdown"&&(y.options=i.filter(b=>b.trim())),a(y),t();},g=()=>{u([...i,""]);},f=(y,b)=>{let h=[...i];h[y]=b,u(h);},x=y=>{i.length>1&&u(i.filter((b,h)=>h!==y));};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:c("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:c("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:c("text-lg font-semibold",r?"text-white":"text-gray-900"),children:m.title}),jsx("button",{onClick:t,className:c("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:c("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.fieldName}),jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:m.fieldNamePlaceholder,className:c("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:nw.map(y=>jsxs("button",{onClick:()=>d(y.type),className:c("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===y.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===y.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:y.icon}),jsx("span",{className:c("text-xs",l===y.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:m.types[y.type]})]},y.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.options}),jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:y,onChange:h=>f(b,h.target.value),placeholder:`${m.option} ${b+1}`,className:c("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>x(b),className:c("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:g,className:c("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxs("div",{className:c("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:m.create})]})]})]}):null}var o0={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 l0={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 d0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,l]=useState(false),d=useRef(null),i=useRef(0),u=s==="es"?l0.es:l0.en;useEffect(()=>{if(!o)return;let g=x=>{Date.now()-i.current<100||d.current&&!d.current.contains(x.target)&&l(false);},f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,p&&jsx("span",{className:c("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:c("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:c("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:c("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:m.map(g=>{let f=e===g.value&&!t,x=()=>g.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:c("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:c(f?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:c("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:g.label}),f&&jsx(Check,{className:c("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},g.value)})}),jsx("div",{className:c("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:c("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:c("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:c("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:c("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function c0(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function wn(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function u0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",l=n==="financial";return jsxs("div",{className:c("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:c("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:c("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:c("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let d=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,m=d-u,p=d>0?Math.round(m/d*100):0,g=d>0?Math.min(Math.round(u/d*100),120):0,f=u>d&&d>0,x=f?"#F87171":"#00E5CC";return jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:wn(d)})]}),(()=>{let y=e.totalEstimatedLabor??0,b=e.totalEstimatedEquipment??0,h=e.totalEstimatedTravel??0,v=b>0||h>0,w=(N,D)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:N}),jsx("span",{className:c("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:wn(D)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:wn(i)})]}),v&&jsxs(Fragment,{children:[w(o?"Mano de obra":"Labor",y),b>0&&w(o?"Activos":"Equipment",b),h>0&&w(o?"Vi\xE1ticos":"Travel",h)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,b=e.totalExecutedEquipment??0,h=e.totalExecutedTravel??0,v=b>0||h>0,w=(N,D)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:N}),jsx("span",{className:c("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:wn(D)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:c("text-[11px] font-mono font-bold",f?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:wn(u)})]}),v&&jsxs(Fragment,{children:[w(o?"Mano de obra":"Labor",y),b>0&&w(o?"Activos":"Equipment",b),h>0&&w(o?"Vi\xE1ticos":"Travel",h)]})]})})(),d>0&&jsx("div",{className:c("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(g,100)}%`,backgroundColor:x}})}),jsxs("div",{className:c("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[m>=0?`+${wn(m)} ${o?"Disp.":"Avail."}`:`${wn(Math.abs(m))} ${o?"P\xE9rdida":"Loss"}`,d>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",p,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let d=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(d/i*100),100):0,g=(i>0?d/i:0)>1.1?"#F87171":u>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:c0(d)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:c("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:c0(i)})]}),i>0&&jsx("div",{className:c("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,backgroundColor:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:c("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:c("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:c("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:c("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:c("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(d=>jsxs("button",{onClick:()=>s?.(d.id),className:c("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:c("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:d.name})]},d.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let d=e.scheduleVarianceDays??0,i=d>0,u=d<0,m=e.scheduleVarianceLabel||(i?`+${d} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${d} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:c("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((d,i)=>{let u=d.utilizationPercent>=100?"#F87171":d.utilizationPercent>=80?"#FFD60A":d.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:d.name}),jsxs("span",{className:c("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[d.utilizationPercent,"%"]})]}),jsx("div",{className:c("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(d.utilizationPercent,100)}%`,backgroundColor:u}})})]},`${d.name}-${i}`)})})]})]})}var ww=[{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 x0(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...x0(n.subtasks,t+1,s));}return r}function kw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),d=s.endDate.getTime()-o;if(d<=0)continue;let u=Math.max(0,Math.min(a.getTime()-o,d))/d*100;if(u<=0)continue;let m=(s.progress||0)/u;r+=m,n++;}return n>0?r/n:null}function is(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=is(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function ss(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Cw({value:e,onChange:t,isDark:a}){let[r,n]=useState(false),[s,o]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:c("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:c("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function h0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let l of e){let d=l.weight||0;d>0&&(t+=(l.progress||0)*d,a+=d,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((l,d)=>l+(d.effort_minutes||0),0)>0){let l=0,d=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,d+=u;}return Math.round(l/d*10)/10}let o=e.reduce((l,d)=>l+(d.progress||0),0);return Math.round(o/e.length*10)/10}function Sc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?Sc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function v0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:l=[],customFields:d=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:m,filterDotColor:p="#00E5CC"}){let{theme:g="dark",locale:f="en",customTranslations:x,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:w=true,enableContextMenu:N=true,showCreateTaskButton:D=false,onCreateTask:F,persistFilter:T=false,financialBlur:S,healthSidebar:P,lens:k="hours",hourlyRate:j=0,rateMap:U,aggregateParentHours:ae=false,showProjectTotals:L=false,totalsDollarOverride:X}=t,K=tl(f,x),V=g==="dark",R=E=>{if(!U||!E.assignees||E.assignees.length===0)return j;let oe=0,he=0;for(let Le of E.assignees){let qe=Le.id?U[Le.id]:void 0;if(qe==null||qe<=0)continue;let me=typeof Le.estimatedMinutes=="number"?Le.estimatedMinutes:0;me>0&&(oe+=qe*me,he+=me);}if(he>0)return oe/he;let De=E.assignees.map(Le=>Le.id?U[Le.id]:void 0).filter(Le=>Le!=null&&Le>0);return De.length===0?j:De.reduce((Le,qe)=>Le+qe,0)/De.length},J=E=>{let oe=0,he=0,De=0,Le=qe=>{for(let me of qe)if(me.subtasks&&me.subtasks.length>0){let _e={s:oe,a:he,q:De};if(Le(me.subtasks),oe-_e.s+(he-_e.a)+(De-_e.q)===0){let ut=R(me);oe+=(me.timeLoggedMinutes??0)/60*ut,he+=(me.effortMinutes??0)/60*ut,De+=(me.soldEffortMinutes??0)/60*ut;}}else {let _e=R(me);oe+=(me.timeLoggedMinutes??0)/60*_e,he+=(me.effortMinutes??0)/60*_e,De+=(me.soldEffortMinutes??0)/60*_e;}};return E.subtasks&&Le(E.subtasks),{dollarSpent:oe,dollarAllocated:he,dollarQuoted:De}},Te=useCallback(()=>{if(!T||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let E=localStorage.getItem(T);if(E){let oe=JSON.parse(E);return {statusFilter:oe.statusFilter||"all",hideCompleted:oe.hideCompleted||!1}}}catch(E){console.error("Error loading persisted filter:",E);}return {statusFilter:"all",hideCompleted:false}},[T]),$e=useMemo(()=>{function E(oe){let he=0,De=0,Le=0,qe=0,me=0,_e=0;for(let Fe of oe)if(Fe.subtasks&&Fe.subtasks.length>0){let ut=E(Fe.subtasks);if(ut.spent+ut.allocated+ut.quoted>0)he+=ut.spent,De+=ut.allocated,Le+=ut.quoted,qe+=ut.dollarSpent,me+=ut.dollarAllocated,_e+=ut.dollarQuoted;else {let Et=Fe.timeLoggedMinutes??0,Ft=Fe.effortMinutes??0,Ca=Fe.soldEffortMinutes??0;he+=Et,De+=Ft,Le+=Ca;let La=R(Fe);qe+=Et/60*La,me+=Ft/60*La,_e+=Ca/60*La;}}else {let ut=Fe.timeLoggedMinutes??0,Kt=Fe.effortMinutes??0,Et=Fe.soldEffortMinutes??0;he+=ut,De+=Kt,Le+=Et;let Ft=R(Fe);qe+=ut/60*Ft,me+=Kt/60*Ft,_e+=Et/60*Ft;}return {spent:he,allocated:De,quoted:Le,dollarSpent:qe,dollarAllocated:me,dollarQuoted:_e}}return E(e)},[e]),H=useMemo(()=>{let E=new Map;function oe(he){let De=0;for(let Le of he)if(Le.subtasks&&Le.subtasks.length>0){let qe=oe(Le.subtasks);E.set(Le.id,qe),De+=qe;}else De+=Le.weight||0;return De}return oe(e),E},[e]),te=useMemo(()=>!P?.enabled||!P.data?P:{...P,data:{...P.data,totalHoursSpentMinutes:$e.spent,totalHoursAllocatedMinutes:$e.allocated}},[P,$e]),[ye,Re]=useState(true),[Se,Ee]=useState(null),[Ve,ot]=useState("position"),[be,Ge]=useState("asc"),[je,He]=useState(""),[wt,Nt]=useState(()=>Te().statusFilter),[Je,ze]=useState(()=>Te().hideCompleted),[lt,At]=useState(h||ww),[Ne,ft]=useState(false),[A,ie]=useState(false),[B,Z]=useState({isOpen:false,x:0,y:0,type:"task"}),[O,ee]=useState(null),[Ue,ke]=useState(false),[Be,Me]=useState(null),[Pe,nt]=useState(null),[at,dt]=useState(null),mt=useRef(0),Vt=useRef(false),Mt=!!(a.onTaskMove||a.onTaskReparent),[zt,gt]=useState(null),[Dt,Ut]=useState(null),Gt=E=>E==="assignees"||E==="teamLoad"?"assignees":E==="startDate"?"startDate":E==="endDate"?"endDate":null,Rt=useRef([]),rt=useCallback((E,oe)=>{Mt&&(oe.preventDefault(),mt.current=oe.clientY,ee(E),Vt.current=false,ke(false),dt({x:oe.clientX,y:oe.clientY}));},[Mt]),ia=useCallback(E=>{if(!O||(Math.abs(E.clientY-mt.current)>5&&!Vt.current&&(Vt.current=true,ke(true)),dt({x:E.clientX,y:E.clientY}),!Vt.current))return;let he=document.querySelectorAll("[data-listview-row]"),De=null,Le=null;he.forEach(qe=>{let me=qe.getBoundingClientRect(),_e=qe.getAttribute("data-listview-row");if(_e&&_e!==O&&E.clientY>=me.top&&E.clientY<=me.bottom){De=_e;let Fe=E.clientY-me.top,ut=me.height;Le=Fe<ut*.25?"above":Fe>ut*.75?"below":"child";}}),Me(De),nt(Le);},[O]),fa=useCallback(()=>{if(Vt.current&&O&&Be&&Pe){if(Pe==="child"&&a.onTaskReparent)a.onTaskReparent(O,Be);else if(Pe==="above"||Pe==="below"){let E=(De,Le,qe=null)=>{for(let me of De){if(me.id===Le)return qe;if(me.subtasks){let _e=E(me.subtasks,Le,me.id);if(_e!==void 0)return _e}}},oe=E(e,O,null),he=E(e,Be,null);if(a.onTaskReparent){let De=(ut,Kt)=>{if(Kt===null)return ut;for(let Et of ut){if(Et.id===Kt)return Et.subtasks||[];if(Et.subtasks){let Ft=De(Et.subtasks,Kt);if(Ft.length>0||Et.subtasks.some(Ca=>Ca.id===Kt))return Ft}}return []},Le=De(e,he??null),qe=Le.findIndex(ut=>ut.id===Be),me=oe===he,_e=me?Le.findIndex(ut=>ut.id===O):-1,Fe=Pe==="below"?qe+1:qe;me&&_e!==-1&&_e<qe&&(Fe-=1),a.onTaskReparent(O,he??null,Math.max(0,Fe));}}}ee(null),Me(null),nt(null),dt(null),Vt.current=false,ke(false);},[O,Be,Pe,e,a]),W=(E,oe)=>oe==="assignees"?E.assignees:oe==="startDate"?E.startDate:E.endDate,le=(E,oe,he,De)=>{E.preventDefault(),E.stopPropagation(),Ut({sourceTaskId:oe,column:he,sourceIndex:De,targetIndex:De});let Le=Array.from(document.querySelectorAll("[data-listview-row]")),qe=Fe=>{let ut=De;return Le.forEach((Kt,Et)=>{let Ft=Kt.getBoundingClientRect();Fe>=Ft.top&&Fe<=Ft.bottom&&(ut=Et);}),ut<De&&(ut=De),ut},me=Fe=>{let ut=qe(Fe.clientY);Ut(Kt=>Kt&&{...Kt,targetIndex:ut});},_e=Fe=>{window.removeEventListener("mousemove",me),window.removeEventListener("mouseup",_e),Ut(null);let ut=qe(Fe.clientY);if(!Le.find(_t=>_t.getAttribute("data-listview-row")===oe))return;let Et=Rt.current.find(_t=>_t.id===oe);if(!Et)return;let Ft=W(Et,he),Ca=Math.min(De,ut),La=Math.max(De,ut),Ia=[];for(let _t=Ca;_t<=La;_t++){if(_t===De)continue;let na=Rt.current[_t];na&&(na.subtasks&&na.subtasks.length>0||Ia.push(na.id));}Ia.length>0&&a.onBulkFill?.(Ia,he,Ft);};window.addEventListener("mousemove",me),window.addEventListener("mouseup",_e);},st=E=>{if(!Dt)return false;let oe=Math.min(Dt.sourceIndex,Dt.targetIndex),he=Math.max(Dt.sourceIndex,Dt.targetIndex);return E>=oe&&E<=he};useEffect(()=>{if(O)return document.addEventListener("mousemove",ia),document.addEventListener("mouseup",fa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ia),document.removeEventListener("mouseup",fa),document.body.style.cursor="",document.body.style.userSelect="";}},[O,ia,fa]);let[jt,re]=useState("all"),[xe,Tt]=useState(false),bt=useRef(null),pt=useRef(null),it=useMemo(()=>{let E=0;function oe(he,De){for(let Le of he)De>E&&(E=De),Le.subtasks?.length&&oe(Le.subtasks,De+1);}return oe(e,1),E},[e]);useEffect(()=>{if(!xe)return;let E=oe=>{bt.current?.contains(oe.target)||pt.current?.contains(oe.target)||Tt(false);};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[xe]),useEffect(()=>{if(jt==="all"){let he=function(De){for(let Le of De)Le.subtasks?.length&&(Le.isExpanded===false&&a.onTaskToggleExpand?.(Le.id),he(Le.subtasks));};he(e);}else {let he=function(De,Le){for(let qe of De)if(qe.subtasks?.length){let me=Le<jt,_e=qe.isExpanded!==false;me!==_e&&a.onTaskToggleExpand?.(qe.id),he(qe.subtasks,Le+1);}};he(e,1);}},[jt]);let[q,fe]=useState(null),[ce,$]=useState(0),[ne,Ke]=useState(0),C=useRef(null),[z,ve]=useState(null),[Y,Ze]=useState(null);useEffect(()=>{h&&At(E=>{if(E.length===h.length){let oe=true;for(let he=0;he<E.length;he++){let De=E[he],Le=h[he];if(!De||!Le||De.id!==Le.id||De.visible!==Le.visible||De.width!==Le.width||De.label!==Le.label){oe=false;break}}if(oe)return E}return h});},[h]),useEffect(()=>{if(!(!T||typeof window>"u"))try{localStorage.setItem(T,JSON.stringify({statusFilter:wt,hideCompleted:Je}));}catch(E){console.error("Error persisting filter state:",E);}},[T,wt,Je]);let Ct=useMemo(()=>{let E=new Set;function oe(he){for(let De of he)De.subtasks?.length&&(De.isExpanded!==false&&E.add(De.id),oe(De.subtasks));}return oe(e),E},[e]),St=useMemo(()=>lt.filter(E=>E.visible),[lt]),Na=useCallback(E=>{a.onTaskToggleExpand?.(E);},[a]),xa=useCallback(E=>{Ve===E?Ge(oe=>oe==="asc"?"desc":"asc"):(ot(E),Ge("asc")),a.onSortChange?.({column:E,direction:be==="asc"?"desc":"asc"});},[Ve,be,a]),Qt=useCallback(E=>{At(E),a.onColumnsChange?.(E);},[a]),ur=useCallback(E=>{let oe=lt.map(he=>he.id===E?{...he,visible:false}:he);Qt(oe);},[lt,Qt]),va=useCallback((E,oe)=>{ot(E),Ge(oe);},[]),Nr=useCallback((E,oe,he)=>{N&&(E.preventDefault(),Z({isOpen:true,x:E.clientX,y:E.clientY,type:oe?"task":"header",task:oe,columnId:he}));},[N]),Sn=useCallback(()=>{Z(E=>({...E,isOpen:false}));},[]),xo=useCallback((E,oe)=>{if(!w)return;E.preventDefault(),E.stopPropagation();let he=lt.find(De=>De.id===oe);he&&(fe(oe),$(E.clientX),Ke(he.width));},[lt,w]);useEffect(()=>{if(!q)return;let E=lt,oe=De=>{let Le=De.clientX-ce,qe=Math.max(50,ne+Le);E=E.map(me=>me.id===q?{...me,width:qe}:me),At(E);},he=()=>{a.onColumnsChange?.(E),fe(null);};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",he),()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",he);}},[q,ce,ne,a]);let Po=useCallback((E,oe)=>{if(oe==="name"){E.preventDefault();return}ve(oe),E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("text/plain",oe),E.currentTarget instanceof HTMLElement&&(E.currentTarget.style.opacity="0.5");},[]),En=useCallback(E=>{E.currentTarget instanceof HTMLElement&&(E.currentTarget.style.opacity="1"),ve(null),Ze(null);},[]),ti=useCallback((E,oe)=>{E.preventDefault(),oe!=="name"&&(E.dataTransfer.dropEffect="move",Ze(oe));},[]),Ja=useCallback(()=>{Ze(null);},[]),cs=useCallback((E,oe)=>{if(E.preventDefault(),!z||z===oe||oe==="name")return;let he=[...lt],De=he.findIndex(me=>me.id===z),Le=he.findIndex(me=>me.id===oe);if(De===-1||Le===-1)return;let qe=he.splice(De,1);qe[0]&&(he.splice(Le,0,qe[0]),Qt(he),ve(null),Ze(null));},[z,lt,Qt]),Or=useCallback(async E=>{if(a.onCreateCustomField){let oe={...E,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(oe);}ie(false);},[a]),$r=useCallback(E=>E.progress===100||E.status==="completed"?"completed":E.progress&&E.progress>0||E.status==="in-progress"?"in-progress":"todo",[]),Fr=useMemo(()=>{let E=x0(e);if(je.trim()){let oe=je.toLowerCase();E=E.filter(he=>he.name.toLowerCase().includes(oe));}if(wt!=="all"){let oe=new Set(E.filter(he=>$r(he)===wt).flatMap(he=>he.parentPath));E=E.filter(he=>oe.has(he.id));}if(Je){let oe=new Set(E.filter(he=>$r(he)!=="completed").flatMap(he=>he.parentPath));E=E.filter(he=>oe.has(he.id));}return E.sort((oe,he)=>{let De,Le;switch(Ve){case "name":De=oe.name.toLowerCase(),Le=he.name.toLowerCase();break;case "startDate":De=oe.startDate?.getTime()||0,Le=he.startDate?.getTime()||0;break;case "endDate":De=oe.endDate?.getTime()||0,Le=he.endDate?.getTime()||0;break;case "progress":De=oe.progress||0,Le=he.progress||0;break;case "status":De=oe.status||"todo",Le=he.status||"todo";break;case "priority":let qe={urgent:0,high:1,medium:2,low:3,none:4};De=qe[oe.priority]??4,Le=qe[he.priority]??4;break;case "position":return 0;default:return 0}return De<Le?be==="asc"?-1:1:De>Le?be==="asc"?1:-1:0}),E},[e,je,wt,Je,Ve,be,$r]);Rt.current=Fr;let Mn=useCallback((E,oe)=>{let he=qe=>{a.onTaskUpdate?.({...E,...qe});},De=qe=>qe?E.customFields?.find(_e=>_e.fieldId===qe)?.value:void 0,Le=(qe,me)=>{if(!qe)return;let Fe=[...E.customFields||[]],ut=Fe.findIndex(Kt=>Kt.fieldId===qe);ut>=0?Fe[ut]={fieldId:qe,value:me}:Fe.push({fieldId:qe,value:me}),he({customFields:Fe});};switch(oe.type){case "name":return null;case "status":return jsx(sg,{value:E.status||(E.progress===100?"completed":E.progress&&E.progress>0?"in-progress":"todo"),onChange:me=>{he({status:me,progress:me==="completed"?100:me==="in-progress"?50:0});},isDark:V,locale:f,translations:K.status});case "priority":return jsx(lg,{value:E.priority,onChange:me=>he({priority:me}),isDark:V,locale:f});case "assignees":{let me=E.hasChildren,_e=E.assignees||[];if(me&&E.subtasks?.length){let Fe=new Map,ut=Kt=>{(Kt||[]).forEach(Et=>{(Et.assignees||[]).forEach(Ft=>{Fe.has(Ft.name)||Fe.set(Ft.name,Ft);}),Et.subtasks?.length&&ut(Et.subtasks);});};ut(E.subtasks),_e=Array.from(Fe.values());}else me&&(_e=[]);return jsx(cc,{value:_e,availableUsers:l,onChange:Fe=>he({assignees:Fe}),isDark:V,locale:f,disabled:me})}case "startDate":return jsx(nl,{value:E.startDate,onChange:me=>he({startDate:me}),isDark:V,locale:f,dateField:"start",startDate:E.startDate,endDate:E.endDate});case "endDate":return jsx(nl,{value:E.endDate,onChange:me=>he({endDate:me}),isDark:V,locale:f,dateField:"end",startDate:E.startDate,endDate:E.endDate});case "progress":{let me=!!(E.subtasks&&E.subtasks.length>0),_e=me?h0(Sc(E.subtasks||[])):E.progress||0;return jsx(hg,{value:_e,onChange:me?void 0:Fe=>{let ut=Fe===100?"completed":Fe>0?"in-progress":"todo";he({progress:Fe,status:ut});},isDark:V,disabled:me})}case "tags":return jsx(Mg,{value:E.tags||[],isDark:V});case "text":return jsx(vg,{value:De(oe.customFieldId)||"",onChange:me=>Le(oe.customFieldId,me),isDark:V});case "number":return jsx(Cg,{value:De(oe.customFieldId)||0,onChange:me=>Le(oe.customFieldId,me),isDark:V});case "date":let qe=De(oe.customFieldId);return jsx(nl,{value:qe?new Date(qe):void 0,onChange:me=>Le(oe.customFieldId,me),isDark:V,locale:f});case "dropdown":return jsx(Tg,{value:De(oe.customFieldId)||"",options:oe.options||[],onChange:me=>Le(oe.customFieldId,me),isDark:V});case "checkbox":return jsx(Dg,{value:De(oe.customFieldId)||false,onChange:me=>Le(oe.customFieldId,me),isDark:V});case "estimatedTime":{let me=E.status==="completed"||E.progress===100;return jsx(Pr,{value:E.estimatedTime,onChange:_e=>he({estimatedTime:_e}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:R(E)})}case "quotedTime":{let me=E.status==="completed"||E.progress===100,_e=S?.enabled&&(!S.columns||S.columns.includes("quotedTime"));return jsx(Pr,{value:E.quotedTime,onChange:Fe=>he({quotedTime:Fe}),isDark:V,locale:f,disabled:me,isBlurred:_e,lens:k,hourlyRate:R(E)})}case "elapsedTime":{let me=E.status==="completed"||E.progress===100,_e=E.executedDollarsCanonical;return jsx(Pr,{value:E.elapsedTime,onChange:Fe=>he({elapsedTime:Fe}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:R(E),financialOverride:_e})}case "effortMinutes":{if(ae&&E.subtasks&&E.subtasks.length>0){let{allocated:Kt}=is(E);if(k==="financial"){let Et=J(E),Ft=Math.round(Et.dollarAllocated),Ca=Math.round(Et.dollarQuoted),La=Ca-Ft;return jsxs("div",{className:"flex flex-col",children:[Ft>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",Ft.toLocaleString("es-CO")]}):null,La!==0&&Ft>0&&Ca>0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",La>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[La>0?"+":"",Math.abs(La)>=1e3?`$${(La/1e3).toFixed(1)}K`:`$${La}`]})]})}return jsx(Pr,{value:Kt>0?Kt:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:j})}let me=E.status==="completed"||E.progress===100,_e=E.effortMinutes||0,Fe=E.soldEffortMinutes||0,ut=R(E);if(k==="financial"&&ut&&_e>0&&Fe>0){let Kt=Math.round(_e/60*ut),Ft=Math.round(Fe/60*ut)-Kt;return jsxs("div",{className:"flex flex-col",children:[jsx(Pr,{value:_e,onChange:Ca=>he({effortMinutes:Ca}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:R(E)}),Ft!==0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ft>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ft>0?"+":"",Math.abs(Ft)>=1e3?`$${(Ft/1e3).toFixed(1)}K`:`$${Ft}`]})]})}return jsx(Pr,{value:_e,onChange:Kt=>he({effortMinutes:Kt}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:R(E)})}case "timeLoggedMinutes":{let me=E.executedDollarsCanonical;if(ae&&E.subtasks&&E.subtasks.length>0){let{spent:Fe}=is(E);return jsx(Pr,{value:Fe>0?Fe:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:R(E),financialOverride:me})}let _e=E.status==="completed"||E.progress===100;return jsx(Pr,{value:E.timeLoggedMinutes,onChange:a.onLogTime?Fe=>{a.onLogTime?.(E,Fe);}:void 0,isDark:V,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:_e,lens:k,hourlyRate:R(E),financialOverride:me})}case "soldEffortMinutes":{if(ae&&E.subtasks&&E.subtasks.length>0){let{quoted:Fe}=is(E),ut=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(Pr,{value:Fe>0?Fe:void 0,isDark:V,locale:f,disabled:true,isBlurred:ut,lens:k,hourlyRate:R(E)})}let me=E.status==="completed"||E.progress===100,_e=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(Pr,{value:E.soldEffortMinutes,onChange:Fe=>he({soldEffortMinutes:Fe}),isDark:V,locale:f,disabled:me,isBlurred:_e,lens:k,hourlyRate:R(E)})}case "scheduleVariance":{let me=E.effortMinutes||0,_e=E.soldEffortMinutes||0,Fe=E.timeLoggedMinutes||0,ut=me>0||_e>0||Fe>0;return jsx(Lg,{startDate:E.startDate,endDate:E.endDate,scheduleVariance:E.scheduleVariance,isDark:V,locale:f,hasTimeAllocated:ut})}case "hoursBar":{if(ae&&E.hasChildren){let{spent:me,allocated:_e,quoted:Fe}=is(E),ut=me>_e&&_e>0;return jsxs("span",{className:c("text-[11px] font-mono flex items-center gap-1.5",V?"text-white/50":"text-gray-500"),children:[jsx("span",{className:c("font-bold",ut?"text-[#FF453A]":V?"text-white/80":"text-gray-800"),children:ss(me)}),_e>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:V?"text-white/60":"text-gray-600",children:ss(_e)})]}),Fe>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:V?"text-amber-400/70":"text-amber-600",children:ss(Fe)})]})]})}return jsx(Bg,{task:E,isDark:V,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:k,hourlyRate:R(E)})}case "teamLoad":return E.hasChildren||E.subtasks&&E.subtasks.length>0?jsx(Og,{task:E,isDark:V,locale:f}):jsx(cc,{value:E.assignees||[],availableUsers:l,onChange:_e=>{a.onTaskUpdate?.({...E,assignees:_e});},isDark:V,locale:f});case "blockers":return jsx(Hg,{blockers:E.blockers,isDark:V,locale:f});case "weight":{let me=H.get(E.id);if(me!==void 0)return jsx("span",{className:c("text-xs font-mono",me>0?V?"text-white/50":"text-gray-400":V?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?`${Number(me.toFixed(2))}%`:"\u2014"});let _e=E.weight||0;return jsx(Cw,{value:_e,onChange:Fe=>he({weight:Fe}),isDark:V})}default:return jsx("span",{className:c("text-sm",V?"text-white/60":"text-gray-500"),children:"-"})}},[a,V,f,l,K,ae,H]),Fo=useCallback(E=>{let he={name:K.columns.name,status:K.columns.status,priority:K.columns.priority,assignees:K.columns.assignees,startDate:K.columns.startDate,endDate:K.columns.endDate,progress:K.columns.progress,tags:K.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:K.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:K.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:K.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:K.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:K.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:K.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:K.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:K.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:K.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:K.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:K.columns.weight||(f==="es"?"Peso":"Weight")}[E.type]||E.label;return typeof he=="string"?he:String(he||E.type)},[K,f]),tn=useMemo(()=>{let he=St.reduce((Le,qe)=>Le+qe.width,0)+(v?48:0),De={};for(let Le of St)De[Le.id]=`${Le.width/he*100}%`;return De},[St,v]);return r?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,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-[#00E5CC]"}),jsxs("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:[K.empty.noTasks,"..."]})]})}):n?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:c("text-lg font-semibold mb-2",V?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:c("text-lg font-semibold mb-2",V?"text-white":"text-gray-900"),children:K.empty.noTasks}),jsx("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:K.empty.addFirstTask})]})}):jsxs("div",{ref:C,className:c(V?"bg-[#0D0D0D]":"bg-white",q&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsx("div",{className:c("flex-shrink-0 px-6 py-4 border-b",V?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:[Fr.length," ",K.pagination.tasks]}),y&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:c("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",V?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:je,onChange:E=>He(E.target.value),placeholder:K.toolbar.searchPlaceholder,className:c("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",V?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&it>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:bt,onClick:()=>Tt(!xe),className:c("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",V?xe?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":xe?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jt==="all"?f==="es"?"Todos":"All":`L${jt}`]}),xe&&jsx("div",{ref:pt,className:c("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",V?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(it,5)},(E,oe)=>({value:oe+1,label:`L${oe+1}`}))].map(E=>jsxs("button",{onClick:()=>{re(E.value),Tt(false);},className:c("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",V?jt===E.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":jt===E.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:E.label}),jt===E.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(E.value)))})]}),jsx(d0,{value:wt,hideCompleted:Je,onChange:Nt,onHideCompletedChange:ze,isDark:V,locale:f}),te?.enabled&&te.data&&!ye&&jsx("button",{onClick:()=>Re(true),className:c("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",V?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,D&&F&&jsxs(motion.button,{onClick:F,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:K.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:c("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",V?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Mt&&jsx("div",{className:"w-5 flex-shrink-0"}),St.map(E=>{let oe=E.id!=="name",he=Y===E.id&&z!==E.id;return jsxs("div",{className:c("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",V?"text-white/60":"text-gray-500",oe&&"cursor-grab",E.type!=="name"&&"justify-center",z===E.id&&"opacity-50",he&&(V?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:tn[E.id],minWidth:E.minWidth},draggable:oe,onDragStart:oe?De=>Po(De,E.id):void 0,onDragEnd:oe?En:void 0,onDragOver:oe?De=>ti(De,E.id):void 0,onDragLeave:oe?Ja:void 0,onDrop:oe?De=>cs(De,E.id):void 0,onContextMenu:De=>Nr(De,void 0,E.id),children:[oe&&jsx(GripVertical,{className:c("w-3 h-3 flex-shrink-0 transition-opacity",V?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:De=>{let Le=De.currentTarget.getBoundingClientRect();u(E.id,Le);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Fo(E),m?.includes(E.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),Ve===E.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):E.sortable?jsxs("button",{draggable:false,onClick:()=>xa(E.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Fo(E),m?.includes(E.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:c("w-3 h-3",Ve===E.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Fo(E),m?.includes(E.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}})]}),w&&E.resizable&&jsx("div",{className:c("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",q===E.id&&"bg-[#00E5CC]"),onMouseDown:De=>xo(De,E.id)})]},E.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:E=>{E.stopPropagation(),ft(oe=>!oe);},className:c("p-0.5 rounded transition-colors",V?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Ne&&(V?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(a0,{isOpen:Ne,onClose:()=>ft(false),columns:lt,customFields:d,onColumnsChange:Qt,onCreateCustomField:()=>{ft(false),ie(true);},isDark:V,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Fr.map((E,oe)=>{let he=Ct.has(E.id),De=Math.min(oe*.01,.2),Le=E.hasChildren&&E.level===0,qe=E.subtasks?.length||0;if(Le){let{spent:Et,allocated:Ft,quoted:Ca}=is(E),La=kw(E);return jsxs(motion.div,{"data-task-id":E.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:De},className:c("flex items-center border-y cursor-pointer transition-colors duration-500",V?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Se===E.id&&(V?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(E),children:[Mt&&jsx("div",{className:"w-5 flex-shrink-0"}),St.map(Ia=>jsx("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",Ia.type!=="name"&&"justify-center"),style:{width:tn[Ia.id],minWidth:Ia.minWidth},children:Ia.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:_t=>{_t.stopPropagation(),Na(E.id);},className:c("p-0.5 rounded flex-shrink-0 mt-0.5",V?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:he?jsx(ChevronDown,{className:c("w-4 h-4",V?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:c("w-4 h-4",V?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:_t=>{_t.stopPropagation(),Na(E.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:he?jsx(FolderOpen,{className:"w-4 h-4",style:{color:V?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:V?"#FFD60A":"#B45309"}})}),E.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:V?"#FFD60A":"#B45309"},children:E.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:c("text-[13px] font-bold uppercase tracking-wide",V?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:E.name}),jsxs("span",{className:c("text-[10px] font-mono",V?"text-white/30":"text-gray-500"),children:["(",qe," ",f==="es"?qe===1?"Tarea":"Tareas":qe===1?"Item":"Items",")"]}),La!==null&&jsxs("span",{className:c("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",La>=1?"text-[#32D74B] bg-[#32D74B]/10":La>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",La.toFixed(2)]})]})]}):Ia.type==="timeLoggedMinutes"?k==="financial"?(()=>{let _t=E.executedDollarsCanonical,na=_t!=null?Math.round(_t):Math.round(J(E).dollarSpent);return na>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",na.toLocaleString("en-US")]}):null})():jsx(Pr,{value:Et>0?Et:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:R(E)}):Ia.type==="soldEffortMinutes"?k==="financial"?(()=>{let _t=J(E),na=Math.round(_t.dollarQuoted);return na>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",na.toLocaleString("en-US")]}):null})():jsx(Pr,{value:Ca>0?Ca:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:R(E)}):Ia.type==="effortMinutes"?k==="financial"?(()=>{let _t=J(E),na=Math.round(_t.dollarAllocated),qr=Math.round(_t.dollarQuoted),Da=qr-na;return jsxs("div",{className:"flex flex-col",children:[na>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",na.toLocaleString("es-CO")]}):null,Da!==0&&na>0&&qr>0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Da>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Da>0?"+":"",Math.abs(Da)>=1e3?`$${(Da/1e3).toFixed(1)}K`:`$${Da}`]})]})})():jsx(Pr,{value:Ft>0?Ft:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:R(E)}):Mn(E,Ia)},Ia.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},E.id)}let me=O===E.id,_e=Be===E.id,Fe=_e&&Pe==="above",ut=_e&&Pe==="below",Kt=_e&&Pe==="child";return jsxs(motion.div,{"data-task-id":E.id,"data-listview-row":E.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:De},className:c("flex items-center border-b transition-colors relative group",V?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Se===E.id&&(V?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:me?.4:1,backgroundColor:Kt?V?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Kt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(E),onDoubleClick:()=>a.onTaskDoubleClick?.(E),onContextMenu:Et=>Nr(Et,E),onMouseEnter:()=>gt(E.id),onMouseLeave:()=>gt(Et=>Et===E.id?null:Et),children:[Fe&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),ut&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Mt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:Et=>rt(E.id,Et),style:{color:V?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),St.map(Et=>{let Ft=!!(E.subtasks&&E.subtasks.length>0),Ca=Gt(Et.type),Ia=!!Ca&&!Ft&&zt===E.id&&!Dt,_t=!!Dt&&!!Ca&&Dt.column===Ca&&st(oe);return jsxs("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",Et.type!=="name"&&"justify-center"),style:{width:tn[Et.id],minWidth:Et.minWidth,position:"relative",backgroundColor:_t?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:_t?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[Et.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&E.level>0&&jsx("div",{style:{width:`${E.level*24}px`},className:"flex-shrink-0"}),b&&E.hasChildren&&jsx("button",{onClick:na=>{na.stopPropagation(),Na(E.id);},className:c("p-0.5 rounded flex-shrink-0",V?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:he?jsx(ChevronDown,{className:c("w-4 h-4",V?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:c("w-4 h-4",V?"text-white/60":"text-gray-400")})}),b&&!E.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(E.wbsCode||E.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[E.wbsCode&&jsx("span",{className:c("text-[10px] font-mono",V?"text-[#00E5CC]":"text-[#00C4AE]"),children:E.wbsCode}),E.taskCode&&jsx("span",{className:c("text-[10px] font-mono",V?"text-white/40":"text-gray-400"),children:E.taskCode})]}),jsx("span",{className:c("truncate",E.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",E.progress===100?V?"line-through text-white/50":"line-through text-gray-400":E.hasChildren?V?"text-white":"text-gray-900":V?"text-[#D1D5DB]":"text-gray-600"),children:E.name}),E.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${E.tags[0].color}20`,color:E.tags[0].color},children:E.tags[0].name})]})]}):Mn(E,Et),Ia&&Ca&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:na=>le(na,E.id,Ca,oe),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},Et.id)}),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},E.id)})}),L&&Fr.length>0&&(()=>{let{spent:E,allocated:oe,quoted:he}=$e,De=oe-E,Le=De<0,qe=Le?`+${ss(Math.abs(De))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ss(De)} ${f==="es"?"AHORRADO":"SAVED"}`,me=k==="financial"&&j>0,_e=X?.breakdown,Fe=!!_e&&((_e.equipment??0)>0||(_e.travel??0)>0),ut=_e?.laborSpent!=null?_e.laborSpent:X?.spent!=null?X.spent:$e.dollarSpent,Kt=_e?.laborAllocated!=null?_e.laborAllocated:X?.allocated!=null?X.allocated:$e.dollarAllocated,Et=X?.quoted!=null?X.quoted:$e.dollarQuoted,Ft=(_t,na)=>{if(me){let qr=na??_t/60*j;return `$${Math.round(qr).toLocaleString("es-CO")}`}return ss(_t)},Ca=me?Math.abs(Kt-ut):0,La=me?`+$${Ca.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Le?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:qe,Ia=me&&Fe?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:c("flex items-center sticky bottom-0 z-[5]",V?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:V?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Mt&&jsx("div",{className:"w-5 flex-shrink-0"}),St.map(_t=>jsx("div",{className:c("flex items-center px-4 py-3",_t.type!=="name"&&"justify-center"),style:{width:tn[_t.id],minWidth:_t.minWidth},children:_t.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:c("text-[11px] font-black uppercase tracking-widest",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Ia&&jsxs("span",{className:c("text-[9px] font-mono mt-0.5 flex items-center gap-1",V?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Ia]})]}):_t.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ft(E,me?ut:void 0)}),jsx("span",{className:c("text-[11px]",V?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:c("text-[11px]",V?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ft(oe,me?Kt:void 0)})]}),oe>0&&jsx("span",{className:c("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Le?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:me?La:qe})]}):_t.type==="soldEffortMinutes"?jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:he>0?Ft(he,me?Et:void 0):"\u2013"}):_t.type==="effortMinutes"?(()=>{if(me&&he>0&&oe>0){let na=Math.round(Et),qr=Math.round(Kt),Da=na-qr,ai=na>0?Math.round(Da/na*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ft(oe,Kt)}),jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Da>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Da>=0?"+":"",Math.abs(Da)>=1e3?`$${(Da/1e3).toFixed(1)}K`:`$${Da}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",ai,"%)"]})]})]})}return jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe>0?Ft(oe,me?Kt:void 0):"\u2013"})})():_t.type==="timeLoggedMinutes"?jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:E>0?Ft(E,me?ut:void 0):"\u2013"}):_t.type==="progress"?(()=>{let na=h0(Sc(e||[]));return jsxs("span",{className:c("text-[12px] font-bold font-mono",V?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[na,"%"]})})():_t.type==="weight"?(()=>{let na=e||[],qr=[],Da=Ao=>{for(let an of Ao)qr.push(an),an.subtasks?.length&&Da(an.subtasks);};Da(na);let ri=qr.filter(Ao=>!Ao.subtasks?.length||Ao.subtasks.length===0).reduce((Ao,an)=>Ao+(an.weight||0),0),Dl=Math.abs(ri-100)<.1;return jsxs("span",{className:c("text-[12px] font-bold font-mono",Dl?V?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(ri.toFixed(1)),"%"]})})():jsx("span",{className:c("text-[11px]",V?"text-white/30":"text-gray-300"),children:"\u2013"})},_t.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Fr.length===0&&je&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:c("w-12 h-12 mx-auto mb-4",V?"text-white/30":"text-gray-400")}),jsx("p",{className:c(V?"text-white/60":"text-gray-600"),children:K.empty.noResults})]})})]})}),te?.enabled&&te.data&&ye&&jsx(u0,{data:te.data,isDark:V,locale:f,onClose:()=>Re(false),lens:t?.lens,onUnassignedTaskClick:E=>{let oe=document.querySelector(`[data-task-id="${E}"]`);oe&&(oe.scrollIntoView({behavior:"smooth",block:"center"}),Ee(E),setTimeout(()=>Ee(null),2e3));}})]}),jsx(_g,{state:B,onClose:Sn,isDark:V,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:ur,onColumnSort:va,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),Ue&&at&&O&&createPortal(jsx("div",{style:{position:"fixed",left:at.x+12,top:at.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let oe=Ae.flattenTasks(e).find(he=>he.id===O);return oe?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:V?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${V?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:V?"#e6edf3":"#111827"},children:oe.name})]}):null})()}),document.body),jsx(n0,{isOpen:A,onClose:()=>ie(false),onSave:Or,isDark:V,locale:f})]})}var w0=[{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:"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:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],k0=[{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"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],C0=[{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 Ec={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Mc={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",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},Pc={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",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},ml={dark:Ec,light:Mc,neutral:Pc};function T0(e){return ml[e]||ml.dark}var Fc={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",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Ac={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",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},gl={en:Fc,es:Ac};function Gs(e){return gl[e]||gl.en}function fl(e,t){let a=Gs(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 N0(e){let t=Gs(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 D0(e,t=0,a=true){let r=Gs(e),n=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 [...n.slice(t),...n.slice(0,t)]}function _s(e){let t=[];function a(r){for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);}return a(e),t}function Ic(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()),n=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=n}function M0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:c("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var A0=26,Fw=22,Aw=10;function P0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Bc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let n=Math.round(e/60*a);return n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function L0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let n=r<0,s;if(t==="financial"&&a>0){let o=Math.round(Math.abs(r/60)*a);s=o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`;}else {let o=Math.round(Math.abs(r)/60);s=o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`;}return {text:`${n?"-":"+"}${s}`,isNegative:n}}function F0(e,t="hours",a=0){if(t==="financial"&&a>0){let n=Math.round(Math.abs(e/60)*a);return n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function Lw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:n,t:s,lens:o="hours",hourlyRate:l=0}){let{task:d,spanCols:i,lane:u,isStart:m,isEnd:p}=e,g=d.progress===100||d.status==="completed",f=d.isCriticalPath,x=m&&p?"rounded":m?"rounded-l":p?"rounded-r":"",y=p?Bc(d.effortMinutes,o,l):null,b=p?L0(d,o,l):null,h=p?d.blockers?.find(v=>v.severity==="critical"):null;return jsxs(motion.button,{onClick:v=>{v.stopPropagation(),a();},whileHover:{scale:1.005},className:c("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":f?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-[#00E5CC]"),style:{top:`${u*A0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${Fw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:f?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:m?"3px":void 0,borderLeftColor:m?f?"#EF4444":g?"#10B981":"#1264FF":void 0,...n?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(0, 229, 204, 0.7), 0 0 12px rgba(0, 229, 204, 0.2)",zIndex:20}:{}},children:[f&&m&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:d.name}),p&&(y||b)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[y&&jsxs("span",{children:[s.labels.estimate,": ",y]}),b&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:c(b.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:b.text})]})]}),h&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",h.type]}),d.progress>0&&d.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${d.progress}%`}})]})}function I0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:n=false,error:s,className:o,style:l,availableTags:d=[],onCreateTag:i,attachmentsByTask:u,comments:m,onAddComment:p,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:x,onTaskOpen:y,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:v,timerState:w,onLogTime:N,onUpdateEstimate:D,onUpdateSoldEffort:F,onStartTimer:T,onStopTimer:S,onDiscardTimer:P,blurFinancials:k=false,suppressDetailModal:j=false,lens:U="hours",hourlyRate:ae=0}){let{theme:L="dark",locale:X$1="en",customTranslations:K,showBacklog:V=true}=t,R=fl(X$1,K),J=L==="dark"||L==="neutral",[Te,$e]=useState(r||new Date),[H,te]=useState(null),[ye,Re]=useState(null),[Se,Ee]=useState(null),[Ve,ot]=useState({}),be=3,Ge=3,je=useCallback(O=>{Re(O.id),j||te(O),y?.(O.id);},[j,y]),[He,wt]=useState(null),Nt=useCallback(()=>{$e(new Date(Te.getFullYear(),Te.getMonth()-1,1));},[Te]),Je=useCallback(()=>{$e(new Date(Te.getFullYear(),Te.getMonth()+1,1));},[Te]),ze=useCallback(()=>{$e(new Date);},[]),lt=useMemo(()=>{let O=Te.getFullYear(),ee=Te.getMonth(),Ue=new Date(O,ee,1),ke=new Date(O,ee+1,0),Be=Ue.getDay(),Me=ke.getDate(),Pe=_s(e),nt=new Date;nt.setHours(0,0,0,0);let at=[],dt=Be,mt=new Date(O,ee,0).getDate();for(let Mt=dt-1;Mt>=0;Mt--){let zt=new Date(O,ee-1,mt-Mt);at.push({date:zt,isCurrentMonth:false,isToday:false,isWeekend:zt.getDay()===0||zt.getDay()===6,events:Pe.filter(gt=>Ic(zt,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}for(let Mt=1;Mt<=Me;Mt++){let zt=new Date(O,ee,Mt),gt=zt.getTime()===nt.getTime();at.push({date:zt,isCurrentMonth:true,isToday:gt,isWeekend:zt.getDay()===0||zt.getDay()===6,events:Pe.filter(Dt=>Ic(zt,Dt)).map(Dt=>({id:Dt.id,title:Dt.name,start:Dt.startDate,end:Dt.endDate,task:Dt}))});}let Vt=42-at.length;for(let Mt=1;Mt<=Vt;Mt++){let zt=new Date(O,ee+1,Mt);at.push({date:zt,isCurrentMonth:false,isToday:false,isWeekend:zt.getDay()===0||zt.getDay()===6,events:Pe.filter(gt=>Ic(zt,gt)).map(gt=>({id:gt.id,title:gt.name,start:gt.startDate,end:gt.endDate,task:gt}))});}return at},[Te,e]),At=useMemo(()=>_s(e).filter(O=>!O.startDate||!O.endDate),[e]),Ne=useMemo(()=>{let O=_s(e),ee=0,Ue=0,ke=0,Be=0,Me=0;O.forEach(mt=>{mt.effortMinutes&&(ee+=mt.effortMinutes),mt.soldEffortMinutes&&(Ue+=mt.soldEffortMinutes),mt.scheduleVariance!=null&&(ke+=mt.scheduleVariance,Be++),mt.soldEffortMinutes&&mt.effortMinutes&&(Me+=mt.soldEffortMinutes-mt.effortMinutes);});let Pe=Ue>0?Math.min(100,Math.round(ee/Ue*100)):0,nt=Be>0?Math.round(ke/Be):0,dt=`${Me<0?"-":"+"}${F0(Me,U,ae)}`;return {budgetUtil:Pe,avgVariance:nt,costDisplay:dt,hasCostData:Ue>0}},[e,U,ae]),ft=useMemo(()=>{let O=[0,0,0,0,0,0];return lt.forEach((ee,Ue)=>{let ke=Math.floor(Ue/7);ee.events.forEach(Be=>{if(Be.task.startDate&&Be.task.soldEffortMinutes){let Me=new Date(Be.task.startDate),Pe=ee.date;Me.getFullYear()===Pe.getFullYear()&&Me.getMonth()===Pe.getMonth()&&Me.getDate()===Pe.getDate()&&ke<O.length&&(O[ke]-=Be.task.soldEffortMinutes);}});}),O},[lt]),A=useMemo(()=>{let O=_s(e),ee=new Map,Ue=new Set,ke=[0,0,0,0,0,0];if(lt.length===0)return {segmentsByCell:ee,multiDayTaskIds:Ue,maxLanesPerRow:ke};let Be=dt=>new Date(dt.getFullYear(),dt.getMonth(),dt.getDate()),Me=Be(lt[0].date),Pe=Be(lt[lt.length-1].date),nt=[];for(let dt of O){if(!dt.startDate||!dt.endDate)continue;let mt=Be(dt.startDate),Vt=Be(dt.endDate);if(mt.getTime()===Vt.getTime()||Vt<Me||mt>Pe)continue;let Mt=mt<Me?Me:mt,zt=Vt>Pe?Pe:Vt,gt=P0(Mt,Me),Dt=P0(zt,Me);gt<0||gt>41||Dt<0||Dt>41||gt!==Dt&&(Ue.add(dt.id),nt.push({task:dt,startIdx:gt,endIdx:Dt}));}nt.sort((dt,mt)=>dt.startIdx!==mt.startIdx?dt.startIdx-mt.startIdx:mt.endIdx-mt.startIdx-(dt.endIdx-dt.startIdx));let at=[[],[],[],[],[],[]];for(let{task:dt,startIdx:mt,endIdx:Vt}of nt){let Mt=Math.floor(mt/7),zt=Math.floor(Vt/7),gt=Be(dt.startDate),Dt=Be(dt.endDate),Ut=false;for(let Gt=Mt;Gt<=zt;Gt++){let Rt=Gt===Mt?mt%7:0,rt=Gt===zt?Vt%7:6,ia=rt-Rt+1,fa=0,W=at[Gt]??[];for(at[Gt]||(at[Gt]=W);fa<W.length&&(W[fa]??-1)>=Rt;)fa++;if(fa>=Aw){Ut=true;break}fa>=W.length?W.push(rt):W[fa]=rt,ke[Gt]=Math.max(ke[Gt]??0,fa+1);let le=Gt===Mt&>>=Me,st=Gt===zt&&Dt<=Pe,jt=Gt*7+Rt,re={taskId:dt.id,task:dt,rowIndex:Gt,startCol:Rt,endCol:rt,spanCols:ia,lane:fa,isStart:le,isEnd:st};ee.has(jt)||ee.set(jt,[]),ee.get(jt).push(re);}Ut&&(Ue.delete(dt.id),ee.forEach((Gt,Rt)=>{let rt=Gt.filter(ia=>ia.taskId!==dt.id);rt.length===0?ee.delete(Rt):ee.set(Rt,rt);}));}return {segmentsByCell:ee,multiDayTaskIds:Ue,maxLanesPerRow:ke}},[lt,e]),ie=X$1==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B=Te.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Z=B.charAt(0).toUpperCase()+B.slice(1);return n?jsx("div",{className:c("flex-1 flex items-center justify-center",J?"bg-[#050505]":"bg-white",o),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-[#007FFF]"}),jsxs("p",{className:c("text-sm font-mono",J?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsx("div",{className:c("flex-1 flex items-center justify-center",J?"bg-[#050505]":"bg-white",o),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:c("w-12 h-12 rounded-full flex items-center justify-center",J?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:c("text-lg font-semibold mb-2",J?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:c("text-sm",J?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:c("flex-1 flex items-center justify-center",J?"bg-[#050505]":"bg-white",o),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:c("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",J?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-[#00E5CC]/10"),children:jsx(Calendar,{className:c("w-8 h-8",J?"text-[#007FFF]":"text-[#00E5CC]")})}),jsx("h3",{className:c("text-lg font-semibold mb-2",J?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsx("p",{className:c("text-sm",J?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxs("div",{className:c("flex-1 flex flex-col w-full h-full overflow-hidden",J?"bg-[#050505]":"bg-white",o),style:l,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:c("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",J?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:c("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",J?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:c("w-3.5 h-3.5",J?"text-[#007FFF]":"text-[#00E5CC]")}),jsx("span",{className:c("font-medium",J?"text-white":"text-gray-900"),children:X$1==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:c("h-4 w-px",J?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Nt,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",J?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:c("text-sm font-semibold tracking-tight min-w-[150px] text-center",J?"text-white":"text-gray-900"),children:Z}),jsx("button",{onClick:Je,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",J?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:c("h-4 w-px",J?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:ze,className:c("px-2.5 py-1 text-xs rounded-md transition-all font-medium",J?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsx("div",{className:c("grid grid-cols-7 sticky top-0 z-10",J?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:ie.map(O=>jsx("div",{className:c("py-2 text-center text-[10px] font-bold uppercase tracking-widest",J?"text-white/60 font-mono":"text-gray-500"),children:O},O))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:c("grid grid-cols-7 min-h-[800px]",J?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Re(null),children:lt.map((O,ee)=>{let Ue=ee%7===6,ke=ee>=35;return jsxs("div",{className:c("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ue&&(J?"border-r border-[#222]":"border-r border-gray-200"),!ke&&(J?"border-b border-[#222]":"border-b border-gray-200"),J?O.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":O.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",O.isToday&&J&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",O.isToday&&!J&&"ring-2 ring-[#00E5CC] ring-inset"),children:[jsx("span",{className:c("text-xs font-mono select-none relative z-20",O.isToday?J?"text-[#007FFF] font-bold":"text-[#00C4AE] font-bold":O.isCurrentMonth?J?"text-white/60":"text-gray-900":J?"text-white/20":"text-gray-400"),children:String(O.date.getDate()).padStart(2,"0")}),(()=>{let Be=Math.floor(ee/7),Me=(A.maxLanesPerRow[Be]??0)*A0,Pe=A.segmentsByCell.get(ee);return Me===0&&!Pe?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Me}px`,zIndex:5},children:Pe?.map(nt=>jsx(Lw,{segment:nt,isDark:J,blurFinancials:k,isSelected:ye===nt.taskId,t:R,lens:U,hourlyRate:ae,onClick:()=>{je(nt.task),a.onEventClick?.({id:nt.task.id,title:nt.task.name,start:nt.task.startDate,end:nt.task.endDate,task:nt.task});}},nt.taskId))})})(),(()=>{let Be=O.events.filter(Me=>Me.task.isMilestone&&!A.multiDayTaskIds.has(Me.id));return Be.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Be.slice(0,4).map(Me=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Me.title,onClick:Pe=>{Pe.stopPropagation(),je(Me.task);}},Me.id)),Be.length>4&&jsxs("span",{className:c("text-[8px] font-mono",J?"text-white/30":"text-gray-400"),children:["+",Be.length-4]})]})})(),(()=>{let Be=[];O.events.forEach(Pe=>{Pe.task.blockers?.forEach(nt=>{(nt.severity==="warning"||nt.severity==="critical")&&Be.push({taskId:Pe.id,type:nt.type,severity:nt.severity,variance:Pe.task.scheduleVariance});});});let Me=Be[0];return Me?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:c("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Me.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[R.labels.risk,": ",Me.type,Me.variance?` (+${Math.abs(Me.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let Be=O.events.filter(at=>!A.multiDayTaskIds.has(at.id)),Me=Ve[ee]||be,Pe=Be.slice(0,Me),nt=Be.length-Me;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Pe.map(at=>jsxs(motion.button,{onClick:()=>{je(at.task),a.onEventClick?.(at);},whileHover:{scale:1.01},className:c("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",at.task.progress===100||at.task.status==="completed"?J?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":J?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-[#00E5CC]"),style:J?at.task.progress===100||at.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:at.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:c("flex-shrink-0 text-[9px]",at.task.isMilestone?J?"text-amber-400":"text-amber-600":at.task.isCriticalPath?"text-red-400":J?"text-[#1264FF]":"text-gray-400"),children:at.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:at.title})]},at.id)),nt>0&&jsxs("button",{onClick:at=>{at.stopPropagation(),ot(dt=>({...dt,[ee]:Me+Ge}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",J?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",nt," ",X$1==="es"?"m\xE1s":"more"]}),Me>be&&Be.length>be&&jsx("button",{onClick:at=>{at.stopPropagation(),ot(dt=>({...dt,[ee]:be}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",J?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X$1==="es"?"menos":"less"})]})})(),O.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Be=ee>=28,Me=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Pe=>{Pe.stopPropagation(),wt(He===ee?null:ee);},className:c("w-5 h-5 rounded flex items-center justify-center transition-all",He===ee?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",J?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-[#00E5CC] text-gray-400 hover:text-white"),children:jsx(Plus,{className:c("w-3.5 h-3.5 transition-transform",He===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:He===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>wt(null)}),jsx(motion.div,{initial:{opacity:0,y:Be?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Be?-5:5,scale:.95},transition:{duration:.12},className:c("absolute w-[320px] rounded-lg shadow-2xl z-50",Be?"bottom-full mb-1":"top-full mt-1",Me?"right-0":"left-0",J?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(un,{onSubmit:Pe=>{a.onTaskCreate?.({name:Pe.name,startDate:Pe.startDate||O.date,endDate:Pe.endDate||O.date,priority:Pe.priority,assignees:Pe.assignee?[Pe.assignee]:void 0}),wt(null);},onCancel:()=>wt(null),availableUsers:t.availableUsers,isDark:J,locale:X$1==="es"?"es":"en",defaultDate:O.date,dropdownDirection:Be?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let Be=Math.floor(ee/7),Me=ft[Be];if(!Me||Me===0)return null;let Pe=F0(Me,U,ae);return jsxs("div",{className:c("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Me<0?"text-red-400":"text-emerald-400",k&&"blur-sm select-none"),children:[R.labels.cashOut,": ",Me<0?"-":"+",Pe]})})()]},ee)})})})]}),V&&jsxs("aside",{className:c("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",J?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:c("flex-shrink-0 h-14 flex items-center justify-between px-4",J?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",J?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:c("text-[10px] font-mono tabular-nums",J?"text-white/20":"text-gray-400"),children:At.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:At.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:c("w-10 h-10 rounded-xl flex items-center justify-center mb-3",J?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:c("w-5 h-5",J?"text-white/20":"text-gray-400")})}),jsx("p",{className:c("text-xs font-mono",J?"text-white/20":"text-gray-400"),children:X$1==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):At.map(O=>jsxs("button",{onClick:()=>{je(O);},className:c("w-full text-left rounded-md p-3 transition-all group/card",J?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:c("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",J?"bg-white/20":"bg-gray-300")}),jsx("span",{className:c("text-sm font-medium leading-snug line-clamp-2",J?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:O.name})]}),O.tags&&O.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[O.tags.slice(0,3).map(ee=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),O.tags.length>3&&jsxs("span",{className:c("text-[9px] font-mono px-1 py-0.5",J?"text-white/20":"text-gray-400"),children:["+",O.tags.length-3]})]}),(O.effortMinutes||O.soldEffortMinutes)&&jsxs("div",{className:c("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",J?"text-white/25":"text-gray-400",k&&"blur-sm select-none"),children:[Bc(O.effortMinutes,U,ae)&&jsxs("span",{children:[R.labels.estimate,": ",Bc(O.effortMinutes,U,ae)]}),(()=>{let ee=L0(O,U,ae);return ee?jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[O.priority&&jsx(Flag,{className:c("w-3 h-3",O.priority==="urgent"||O.priority==="high"?"text-red-400":O.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(M0,{task:O,isDark:J})]}),O.assignees&&O.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:O.assignees.slice(0,2).map((ee,Ue)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},Ue))})]})]},O.id))}),a.onTaskCreate&&jsx("div",{className:c("flex-shrink-0 px-3 py-2.5 border-t",J?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:c("w-full text-[11px] font-mono bg-transparent outline-none",J?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:O=>{O.key==="Enter"&&O.target.value.trim()&&(a.onTaskCreate?.({name:O.target.value.trim()}),O.target.value="");}})}),Ne.hasCostData&&jsxs("div",{className:c("flex-shrink-0 px-4 py-3 border-t space-y-2.5",J?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",J?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:c("text-[10px] font-mono",J?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxs("span",{className:c("text-[10px] font-mono font-bold tabular-nums",J?"text-white/60":"text-gray-700",k&&"blur-sm select-none"),children:[Ne.budgetUtil,"%"]})]}),jsx("div",{className:c("h-1.5 rounded-full overflow-hidden",J?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Ne.budgetUtil}%`,background:Ne.budgetUtil>90?"#EF4444":Ne.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #00E5CC, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",J?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",J?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxs("div",{className:c("text-[11px] font-mono font-bold tabular-nums",Ne.avgVariance>0?"text-emerald-400":Ne.avgVariance<0?"text-red-400":J?"text-white/50":"text-gray-600"),children:[Ne.avgVariance>0?"+":"",Ne.avgVariance," ",R.labels.days]})]}),jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",J?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",J?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsx("div",{className:c("text-[11px] font-mono font-bold tabular-nums",Ne.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",k&&"blur-sm select-none"),children:Ne.costDisplay})]})]})]})]})]}),!j&&jsx(Co,{task:H,isOpen:!!H,onClose:()=>te(null),onTaskUpdate:O=>{a.onTaskUpdate?.(O),te(O);},theme:L==="dark"?"dark":"light",locale:X$1,availableUsers:t.availableUsers?.map(O=>({id:O.id,name:O.name,avatar:O.avatar,initials:O.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:d,onCreateTag:i,attachments:H?u?.get(H.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:_s(e).filter(O=>O.id!==H?.id),comments:m?.filter(O=>O.taskId===H?.id).map(O=>({...O,createdAt:O.createdAt instanceof Date?O.createdAt:new Date(O.createdAt),updatedAt:O.updatedAt instanceof Date?O.updatedAt:O.updatedAt?new Date(O.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:x,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:v,isTimerRunning:w?.isRunning,timerElapsedSeconds:w?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:D,onSoldEffortUpdate:F,onTimerStart:T,onTimerStop:S,onTimerDiscard:P,blurFinancials:k}),jsx(AnimatePresence,{children:Se&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ee(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:c("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",J?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between",J?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:c("font-medium text-sm",J?"text-white/90":"text-gray-900"),children:Se.date.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ee(null),className:c("p-1 rounded",J?"hover:bg-white/10 text-white/40":"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-1.5",children:Se.events.map(O=>jsxs("button",{onClick:()=>{Ee(null),je(O.task);},className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",J?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(M0,{task:O.task,isDark:J}),jsx("span",{className:c("text-sm truncate flex-1",J?"text-white/80":"text-gray-900"),children:O.title}),(O.task.priority==="high"||O.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},O.id))})]})]})})]})}var Rc={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 229, 204, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 229, 204, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 229, 204, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Oc={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",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 229, 204, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},$c={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",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},yl={dark:Rc,light:Oc,neutral:$c};function B0(e){return yl[e]||yl.dark}function Bw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[d,i]=useState(false),u=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),m=useMemo(()=>{let g=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,x=u.map(b=>b.priority).filter(Boolean),y=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:g,uniqueAssignees:f,priorities:x,labels:y}},[u]),p=()=>{n?.(e.id);};return jsxs("div",{className:c("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:c("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:m.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"]})]}),d&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),o?.(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:[m.uniqueAssignees," assignees"]})]}),m.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:[m.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,g.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"})]})})]},g.id))})})]})}var O0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function qs(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 Ys(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 $0(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function H0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:l}){let d=useMemo(()=>({...O0,...o}),[o]),[i,u]=useState(new Set),m=useRef(null),p=useMemo(()=>{if(!d.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],N=h.get(w);N?N.push(v):h.set(w,[v]);}),Array.from(h.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((N,D)=>D.timestamp.getTime()-N.timestamp.getTime())}))},[e,d.groupByDay]),{uniqueUsers:g,uniqueTypes:f}=useMemo(()=>{let h=new Set,v=new Set;return e.forEach(w=>{h.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),x=h=>{u(v=>{let w=new Set(v);return w.has(h)?w.delete(h):w.add(h),w});},y=h=>{let w=new Date().getTime()-h.getTime(),N=Math.floor(w/6e4),D=Math.floor(w/36e5),F=Math.floor(w/864e5);return N<1?"just now":N<60?`${N}m ago`:D<24?`${D}h ago`:F<7?`${F}d ago`:h.toLocaleDateString()},b=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&&m.current){let h=m.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:c("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:c("history-timeline",d.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 v=h.target.value;a({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxs("option",{value:h,children:[Ys(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;a({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.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})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:m,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[d.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((v,w)=>{let N=i.has(v.id),D=s===v.id,F=$0(v.type);return jsxs("div",{"data-event-id":v.id,className:c("history-timeline-event",N&&"expanded",D&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:F},children:d.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Ys(v.type)})}),w<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:F}})]}),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:[d.showAvatars&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:qs(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:d.useRelativeTime?y(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),x(v.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([T,S])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(S.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(S.to)})]})]},T)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([T,S])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(S)})]},T))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function U0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:d,className:i}){let u=[.5,1,1.5,2,3],m=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:c("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:c("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:m&&Ys(m.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:m&&qs(m)}),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:m&&m.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:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,f)=>jsx("div",{className:c("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:qs(g)},g.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:n,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:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(g=>jsxs("button",{className:c("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>d(g),children:[g,"x"]},g))})]}),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:m&&m.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(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:c("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 Hc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function zc(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 W0(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 V0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Uw(e,t,a,r,n,s=100){let o=e.map(d=>({...d,x:d.x??a/2+Math.random()*100-50,y:d.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(o.map(d=>[d.id,d]));for(let d=0;d<s;d++){let i=1-d/s;o.forEach(u=>{let m=a/2,p=r/2;u.vx+=(m-u.x)*n.centerForce*i,u.vy+=(p-u.y)*n.centerForce*i,o.forEach(g=>{if(u.id===g.id)return;let f=u.x-g.x,x=u.y-g.y,y=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(y*y);u.vx+=f/y*b,u.vy+=x/y*b;});}),t.forEach(u=>{let m=l.get(typeof u.source=="string"?u.source:u.source.id),p=l.get(typeof u.target=="string"?u.target:u.target.id);if(!m||!p)return;let g=p.x-m.x,f=p.y-m.y,x=Math.sqrt(g*g+f*f)||1,y=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=g*y,m.vy+=f*y,p.vx-=g*y,p.vy-=f*y;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function G0({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:d}){let i=useRef(null),[u,m]=useState([]),[p,g]=useState(null),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(1),[w,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let U=Uw(e,t,a.width,a.height,a,150);m(U);},[e,t,a]);let D=useCallback((U,ae)=>{a.enableDragging&&(ae.stopPropagation(),g(U));},[a.enableDragging]),F=useCallback(U=>{if(!p||!i.current)return;let L=i.current.getBoundingClientRect(),X=(U.clientX-L.left-w.x)/h,K=(U.clientY-L.top-w.y)/h;m(V=>V.map(R=>R.id===p?{...R,x:X,y:K,fx:X,fy:K}:R));},[p,h,w]),T=useCallback(()=>{g(null);},[]),S=useCallback((U,ae)=>{ae.stopPropagation(),l?.({type:"node-click",node:U,position:{x:ae.clientX,y:ae.clientY}});},[l]),P=useCallback((U,ae)=>{ae.stopPropagation(),l?.({type:"edge-click",edge:U,position:{x:ae.clientX,y:ae.clientY}});},[l]),k=useCallback(U=>{let ae=u.find(L=>L.id===U);return ae?{x:ae.x,y:ae.y}:{x:0,y:0}},[u]),j=useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ae=U.card.priority;return ae==="URGENT"?"#ef4444":ae==="HIGH"?"#f59e0b":ae==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:c("relationships-graph-empty",d),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:c("relationships-graph",d),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:o.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:o.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:()=>v(U=>Math.min(U+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Hc(U)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[W0(U)," ",zc(U)]})]},U))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:F,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let ae=k(typeof U.source=="string"?U.source:U.source.id),L=k(typeof U.target=="string"?U.target:U.target.id),X=V0(U.type),K=y===U.id,V=U.onCriticalPath;return jsxs("g",{className:c("relationships-graph-edge",K&&"hovered",V&&"critical"),onMouseEnter:()=>b(U.id),onMouseLeave:()=>b(null),onClick:R=>P(U,R),children:[jsx("line",{x1:ae.x,y1:ae.y,x2:L.x,y2:L.y,stroke:Hc(U.type),strokeWidth:V?a.edgeWidth*2:a.edgeWidth,strokeOpacity:K?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&K&&jsx("text",{x:(ae.x+L.x)/2,y:(ae.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:zc(U.type)})]},U.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(U=>{let ae=f===U.id,L=U.onCriticalPath;return jsxs("g",{className:c("relationships-graph-node",ae&&"hovered",L&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:X=>D(U.id,X),onMouseEnter:()=>x(U.id),onMouseLeave:()=>x(null),onClick:X=>S(U,X),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:j(U),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:ae?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 K0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[l,d]=useState(false),[i,u]=useState(null),[m,p]=useState(null),g=useRef(null),f=l||n;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let h=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let x=()=>{f||(o(""),u(null),p(null),t());},y=async()=>{if(!(!s.trim()||f)){d(true),u(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{d(false);}}},b=()=>{m&&(a(m),x());};return e?jsxs(ea,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),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-[#00E5CC]",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:x,disabled:f,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:m?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!"})]}),m.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((h,v)=>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},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((h,v)=>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-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},v)),m.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.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:g,value:s,onChange:h=>o(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-[#00E5CC]/50 transition-all resize-none",disabled:f}),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,v)=>jsx("button",{onClick:()=>o(h),disabled:f,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},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:x,disabled:f,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"}),m?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:y,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Uc={"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 Vw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Gw={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 jw(e,t,a){let r=Uc[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function Xs(e){return `$${e.toFixed(4)}`}var Wc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=jw(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(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let r=a.length,n=a.reduce((m,p)=>m+p.cost,0),s=a.reduce((m,p)=>m+p.inputTokens,0),o=a.reduce((m,p)=>m+p.outputTokens,0),l=a.filter(m=>m.success),d=a.reduce((m,p)=>m+p.duration,0),i={},u={};return a.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,u[m.feature]=(u[m.feature]||0)+m.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?d/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=o).length,d=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:d,percentUsed:i,isExceeded:l>=n}}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)}},Cn=new Wc;function X0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(Cn.getStats()),[s,o]=useState(Cn.checkLimit(a));if(useEffect(()=>{if(!e)return;let d=setInterval(()=>{n(Cn.getStats()),o(Cn.checkLimit(a));},1e3);return ()=>clearInterval(d)},[e,a]),useEffect(()=>{let d=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;let l=Cn.getRecentOperations(5);return jsxs(ea,{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:d=>d.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[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-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/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:Xs(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-[#00E5CC] 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(([d,i])=>{let u=r.costsByFeature[d]||0,m=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:d.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:Xs(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},d)})})]}),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(d=>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:d.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(d.timestamp).toLocaleTimeString()," \u2022"," ",d.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[d.inputTokens+d.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Xs(d.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${d.success?"bg-green-400":"bg-red-400"}`})]})]},d.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 Z0({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,l]=useState(""),[d,i]=useState(""),[u,m]=useState(""),[p,g]=useState(false),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(null),w=useRef(null),N=p||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=k=>{k.key==="Escape"&&!N&&D();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,N]);let D=()=>{N||(l(""),i(""),m(""),x(null),b(null),v(null),t());},F=async()=>{if(!(!o.trim()||N)){g(true),x(null),b(null),v(null);try{let P=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:d||void 0,endDate:u||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{y&&(a(y),D());};if(!e)return null;let S=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(ea,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:D}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[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-[#00E5CC]",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:D,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[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-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",S,"% 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:[y.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((P,k)=>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:["#",k+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.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"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>l(P.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-[#00E5CC]/50 transition-all resize-none",disabled:N}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:d,onChange:P=>i(P.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-[#00E5CC]/50 transition-all",disabled:N})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:P=>m(P.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-[#00E5CC]/50 transition-all",disabled:N})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),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((P,k)=>jsx("button",{onClick:()=>l(P),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},k))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:N&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:D,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),y?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:F,disabled:!o.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function wl({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(y=>{t&&di(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(y,b,h)=>{r(v=>{let w=v.cards.find(P=>P.id===y);if(!w)return v;let N=w.columnId,D={...w,columnId:b,position:h},F=v.cards.map(P=>P.id===y?D:P),T=v.columns.map(P=>{if(P.id===N)return {...P,cardIds:P.cardIds.filter(k=>k!==y)};if(P.id===b){let k=F.filter(j=>j.columnId===b).sort((j,U)=>j.position-U.position);return {...P,cardIds:k.map(j=>j.id)}}return P}),S={...v,cards:F,columns:T};return n(S),S});},[n]),o=useCallback(async(y,b)=>{r(h=>{let v=h.cards.map(N=>N.id===y?{...N,...b}:N),w={...h,cards:v};return n(w),w});},[n]),l=useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...y,id:b},w=h.columns.map(D=>D.id===y.columnId?{...D,cardIds:[...D.cardIds,b]}:D),N={...h,cards:[...h.cards,v],columns:w};return n(N),N});},[n]),d=useCallback(async y=>{r(b=>{let h=b.cards.find(D=>D.id===y);if(!h)return b;let v=b.cards.filter(D=>D.id!==y),w=b.columns.map(D=>D.id===h.columnId?{...D,cardIds:D.cardIds.filter(F=>F!==y)}:D),N={...b,cards:v,columns:w};return n(N),N});},[n]),i=useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...y,id:b,cardIds:[]},w={...h,columns:[...h.columns,v]};return n(w),w});},[n]),u=useCallback(async(y,b)=>{r(h=>{let v=h.columns.map(N=>N.id===y?{...N,...b}:N),w={...h,columns:v};return n(w),w});},[n]),m=useCallback(async y=>{r(b=>{let h=b.cards.filter(N=>N.columnId!==y),v=b.columns.filter(N=>N.id!==y),w={...b,cards:h,columns:v};return n(w),w});},[n]),p=useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(y),b},[l]),g=useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),f=useCallback(()=>{r(y=>{let b={...y,cards:[],columns:[]};return n(b),b});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:d,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:m},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:d,deleteColumn:m,clearBoard:f}}}function tf({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=wl({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(d,i,u={})=>{s.addCard({title:i,columnId:d,position:r.cards.filter(m=>m.columnId===d).length,...u});},addColumn:(d,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(m=>m.position)):0;s.addColumn({title:d,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var Js={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},rf={by:"none",order:"asc"};function of({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...Js,...e}),[s,o]=useState({...rf,...t}),l=useCallback(x=>{n(y=>({...y,...x}));},[]),d=useCallback(x=>{o(y=>({...y,...x}));},[]),i=useCallback(()=>{n(Js),o(rf);},[]),u=useCallback(()=>{a&&n({...Js,assignees:[a]});},[a]),m=useCallback(()=>{n({...Js,dateFilter:"overdue"});},[]),p=useCallback(()=>{n({...Js,priorities:["HIGH","URGENT"]});},[]),g=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]),f=useCallback(x=>{let y=[...x];if(r.search){let b=r.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),N=`${h}-${v}-${w}`;y=y.filter(D=>{if(!D.endDate&&!D.dueDate)return false;let F=D.endDate||D.dueDate;if(!F)return false;let T;if(typeof F=="string")T=F.split("T")[0]||F;else {let S=F.getUTCFullYear(),P=String(F.getUTCMonth()+1).padStart(2,"0"),k=String(F.getUTCDate()).padStart(2,"0");T=`${S}-${P}-${k}`;}switch(r.dateFilter){case "overdue":return T<N;case "today":return T===N;case "this-week":let S=new Date(N+"T00:00:00"),P=new Date(T+"T00:00:00"),k=new Date(S);return k.setDate(k.getDate()+7),P>=S&&P<=k;case "custom":if(r.dateRange){let j=typeof F=="string"?new Date(F):F;return j>=r.dateRange.start&&j<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(y=y.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,N=h.createdAt?new Date(h.createdAt).getTime():0;v=w-N;break;case "priority":let D={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},F=D[b.priority||"LOW"],T=D[h.priority||"LOW"];v=F-T;break;case "dueDate":let S=b.endDate||b.dueDate,P=h.endDate||h.dueDate;if(!S)return 1;if(!P)return -1;let k=typeof S=="string"?new Date(S).getTime():S.getTime(),j=typeof P=="string"?new Date(P).getTime():P.getTime();v=k-j;break;case "title":v=b.title.localeCompare(h.title);break;case "estimate":let U=b.estimatedTime||0,ae=h.estimatedTime||0;v=U-ae;break;default:v=0;}return s.order==="asc"?v:-v}),y},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:d,resetFilters:i,filterMyTasks:u,filterOverdue:m,filterHighPriority:p,applyFilters:f,hasActiveFilters:g}}var sf,lf;if(typeof window<"u")try{let e=si("ai");sf=e.generateObject,lf=e.generateText;}catch{}function df(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(sf&&lf&&e.apiKey),o=useCallback(async m=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",m),{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: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw n(g),g}finally{a(false);}},[s]),l=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw n(g),g}finally{a(false);}},[s]),d=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw n(g),g}finally{a(false);}},[s]),i=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw n(g),g}finally{a(false);}},[s]),u=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw n(g),g}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:d,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Gc(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function cf(e){let{cards:t}=e,[a,r]=Gc(),n=useCallback(m=>a.selectedCardIds.includes(m),[a.selectedCardIds]),s=useCallback((m,p)=>{if(!p){r({selectedCardIds:[m],lastSelectedCardId:m});return}let g=p.ctrlKey||p.metaKey,f=p.shiftKey;if(g)a.selectedCardIds.includes(m)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,m],lastSelectedCardId:m});else if(f&&a.lastSelectedCardId){let x=t.find(b=>b.id===m),y=t.find(b=>b.id===a.lastSelectedCardId);if(x&&y&&x.columnId===y.columnId){let b=t.filter(T=>T.columnId===x.columnId).sort((T,S)=>T.position-S.position),h=b.findIndex(T=>T.id===a.lastSelectedCardId),v=b.findIndex(T=>T.id===m),[w,N]=h<v?[h,v]:[v,h],D=b.slice(w,N+1).map(T=>T.id),F=Array.from(new Set([...a.selectedCardIds,...D]));r({selectedCardIds:F,lastSelectedCardId:m});}else r({selectedCardIds:[m],lastSelectedCardId:m});}else r({selectedCardIds:[m],lastSelectedCardId:m});},[t,a,r]),o=useCallback(m=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==m),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),d=useCallback(()=>{r({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(m=>{a.selectedCardIds.includes(m)?o(m):r({selectedCardIds:[...a.selectedCardIds,m],lastSelectedCardId:m});},[a,o,r]),u=useCallback(()=>t.filter(m=>a.selectedCardIds.includes(m.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:d,toggleCard:i,getSelectedCards:u}}var uf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function pf(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...uf,...a}),[a]),[s,o]=useState([]),l=useCallback((x,y,b,h,v)=>{if(y.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:y,columnId:b,strategy:h,color:v,isExpanded:true,position:s.filter(N=>N.columnId===b).length,createdAt:new Date};o(N=>[...N,w]);},[n.minCardsPerStack,s]),d=useCallback(x=>{o(y=>y.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(y=>y.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((x,y)=>{o(b=>b.map(h=>h.id===x&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),m=useCallback((x,y)=>{o(b=>b.map(h=>{if(h.id===x){let v=h.cardIds.filter(w=>w!==y);return v.length<n.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),p=useCallback(x=>s.filter(y=>y.columnId===x).sort((y,b)=>y.position-b.position),[s]),g=useCallback(async x=>{let y=t.filter(N=>N.columnId===x);if(y.length<n.minCardsPerStack*2)return [];let b=[],h=new Map;y.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(D=>{h.has(D)||h.set(D,[]),h.get(D).push(N);});}),h.forEach((N,D)=>{N.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${D}`,cardIds:N.map(F=>F.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${N.length} cards with label "${D}"`,confidence:.85});});let v=new Map;y.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(D=>{v.has(D)||v.set(D,[]),v.get(D).push(N);});}),v.forEach((N,D)=>{N.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${D.slice(-4)}`,cardIds:N.map(F=>F.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(y.forEach(N=>{N.priority&&(w.has(N.priority)||w.set(N.priority,[]),w.get(N.priority).push(N));}),w.forEach((N,D)=>{if(N.length>=n.minCardsPerStack){let F={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[D.toLowerCase()]||"\u26AA";b.push({stack:{title:`${F} ${D} Priority`,cardIds:N.map(T=>T.id),columnId:x,strategy:"priority",color:D==="high"||D==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${D} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let N of y){let F=(await r.findSimilar(N,y)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(F.length>=n.minCardsPerStack-1){let T=[N.id,...F.map(P=>P.card.id)],S=F.reduce((P,k)=>P+k.similarity,0)/F.length;b.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:T,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${F.length+1} similar tasks`,confidence:S});}}return b.filter(N=>N.confidence>=n.autoStackConfidenceThreshold).sort((N,D)=>D.confidence-N.confidence).slice(0,5)},[t,n,r]),f=useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let b=await g(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:l,deleteStack:d,toggleStack:i,addToStack:u,removeFromStack:m,getStacksForColumn:p,getSuggestions:g,applySuggestion:f,config:n}}var mf=createContext(null);function gf({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(d=>{let{Column:i}=si("@libxai/core");s.set(d.id,new i(d));}),t?.cards?.forEach(d=>{let{Card:i}=si("@libxai/core");o.set(d.id,new i(d));});let l=null;if(t?.board){let{Board:d}=si("@libxai/core");l=new d(t.board);}r.current=new BoardStore({board:l,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(mf.Provider,{value:{store:n},children:e})}function kl(){let e=useContext(mf);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Zs(){let e=kl(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(h=>{e.updateBoard(h);},[e]),d=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,v)=>{e.updateColumn(h,v);},[e]),u=useCallback(h=>{e.deleteColumn(h);},[e]),m=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),g=useCallback((h,v)=>{e.updateCard(h,v);},[e]),f=useCallback(h=>{e.deleteCard(h);},[e]),x=useCallback((h,v,w)=>{e.moveCard(h,v,w);},[e]),y=useCallback(h=>e.getCard(h),[e]),b=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:d,updateColumn:i,deleteColumn:u,getColumn:m,addCard:p,updateCard:g,deleteCard:f,moveCard:x,getCard:y,getCardsByColumn:b}}function bf(e){let{cards:t}=Zs();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!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(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function hf(e="position",t="asc"){let{cards:a}=Zs();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},d=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=d-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var Cl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Nu.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 n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,a));l!==void 0&&(n=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},l5=new Cl;function xf({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:d}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:l}),m=u.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:n,children:jsx("div",{style:g,children:m.map(f=>{let x=e[f.index];if(!x)return null;let y=d?d(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:r(x,f.index)},y)})})})}function vf(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 kf({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:d,horizontal:i=true}){let u=useRef(null),m=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:o,gap:l}),p=m.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:g,className:s,children:jsx("div",{style:f,children:p.map(x=>{let y=e[x.index];if(!y)return null;let b=d?d(y,x.index):x.index,h={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:h,"data-index":x.index,children:n(y,x.index)},b)})})})}function Cf(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 Tf(e,t=10){return e>t}var qc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Yc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Xc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Jc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Qc={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Zc={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},eu={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},tu={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)"},au={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)"},ru={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},ou={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}},nu={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}},Tl={spacing:qc,borderRadius:Yc,fontSize:Xc,fontWeight:Jc,lineHeight:Qc,zIndex:Zc,duration:eu,easing:tu,shadows:au,opacity:ru,kanban:ou,gantt:nu};function Nf(e,t,a){return e[t]??a}function su(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?su(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function u5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function iu(e="asakaa"){let t=su(Tl),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=u5(n);a.push(` ${s}: ${o};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function tg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Io(e,t){let a=tg(e),r=t.toLowerCase().trim(),n=a.find(l=>l.name.toLowerCase()===r);if(n)return n;let s=a.find(l=>l.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(l=>{let d=l.name.toLowerCase();return o.every(i=>d.includes(i))})}function rc(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 n=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let g={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}[n[1].toLowerCase()];if(g!==void 0){let f=new Date(r),x=f.getDay(),y=g-x;return y<=0&&(y+=7),f.setDate(f.getDate()+y),f}}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),g=s[2].toLowerCase(),f=new Date(r);return g==="day"||g==="d\xEDa"||g==="dias"?f.setDate(f.getDate()+p):g==="week"||g==="semana"||g==="semanas"?f.setDate(f.getDate()+p*7):(g==="month"||g==="mes"||g==="meses")&&f.setMonth(f.getMonth()+p),f}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),g=parseInt(l[2],10)-1,f=parseInt(l[3],10);return new Date(f,g,p)}let d={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),g=d[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):r.getFullYear();if(g!==void 0)return new Date(f,g,p)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},m=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(m&&m[1]&&m[2]){let p=u[m[1].toLowerCase()],g=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):r.getFullYear();if(p!==void 0)return new Date(f,p,g)}return null}function oc(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),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function nc(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 ag(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 rg(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(),u=r[2].trim(),m=Io(t,i),p=rc(u);if(!m)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:m.id,taskName:m.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let g=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(p);return f.setDate(f.getDate()+g),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:p,endDate:f},message:`Moved "${m.name}" to ${p.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),u=n[2].trim(),m=Io(t,i),p=oc(u);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!p||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let g=new Date(m.endDate);return g.setDate(g.getDate()+p),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:g},message:`Extended "${m.name}" by ${p} days. New end date: ${g.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(),u=s[2].trim(),m=Io(t,i),p=nc(u);return m?p===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:p},message:`Set "${m.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 o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),u=o[2].trim(),m=Io(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:u},message:`Renamed "${m.name}" to "${u}".`,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(),u=l[2].trim(),m=Io(t,i),p=Io(t,u);return m?p?{type:"link_tasks",taskId:p.id,taskName:p.name,dependencyFrom:m.id,dependencyTo:p.id,message:`Linked "${m.name}" \u2192 "${p.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Source task not found"}}let d=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(d&&d[1]){let i=d[1].trim(),u=Io(t,i);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.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 og(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 w2(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 k2(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function rl(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let m=a.find(p=>p.id===u);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>rl(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},l=o(e.startDate),d=o(e.endDate),i=e.metadata?.isMilestone===true||l&&d&&Math.abs(d.getTime()-l.getTime())<=864e5;return {id:e.id,name:e.title,startDate:l,endDate:d,progress:e.progress||0,status:w2(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:i,isCriticalPath:e.metadata?.isCriticalPath===true}}function ng(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:k2(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function sg(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>rl(r,e,t))}var sc={columns:{name:"Task ID / Name",startDate:"Start Date",endDate:"End Date",progress:"Progress",status:"Status",assignees:"Assignees",priority:"Priority",actions:"Actions",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Executed",tags:"Tags",scheduleVariance:"Sched / Var",hoursBar:"Hours (Spent / Allocated)",teamLoad:"Team Load",blockers:"Blockers",weight:"Weight"},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"}},ic={columns:{name:"ID Tarea / Nombre",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",status:"Estado",assignees:"Asignados",priority:"Prioridad",actions:"Acciones",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",tags:"Etiquetas",scheduleVariance:"Prog / Var",hoursBar:"Horas (Usado / Asignado)",teamLoad:"Equipo",blockers:"Bloqueantes",weight:"Peso"},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"}},ol={en:sc,es:ic};function lc(e){return ol[e]||ol.en}function nl(e,t){let a=lc(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 dc=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function ig(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 lg({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let g=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[s]);let d=ig(e),i=dc[0],u=dc.find(g=>g.value===d)??i,m=u.icon,p=g=>{switch(ig(g)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(m,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:c("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),o(!s);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(m,{className:c("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:c("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:p(e)}),jsx(ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:c("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:dc.map(g=>{let f=g.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(g.value),o(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",d===g.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:c("w-4 h-4",g.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p(g.value)})]},g.value)})})]})}var cc=[{value:"urgent",label:{en:"Urgent",es:"Urgente"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"high",label:{en:"High",es:"Alta"},color:"text-[#FF2D20]",bg:"bg-[#FF2D20]"},{value:"medium",label:{en:"Medium",es:"Media"},color:"text-[#FFD60A]",bg:"bg-[#FFD60A]"},{value:"low",label:{en:"Low",es:"Baja"},color:"text-[#3B9EFF]",bg:"bg-[#3B9EFF]"},{value:"none",label:{en:"None",es:"Ninguna"},color:"text-gray-400",bg:"bg-gray-400"}];function cg({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),l=useRef(null);useEffect(()=>{let u=m=>{l.current&&!l.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let d=cc.find(u=>u.value===e)??cc[4],i=r==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:c("w-4 h-4",d.color)}),jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]})]}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),o(!s);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:c("w-4 h-4",d.color)}),jsx("span",{className:c("text-sm",a?"text-white/60":"text-gray-500"),children:d.label[i]}),jsx(ChevronDown,{className:c("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:c("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:cc.map(u=>jsxs("button",{onClick:m=>{m.stopPropagation(),t(u.value),o(false);},className:c("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:c("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[i]})]},u.value))})]})}function js(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function uc(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],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-[#00E5CC]"}function pc({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,l]=useState(false),[d,i]=useState(""),u=useRef(null),m=useRef(null);useEffect(()=>{let x=y=>{u.current&&!u.current.contains(y.target)&&(l(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let p=t.filter(x=>x.name.toLowerCase().includes(d.toLowerCase())),g=x=>e.some(y=>y.name===x),f=x=>{if(a){if(g(x.name))a(e.filter(y=>y.name!==x.name));else {let y={name:x.name,initials:js(x.name),color:x.color||uc(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};a([...e,y]);}l(false),i("");}};return s||!a?e.length===0?jsx("span",{className:c("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,y)=>jsx("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!x.avatar&&uc(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,title:x.name,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||js(x.name)},`${x.name}-${y}`)),e.length>3&&jsxs("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),l(!o);},className:c("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:c("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:c("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,y)=>jsx("div",{className:c("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!x.avatar&&uc(x.name)),style:x.color&&!x.avatar?{backgroundColor:x.color}:void 0,children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||js(x.name)},`${x.name}-${y}`)),e.length>2&&jsxs("span",{className:c("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:"absolute z-50 top-full left-0 mt-1.5 rounded-lg overflow-hidden",style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:m,type:"text",value:d,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,y)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:x.avatar?jsx("img",{src:x.avatar,alt:x.name,className:"w-full h-full rounded-full object-cover"}):x.initials||js(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:b=>{b.stopPropagation(),a(e.filter(h=>h.name!==x.name));},className:"flex items-center justify-center",style:{width:14,height:14,borderRadius:3,border:"none",background:"transparent",color:"inherit",cursor:"pointer",opacity:.7},children:jsx(X,{style:{width:10,height:10}})})]},`${x.name}-${y}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:p.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):p.map(x=>{let y=g(x.name);return jsxs("button",{onClick:b=>{b.stopPropagation(),f(x);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:y?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{y||(b.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{y||(b.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:x.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:x.avatarUrl?jsx("img",{src:x.avatarUrl,alt:x.name,className:"w-full h-full rounded-full object-cover"}):js(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),y&&jsx("div",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:4,backgroundColor:"rgba(96, 165, 250, 0.2)"},children:jsx("div",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#60A5FA"}})})]},x.id)})})]})]})}function bg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:l=false,placeholder:d}){let[i,u]=useState(false),[m,p]=useState(n),[g,f]=useState(()=>{let k=n==="start"?e:t;if(k){let j=k instanceof Date?k:new Date(k);return new Date(j.getFullYear(),j.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),y=useRef(null),b=useRef(null),[h,v]=useState(null),w=e?e instanceof Date?e:new Date(e):null,N=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let k=j=>{let U=j.target;x.current&&x.current.contains(U)||b.current&&b.current.contains(U)||u(false);};return i&&document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),useLayoutEffect(()=>{if(!i){v(null);return}let k=()=>{let j=y.current?.getBoundingClientRect();if(!j)return;let U=520,ae=360,L=window.innerHeight-j.bottom,X=L<ae&&j.top>L,Y=X?j.top-4:j.bottom+4,V=Math.min(Math.max(j.left,8),window.innerWidth-U-8);v({top:Y,left:V,flipUp:X});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[i]),useEffect(()=>{i&&p(r?n:"start");},[i,r,n]);let S=k=>k?k.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):d||"-",F=useCallback(()=>{let k=g.getFullYear(),j=g.getMonth(),U=new Date(k,j,1),L=new Date(k,j+1,0).getDate(),X=U.getDay(),Y=[],R=new Date(k,j,0).getDate();for(let Ne=X-1;Ne>=0;Ne--)Y.push({date:new Date(k,j-1,R-Ne),isCurrentMonth:false});for(let Ne=1;Ne<=L;Ne++)Y.push({date:new Date(k,j,Ne),isCurrentMonth:true});let J=42-Y.length;for(let Ne=1;Ne<=J;Ne++)Y.push({date:new Date(k,j+1,Ne),isCurrentMonth:false});return Y},[g]),T=k=>{if(r)n==="start"?a(k,N||void 0):a(w||void 0,k),u(false);else if(m==="start"){let j=N&&k>N?k:N;a(k,j||void 0),p("end");}else {let j=w&&k<w?k:w;a(j||void 0,k),u(false);}},E=()=>{let k=new Date,j=new Date(k);j.setDate(k.getDate()+1);let U=new Date(k);U.setDate(k.getDate()+((6-k.getDay()+7)%7||7));let ae=new Date(k);ae.setDate(k.getDate()+((1-k.getDay()+7)%7||7));let L=new Date(k);L.setDate(k.getDate()+(6-k.getDay()+7)%7+7);let X=new Date(k);X.setDate(k.getDate()+14);let Y=new Date(k);return Y.setDate(k.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:k,display:k.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:j,display:j.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:U,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ae,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:L,display:L.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:X,display:X.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:Y,display:Y.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(l){let k=r&&n==="start"?w:N;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:S(k)})]})}let P=r&&n==="start"?w:N;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{ref:y,onClick:k=>{k.stopPropagation(),u(!i);let j=n==="start"?w:N;j&&f(new Date(j.getFullYear(),j.getMonth(),1));},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Calendar,{className:c("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm",s?"text-white/60":"text-gray-500"),children:S(P)})]}),i&&h&&createPortal(jsxs("div",{ref:b,className:c("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:h.flipUp?void 0:h.top,bottom:h.flipUp?window.innerHeight-h.top:void 0,left:h.left,zIndex:10001},onClick:k=>k.stopPropagation(),children:[jsxs("div",{className:c("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[E().map((k,j)=>jsxs("button",{className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>T(k.date),children:[jsx("span",{children:k.label}),jsx("span",{className:c("text-xs",s?"text-white/30":"text-gray-400"),children:k.display})]},j)),jsx("div",{className:c("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,N||void 0):a(w||void 0,void 0):a(void 0,void 0),u(false);},className:c("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",s?"hover:bg-white/[0.05] text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fecha":"Clear date"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[!r&&jsx("div",{className:c("text-xs mb-3 px-2 py-1 rounded",s?"bg-white/[0.03] text-white/60":"bg-gray-100 text-gray-600"),children:m==="start"?o==="es"?"\u{1F4C5} Selecciona fecha de inicio":"\u{1F4C5} Select start date":o==="es"?"\u{1F4C5} Selecciona fecha de fin":"\u{1F4C5} Select end date"}),jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("span",{className:c("font-medium",s?"text-white":"text-gray-900"),children:g.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>f(new Date),className:c("p-1 rounded text-sm transition-colors",s?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>f(new Date(g.getFullYear(),g.getMonth()-1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:c("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(g.getFullYear(),g.getMonth()+1)),className:c("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:c("w-4 h-4",s?"text-white":"text-gray-600")})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(k=>jsx("div",{className:c("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:k},k))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:F().map((k,j)=>{let U=k.date.toDateString()===new Date().toDateString(),ae=w?.toDateString()===k.date.toDateString(),L=N?.toDateString()===k.date.toDateString(),X=ae||L,Y=!r&&w&&N&&k.date>=w&&k.date<=N;return jsx("button",{onClick:()=>T(new Date(k.date)),className:c("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!k.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),k.isCurrentMonth&&(s?"text-white":"text-gray-900"),U&&"ring-2 ring-[#00E5CC]",ae&&"bg-[#00E5CC] text-white",L&&!ae&&"bg-[#7C3AED] text-white",Y&&!X&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!X&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:k.date.getDate()},j)})})]})]}),document.body)]})}function dl({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:l}){let d=e?e instanceof Date?e:new Date(e):null;return jsx(bg,{startDate:s==="start"?d:o||null,endDate:s==="end"?d:l||null,onChange:(p,g)=>{t&&t(s==="start"?p:g);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function ss(e=600){let[t,a]=useState(false),r=useRef(null),n=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:n}}function cl(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[l,d]=useState(false),i=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,p=e,g=p-m,f=r/n;d(true);for(let x=1;x<=n;x++){let y=setTimeout(()=>{let b=x/n,h=1-Math.pow(1-b,3),v=Math.round(m+g*h);o(v),x===n&&(d(false),o(p));},f*x);u.current.push(y);}return i.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:l}}function hg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,l]=useState(0),d=useRef(null),i=useRef(null),u=useCallback(g=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(g),l(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,y=Math.min(x/a*100,100);l(y);},16),d.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(g),s(null),l(0);},a);},[a,e]),m=useCallback(()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current),s(null),l(0),r?.();},[r]);return useEffect(()=>()=>{d.current&&clearTimeout(d.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:m}}function xg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,l]=useState(false),[d,i]=useState(""),u=useRef(null),{isFlashing:m,triggerFlash:p}=ss(),{displayValue:g,isAnimating:f}=cl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(r||!t)return;w.stopPropagation();let N=w.currentTarget.getBoundingClientRect(),S=w.clientX-N.left,F=Math.round(S/N.width*100),T=Math.max(0,Math.min(100,F));T!==e&&(t(T),s&&p());},y=useCallback(w=>{r||!t||(w.stopPropagation(),i(String(e)),l(true));},[r,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let b=useCallback(()=>{l(false);let w=parseInt(d,10);if(!isNaN(w)&&t){let N=Math.max(0,Math.min(100,w));N!==e&&(t(N),s&&p());}},[d,t,e,s,p]),h=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&l(false);},[b]),v=g??e;return jsxs("div",{className:c("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsx("div",{onClick:x,className:c("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:c("h-full rounded-full transition-[width]",v===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${v}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:u,value:d,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:h,maxLength:3,className:c("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:c("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:y,className:c("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[v,"%"]})]})}function kg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[l,d]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{d(e);},[e]);let u=()=>{l!==e&&t?.(l),o(false);},m=p=>{p.key==="Enter"?u():p.key==="Escape"&&(d(e),o(false));};return n||!t?jsx("span",{className:c("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:i,type:"text",value:l,onChange:p=>d(p.target.value),onBlur:u,onKeyDown:m,onClick:p=>p.stopPropagation(),className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:p=>{p.stopPropagation(),o(true);},className:c("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Ng({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:l=true,enableSaveFlash:d=true}){let[i,u]=useState(false),[m,p]=useState(e?.toString()||""),g=useRef(null),{isFlashing:f,triggerFlash:x}=ss(),{displayValue:y,isAnimating:b}=cl(e,{enabled:l&&!i});useEffect(()=>{i&&g.current&&(g.current.focus(),g.current.select());},[i]),useEffect(()=>{p(e?.toString()||"");},[e]);let h=()=>{let w=parseFloat(m);if(!isNaN(w)){let N=w;n!==void 0&&(N=Math.max(n,N)),s!==void 0&&(N=Math.min(s,N)),N!==e&&(t?.(N),d&&x());}u(false);},v=w=>{w.key==="Enter"?h():w.key==="Escape"&&(p(e?.toString()||""),u(false));};return o||!t?jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500",b&&"font-medium"),children:y!==void 0?y:r}):i?jsx("input",{ref:g,type:"number",value:m,onChange:w=>p(w.target.value),onBlur:h,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),u(true);},className:c("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",y===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:y!==void 0?y:r})}function Dg({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,l]=useState(false),d=useRef(null);return useEffect(()=>{let i=u=>{d.current&&!d.current.contains(u.target)&&l(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!a?jsx("span",{className:c("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),l(!o);},className:c("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:c("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:c("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:c("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-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:c("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(i),l(false);},className:c("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(r?"bg-white/[0.03]":"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-[#00E5CC]"})]},i))})]})}function Eg({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:l,progress:d,startChange:i,cancelChange:u}=hg(t,{delay:s}),m=g=>{g.stopPropagation(),!r&&t&&(n?l?u():i(!e):t(!e));},p=l?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:m,disabled:r||!t,className:c("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",p?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] 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-[#050505]":"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:`${d/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:g=>{g.stopPropagation(),u();},className:c("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 Fg({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:c("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=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-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className:c("inline-flex items-center px-2 py-0.5 text-xs rounded-full",t?"bg-white/[0.05] text-white/60":"bg-gray-100 text-gray-500"),children:["+",n]})]})}function s1(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 i1(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),d=parseInt(a[2],10);return l*60+d}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let l=parseFloat(r[1]),d=r[2]?parseInt(r[2],10):0;return Math.round(l*60)+d}let n=t.match(/^(\d+\.?\d*)\s*h$/);if(n&&n[1])return Math.round(parseFloat(n[1])*60);let s=t.match(/^(\d+)\s*(m|min)$/);if(s&&s[1])return parseInt(s[1],10);let o=parseFloat(t);return isNaN(o)?null:Math.round(o*60)}function Rr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:l=false,lens:d="hours",hourlyRate:i=0,financialOverride:u}){let[m,p]=useState(false),[g,f]=useState(""),x=useRef(null),{isFlashing:y,triggerFlash:b}=ss(),h=d==="financial"&&(i>0||u!=null),v=u??(e?e/60*i:0),w=h&&(u!=null?u>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:s1(e,r);useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),useEffect(()=>{if(e){let T=Math.floor(e/60),E=e%60;T>0&&E>0?f(`${T}h ${E}m`):T>0?f(`${T}h`):f(`${E}m`);}else f("");},[e,m]);let N=()=>{let T=i1(g);T!==e&&(t?.(T),o&&b()),p(false);},S=T=>{T.key==="Enter"?N():T.key==="Escape"&&p(false);};if(l)return 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:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let F=h?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(F,{className:c("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:c("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):m?jsx("input",{ref:x,type:"text",value:g,onChange:T=>f(T.target.value),onBlur:N,onKeyDown:S,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:c("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),p(true);},className:c("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",y&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(F,{className:c("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function Bg({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:c("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=d=>d.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),l=()=>{if(a==null)return null;let d=n==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:d?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:d?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",d?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",d?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:c("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),l()]})}function Og({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:l="hours",hourlyRate:d=0}){let i=a==="es",u=l==="financial"&&d>0,m=Y=>u?`$${Math.round(Y*d).toLocaleString("en-US")}`:`${Y}h`,[p,g]=useState(false),[f,x]=useState(false),[y,b]=useState(null),h=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,N=e.soldEffortMinutes||0,S=Math.round(v/60*10)/10,F=Math.round(w/60*10)/10,T=w>0?v/w*100:0,E=T>100?Math.round((v-w)/60*10)/10:0,P=T>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!y)return;let Y=V=>{h.current&&!h.current.contains(V.target)&&(x(false),b(null));};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[f,y]);let k=Y=>{if(Y.stopPropagation(),r&&!n&&!s){b("log");return}if(r||n||s){x(V=>!V),b(null);return}o&&o(e);},j=Y=>{x(false),b(Y);},U=async(Y,V)=>{y==="log"&&r&&Y?r(e,Y,V):y==="estimate"&&n?n(e,Y):y==="quoted"&&s&&s(e,Y),b(null);},ae=r||n||s||o,L=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(Y=>Y.show),X=y==="estimate"?w:y==="quoted"?N:void 0;return w===0&&v===0&&N===0?jsxs("div",{ref:h,className:"relative flex items-center gap-2",onClick:Y=>Y.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsx("span",{className:c("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),p&&ae&&jsx("button",{onClick:k,className:"flex items-center justify-center w-6 h-6 rounded-md transition-colors",style:{color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent"},onMouseEnter:Y=>{Y.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Y.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Y=>{Y.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Y.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(Y=>jsxs("button",{onClick:V=>{V.stopPropagation(),j(Y.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(Y.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Y.label]},Y.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(fo,{mode:y,locale:a,isDark:t,currentValue:X||void 0,onSave:U,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:h,className:"relative flex items-center gap-2 w-full",onClick:Y=>Y.stopPropagation(),onMouseEnter:()=>g(true),onMouseLeave:()=>g(false),children:[jsxs("div",{className:"flex flex-col gap-1 flex-1 min-w-0",style:{padding:"8px 12px",borderRadius:"4px",border:t?"1px solid #333":"1px solid #E5E7EB",backgroundColor:t?"#1A1A1A":"#F9FAFB"},children:[(()=>{let Y=v===0,R=(w>0?v/w:0)>1.1;return jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{className:"font-mono",style:{fontSize:13,fontWeight:700,color:Y?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(S)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(F)]}),E>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:R?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:R?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(E)," ",i?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:P,borderRadius:2,transition:"width 0.3s"}})})]}),ae&&jsx("button",{onClick:k,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:p?1:0,pointerEvents:p?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:Y=>{Y.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",Y.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Y=>{Y.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",Y.currentTarget.style.backgroundColor="transparent";},title:i?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:f&&jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.1},className:"absolute right-0 top-full mt-1 z-50",style:{background:t?"rgba(10,10,10,0.95)":"#FFFFFF",border:t?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:8,boxShadow:t?"0 8px 32px rgba(0,0,0,0.6)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)",overflow:"hidden",minWidth:160},children:L.map(Y=>jsxs("button",{onClick:V=>{V.stopPropagation(),j(Y.mode);},className:"w-full flex items-center gap-2 px-3 py-2 text-left transition-colors",style:{fontSize:11,fontFamily:"'JetBrains Mono', monospace",color:t?"rgba(255,255,255,0.7)":"#374151",background:"transparent",border:"none",cursor:"pointer"},onMouseEnter:V=>{V.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:V=>{V.target.style.background="transparent";},children:[jsx(Y.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),Y.label]},Y.mode))})}),jsx(AnimatePresence,{children:y&&jsx("div",{className:"absolute right-0 top-full mt-1 z-50",children:jsx(motion.div,{initial:{opacity:0,scale:.95,y:-4},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-4},transition:{duration:.12},children:jsx(fo,{mode:y,locale:a,isDark:t,currentValue:X||void 0,onSave:U,onClose:()=>b(null)})})})})]})}function g1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function f1(e){return e>100?{bg:"rgba(239,68,68,0.15)",text:"#EF4444"}:e>=86?{bg:"rgba(245,158,11,0.15)",text:"#F59E0B"}:e>=61?{bg:"rgba(0,229,204,0.15)",text:"#00E5CC"}:{bg:"rgba(34,197,94,0.15)",text:"#22C55E"}}function $g({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:c(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:c(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Hg({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=g1(e);if(u.length===0)return null;let m=u.slice(0,3),p=u.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:m.map((g,f)=>jsx($g,{assignee:g,size:24,isDark:t},g.name+f))}),p>0&&jsxs("span",{className:c("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(g=>g.name).join(", "),children:["+",p]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:c("w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0",t?"bg-white/5":"bg-gray-100"),children:jsx(User,{className:"w-3.5 h-3.5",style:{color:"#4B5563"}})}),jsx("span",{className:c("text-[11px]",t?"text-white/30":"text-gray-400"),children:r?"Sin asignar":"Unassigned"})]});let l=o?.percentage??0,d=!!o&&l>0,i=d?f1(l):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx($g,{assignee:s,size:28,isDark:t}),jsx("span",{className:c("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),d&&i&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:i.bg,color:i.text},children:[l,"% LOAD"]})]})}var b1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Ug({blockers:e,isDark:t,locale:a="en"}){return !e||e.length===0?jsx("span",{className:c("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxs("span",{className:c("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",b1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function F1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function A1(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 qg({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:l,onColumnHide:d,onColumnSort:i,availableUsers:u=[],onOpenTimeLog:m,onReportBlocker:p,onCopyTaskLink:g,onTaskMove:f,onTaskIndent:x,onTaskOutdent:y}){let b=useRef(null),h=r==="es"?Gg.es:Gg.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let E=b.current;if(!E)return;let P=E.getBoundingClientRect(),k=8,j=e.x,U=e.y;e.y+P.height>window.innerHeight-k&&(U=Math.max(k,e.y-P.height)),e.x+P.width>window.innerWidth-k&&(j=Math.max(k,window.innerWidth-P.width-k)),(j!==e.x||U!==e.y)&&w({left:j,top:U});},[e.x,e.y,e.isOpen]),useEffect(()=>{let E=k=>{b.current&&!b.current.contains(k.target)&&t();},P=k=>{k.key==="Escape"&&t();};return document.addEventListener("mousedown",E),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",P);}},[t]),!e.isOpen)return null;let N=()=>{if(!e.task)return [];let E=[];return n&&E.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),E.push({id:"sep1",label:"",icon:null,separator:true}),l&&(E.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.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:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{l({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{l({...e.task,status:"completed",progress:100}),t();}}]}),E.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.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:h.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:h.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:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{l({...e.task,priority:"low"}),t();}}]}),u.length>0&&E.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(P=>({id:`assign-${P.id}`,label:P.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:P.name.charAt(0).toUpperCase()}),onClick:()=>{let k=e.task.assignees||[],U=k.some(ae=>ae.name===P.name)?k.filter(ae=>ae.name!==P.name):[...k,{name:P.name,initials:F1(P.name),color:P.color||A1(P.name),avatar:P.avatarUrl}];l({...e.task,assignees:U}),t();}}))})),m&&E.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),p&&E.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),g&&E.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{g(e.task),t();}}),E.push({id:"sep2",label:"",icon:null,separator:true}),s&&E.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||y)&&(E.push({id:"sep3",label:"",icon:null,separator:true}),f&&(E.push({id:"move-up",label:h.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),E.push({id:"move-down",label:h.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&E.push({id:"indent",label:h.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),y&&E.push({id:"outdent",label:h.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{y(e.task.id),t();}})),o&&E.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),E},S=()=>{if(!e.columnId)return [];let E=[];return i&&(E.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),E.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),d&&e.columnId!=="name"&&(E.push({id:"sep-hide",label:"",icon:null,separator:true}),E.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{d(e.columnId),t();}})),E},F=e.type==="task"?N():S(),T={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:T,className:c("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:F.map(E=>E.separator?jsx("div",{className:c("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},E.id):E.submenu?jsx(L1,{item:E,isDark:a},E.id):jsxs("button",{onClick:E.onClick,className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",E.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:c(E.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:E.icon}),E.label]},E.id))})}function L1({item:e,isDark:t}){let[a,r]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:e.icon}),jsx("span",{className:"flex-1",children:e.label}),jsx(ChevronRight,{className:c("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),a&&e.submenu&&jsx("div",{className:c("absolute left-full top-0 ml-1 py-1 rounded-lg shadow-xl border min-w-[160px]",t?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:e.submenu.map(l=>jsxs("button",{onClick:l.onClick,className:c("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",t?"hover:bg-white/[0.05] text-white":"hover:bg-gray-100 text-gray-700"),children:[jsx("span",{className:t?"text-white/60":"text-gray-400",children:l.icon}),l.label]},l.id))})]})}var Gg={en:{edit:"Edit",changeStatus:"Change status",changePriority:"Change priority",assignUser:"Assign user",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",indent:"Make subtask",outdent:"Remove from parent",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",logTime:"Log Time",reportBlocker:"Report Blocker",copyLink:"Copy Link"},es:{edit:"Editar",changeStatus:"Cambiar estado",changePriority:"Cambiar prioridad",assignUser:"Asignar usuario",duplicate:"Duplicar",moveUp:"Mover arriba",moveDown:"Mover abajo",indent:"Convertir en subtarea",outdent:"Sacar de subtarea",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",logTime:"Registrar Tiempo",reportBlocker:"Reportar Bloqueante",copyLink:"Copiar Enlace"}};var a0={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"}),scheduleVariance:jsx(CalendarClock,{className:"w-4 h-4"}),hoursBar:jsx(BarChart3,{className:"w-4 h-4"}),teamLoad:jsx(Users,{className:"w-4 h-4"}),blockers:jsx(AlertTriangle,{className:"w-4 h-4"}),weight:jsx(BarChart,{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"})},X1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function o0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:l}){let[d,i]=useState(""),[u,m]=useState(null),[p,g]=useState(null),f=useRef(null),x=l==="es"?r0.es:r0.en;useLayoutEffect(()=>{if(!e||!f.current)return;let F=()=>{if(!f.current)return;let T=f.current.parentElement;if(T){let j=T.getBoundingClientRect();g({top:j.bottom+4,right:window.innerWidth-j.right});}let E=f.current.getBoundingClientRect(),k=window.innerHeight-E.top-20;m(Math.max(300,k));};return requestAnimationFrame(F),window.addEventListener("resize",F),()=>window.removeEventListener("resize",F)},[e]),useEffect(()=>{if(!e)return;let F=setTimeout(()=>{let T=P=>{f.current&&!f.current.contains(P.target)&&t();},E=P=>{P.key==="Escape"&&t();};document.addEventListener("mousedown",T),document.addEventListener("keydown",E),f._cleanup=()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",E);};},100);return ()=>{clearTimeout(F),f._cleanup&&f._cleanup();}},[e,t]);let y=useMemo(()=>{let F=new Set([...X1]);return a.forEach(T=>{T.type&&T.type!=="assignees"&&F.add(T.type);}),Array.from(F)},[a]);if(!e)return null;let b=F=>{let T=x.columns[F];if(T)return T;let E=a.find(P=>P.type===F);return E?.label?E.label:F},h=F=>{if(F==="name")return;let T=a.map(E=>E.id===F?{...E,visible:!E.visible}:E);n(T);},v=(F,T)=>{let E=a.find(k=>k.type===F&&(!T||k.customFieldId===T));if(E){h(E.id);return}let P={id:T||F,type:F,label:T?r.find(k=>k.id===T)?.name||F:b(F),width:120,visible:true,sortable:true,resizable:true,customFieldId:T};n([...a,P]);},w=y.filter(F=>F!=="assignees"&&b(F).toLowerCase().includes(d.toLowerCase())),N=r.filter(F=>F.name.toLowerCase().includes(d.toLowerCase())),S=o?"#00E5FF":"#00E5CC";return jsxs("div",{ref:f,style:{...u?{maxHeight:`${u}px`}:{},...p?{top:p.top,right:p.right}:{},background:o?"#111114":"#FFFFFF",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:o?"0 8px 32px rgba(0,0,0,0.7)":"0 8px 32px rgba(0,0,0,0.12)",zIndex:99999},className:"fixed w-64 rounded-xl flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3.5 py-2.5",style:{borderBottom:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:o?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:x.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:F=>{F.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",F.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:F=>{F.currentTarget.style.backgroundColor="transparent",F.currentTarget.style.color=o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)";},children:jsx(X,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"px-3 py-2",children:jsxs("div",{className:"relative",children:[jsx(Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5",style:{color:o?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:d,onChange:F=>i(F.target.value),placeholder:x.searchPlaceholder,style:{fontSize:12,background:o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:o?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.8)"},className:"w-full pl-8 pr-3 py-1.5 rounded-lg outline-none placeholder:opacity-40 transition-colors focus:border-[var(--focus-border)]",ref:F=>{F&&F.style.setProperty("--focus-border",S);},onFocus:F=>{F.currentTarget.style.borderColor=S,F.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:F=>{F.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",F.currentTarget.style.background=o?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)";}})]})}),jsxs("div",{className:"overflow-y-auto flex-1 min-h-0 overscroll-contain px-2 pb-2",onWheel:F=>F.stopPropagation(),children:[jsxs("div",{className:"mb-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:x.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:w.map(F=>{let T=a.find(k=>k.type===F&&!k.customFieldId),E=T?.visible??false,P=F==="name";return jsxs("button",{onClick:()=>{P||(T?h(T.id):v(F));},disabled:P,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:P?.4:1,cursor:P?"not-allowed":"pointer"},onMouseEnter:k=>{P||(k.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:k=>{k.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?S:"transparent",border:E?`1.5px solid ${S}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${S}40`:"none"},children:E&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:E?S:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:a0[F]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:E?500:400,color:E?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:b(F),children:b(F)})]},F)})})]}),N.length>0&&jsxs("div",{className:"mt-1",children:[jsx("div",{className:"px-1.5 py-1.5",style:{fontSize:9,fontWeight:600,letterSpacing:"0.1em",color:o?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:x.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:N.map(F=>{let E=a.find(P=>P.customFieldId===F.id)?.visible??false;return jsxs("button",{onClick:()=>v(F.type,F.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:P=>{P.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:E?S:"transparent",border:E?`1.5px solid ${S}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:E?`0 0 6px ${S}40`:"none"},children:E&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:E?S:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:a0[F.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:E?500:400,color:E?o?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":o?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:F.name})]},F.id)})})]})]})]})}var r0={en:{title:"Columns",searchPlaceholder:"Search fields...",standardFields:"Standard Fields",customFields:"Custom Fields",columns:{name:"Name",status:"Status",priority:"Priority",startDate:"Start Date",endDate:"End Date",progress:"Progress",tags:"Tags",estimatedTime:"Estimated",quotedTime:"Quoted",elapsedTime:"Time Spent",soldEffortMinutes:"Quoted",effortMinutes:"Estimated",timeLoggedMinutes:"Executed",text:"Text",number:"Number",date:"Date",dropdown:"Dropdown",checkbox:"Checkbox",weight:"Weight"}},es:{title:"Columnas",searchPlaceholder:"Buscar campos...",standardFields:"Campos Est\xE1ndar",customFields:"Campos Personalizados",columns:{name:"Nombre",status:"Estado",priority:"Prioridad",startDate:"Fecha Inicio",endDate:"Fecha Fin",progress:"Progreso",tags:"Etiquetas",estimatedTime:"Estimado",quotedTime:"Ofertado",elapsedTime:"Ejecutado",soldEffortMinutes:"Ofertado",effortMinutes:"Estimado",timeLoggedMinutes:"Ejecutado",text:"Texto",number:"N\xFAmero",date:"Fecha",dropdown:"Lista",checkbox:"Casilla",weight:"Peso"}}};var nw=[{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 i0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[l,d]=useState("text"),[i,u]=useState([""]),m=n==="es"?s0.es:s0.en;useEffect(()=>{e&&(o(""),d("text"),u([""]));},[e]),useEffect(()=>{let y=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,t]);let p=()=>{if(!s.trim())return;let y={name:s.trim(),type:l};l==="dropdown"&&(y.options=i.filter(b=>b.trim())),a(y),t();},g=()=>{u([...i,""]);},f=(y,b)=>{let h=[...i];h[y]=b,u(h);},x=y=>{i.length>1&&u(i.filter((b,h)=>h!==y));};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:c("relative w-full max-w-md rounded-xl shadow-2xl border",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:c("flex items-center justify-between px-6 py-4 border-b",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:c("text-lg font-semibold",r?"text-white":"text-gray-900"),children:m.title}),jsx("button",{onClick:t,className:c("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:c("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.fieldName}),jsx("input",{type:"text",value:s,onChange:y=>o(y.target.value),placeholder:m.fieldNamePlaceholder,className:c("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:nw.map(y=>jsxs("button",{onClick:()=>d(y.type),className:c("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",l===y.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:l===y.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:y.icon}),jsx("span",{className:c("text-xs",l===y.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:m.types[y.type]})]},y.type))})]}),l==="dropdown"&&jsxs("div",{children:[jsx("label",{className:c("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:m.options}),jsxs("div",{className:"space-y-2",children:[i.map((y,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:y,onChange:h=>f(b,h.target.value),placeholder:`${m.option} ${b+1}`,className:c("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),i.length>1&&jsx("button",{onClick:()=>x(b),className:c("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},b)),jsxs("button",{onClick:g,className:c("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),m.addOption]})]})]})]}),jsxs("div",{className:c("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsx("button",{onClick:p,disabled:!s.trim(),className:c("px-4 py-2 text-sm font-medium rounded-lg transition-colors","bg-[#00E5CC] text-white hover:bg-[#005FCC]",!s.trim()&&"opacity-50 cursor-not-allowed"),children:m.create})]})]})]}):null}var s0={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 c0={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 u0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,l]=useState(false),d=useRef(null),i=useRef(0),u=s==="es"?c0.es:c0.en;useEffect(()=>{if(!o)return;let g=x=>{Date.now()-i.current<100||d.current&&!d.current.contains(x.target)&&l(false);},f=x=>{x.key==="Escape"&&l(false);};return document.addEventListener("mousedown",g),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],p=e!=="all"||t;return jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:g=>{g.stopPropagation(),o||(i.current=Date.now()),l(f=>!f);},className:c("flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] font-medium transition-all border",n?"border-[#222] hover:bg-white/[0.05] text-white/70":"border-gray-200 hover:bg-gray-100 text-gray-700",p&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,p&&jsx("span",{className:c("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:c("absolute left-0 top-full mt-2 w-72 rounded-lg shadow-xl border z-50",n?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsx("div",{className:c("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:c("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:u.filterByStatus})}),jsx("div",{className:"py-2",children:m.map(g=>{let f=e===g.value&&!t,x=()=>g.value==="all"?f?jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-4 h-4 rounded-full border-2 border-gray-400"}):g.icon;return jsxs("button",{onClick:()=>{a(g.value),r(false),l(false);},className:c("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",f&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:c(f?g.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:c("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:g.label}),f&&jsx(Check,{className:c("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},g.value)})}),jsx("div",{className:c("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let g=!t;r(g),g&&a("all"),l(false);},className:c("w-full flex items-center gap-3 px-4 py-2.5 text-sm transition-colors",n?"hover:bg-white/[0.05]":"hover:bg-gray-100",t&&(n?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(EyeOff,{className:c("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:c("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:u.hideCompleted}),t&&jsx(Check,{className:c("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function p0(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Dn(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function m0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",l=n==="financial";return jsxs("div",{className:c("w-[260px] xl:w-[320px] flex-shrink-0 overflow-y-auto border-l",t?"bg-[#141414] border-[#222]":"bg-gray-50 border-gray-200"),children:[jsxs("div",{className:c("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:c("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:l?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,className:c("p-1 rounded transition-colors",t?"text-white/30 hover:text-white/60 hover:bg-white/[0.05]":"text-gray-400 hover:text-gray-600 hover:bg-gray-200"),title:o?"Cerrar panel":"Close panel",children:jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:jsx("path",{d:"M1 1l10 10M11 1L1 11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),l&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let d=e.totalOffered??0,i=e.totalEstimated??0,u=e.totalExecuted??0,m=d-u,p=d>0?Math.round(m/d*100):0,g=d>0?Math.min(Math.round(u/d*100),120):0,f=u>d&&d>0,x=f?"#F87171":"#00E5CC";return jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"PRESUPUESTO":"BUDGET"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Dn(d)})]}),(()=>{let y=e.totalEstimatedLabor??0,b=e.totalEstimatedEquipment??0,h=e.totalEstimatedTravel??0,v=b>0||h>0,w=(N,S)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:N}),jsx("span",{className:c("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Dn(S)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:Dn(i)})]}),v&&jsxs(Fragment,{children:[w(o?"Mano de obra":"Labor",y),b>0&&w(o?"Activos":"Equipment",b),h>0&&w(o?"Vi\xE1ticos":"Travel",h)]})]})})(),u>0&&(()=>{let y=e.totalExecutedLabor??0,b=e.totalExecutedEquipment??0,h=e.totalExecutedTravel??0,v=b>0||h>0,w=(N,S)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:N}),jsx("span",{className:c("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Dn(S)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:c("text-[11px] font-mono font-bold",f?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Dn(u)})]}),v&&jsxs(Fragment,{children:[w(o?"Mano de obra":"Labor",y),b>0&&w(o?"Activos":"Equipment",b),h>0&&w(o?"Vi\xE1ticos":"Travel",h)]})]})})(),d>0&&jsx("div",{className:c("w-full h-2.5 rounded-full overflow-hidden mt-2",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(g,100)}%`,backgroundColor:x}})}),jsxs("div",{className:c("mt-2 px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[m>=0?`+${Dn(m)} ${o?"Disp.":"Avail."}`:`${Dn(Math.abs(m))} ${o?"P\xE9rdida":"Loss"}`,d>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",p,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let d=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,u=i>0?Math.min(Math.round(d/i*100),100):0,g=(i>0?d/i:0)>1.1?"#F87171":u>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"HORAS DEL PROYECTO":"PROJECT HOURS"}),jsxs("div",{className:"space-y-2",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:c("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:p0(d)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:c("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:p0(i)})]}),i>0&&jsx("div",{className:c("w-full h-1.5 rounded-full overflow-hidden mt-1",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${u}%`,backgroundColor:g}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"SALUD T\xC9CNICA":"TECHNICAL HEALTH"}),jsxs("div",{className:"space-y-3",children:[e.openRFIs!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:c("px-2 py-0.5 rounded text-[11px] font-mono font-bold",e.openRFIs>0?"bg-[#F87171]/15 text-[#F87171]":"bg-[#3BF06E]/15 text-[#3BF06E]"),children:e.openRFIs})]}),e.submittalsApprovalPercent!==void 0&&jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:c("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:[e.submittalsApprovalPercent,"%"]})]})]})]}),e.unassignedCount!=null&&e.unassignedCount>0&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"TAREAS SIN ASIGNAR":"UNASSIGNED TASKS"}),jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("div",{className:c("flex items-center justify-center w-10 h-10 rounded-lg font-mono text-lg font-bold",e.unassignedCount>=10?"bg-[#F87171]/15 text-[#F87171]":"bg-[#FFD60A]/15 text-[#FFD60A]"),children:e.unassignedCount}),jsxs("div",{children:[jsx("p",{className:c("text-xs font-medium",t?"text-white/80":"text-gray-700"),children:e.unassignedCount===1?o?"tarea pendiente":"pending task":o?"tareas pendientes":"pending tasks"}),jsx("p",{className:c("text-[10px]",t?"text-white/40":"text-gray-400"),children:o?"sin recurso asignado":"without assigned resource"})]})]}),e.unassignedTasks&&e.unassignedTasks.length>0&&jsx("div",{className:c("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(d=>jsxs("button",{onClick:()=>s?.(d.id),className:c("flex items-center gap-2 px-2.5 py-1.5 rounded-md text-[11px] w-full text-left transition-colors",t?"bg-white/[0.04] text-white/70 hover:bg-white/[0.08] hover:text-white":"bg-gray-50 text-gray-600 hover:bg-gray-100 hover:text-gray-900",s&&"cursor-pointer"),children:[jsx("span",{className:c("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:d.name})]},d.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:c("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:c("text-[10px] font-mono uppercase tracking-wider mb-3",t?"text-white/40":"text-gray-500"),children:o?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let d=e.scheduleVarianceDays??0,i=d>0,u=d<0,m=e.scheduleVarianceLabel||(i?`+${d} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:u?`${d} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:c("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",u&&"bg-[#F87171]/15 text-[#F87171]",!i&&!u&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:c("text-[11px] font-mono uppercase tracking-wider font-semibold mb-3",t?"text-white/60":"text-gray-600"),children:o?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((d,i)=>{let u=d.utilizationPercent>=100?"#F87171":d.utilizationPercent>=80?"#FFD60A":d.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:c("text-xs",t?"text-white/60":"text-gray-600"),children:d.name}),jsxs("span",{className:c("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[d.utilizationPercent,"%"]})]}),jsx("div",{className:c("w-full h-1.5 rounded-full overflow-hidden",t?"bg-white/[0.06]":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(d.utilizationPercent,100)}%`,backgroundColor:u}})})]},`${d.name}-${i}`)})})]})]})}var ww=[{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 w0(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...w0(n.subtasks,t+1,s));}return r}function kw(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),d=s.endDate.getTime()-o;if(d<=0)continue;let u=Math.max(0,Math.min(a.getTime()-o,d))/d*100;if(u<=0)continue;let m=(s.progress||0)/u;r+=m,n++;}return n>0?r/n:null}function ps(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=ps(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function us(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Cw({value:e,onChange:t,isDark:a}){let[r,n]=useState(false),[s,o]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:l=>l.stopPropagation(),onChange:l=>o(l.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let l=parseFloat(s);!isNaN(l)&&l>=0&&l<=100?t(l):s===""&&t(0),n(false);},onKeyDown:l=>{l.key==="Enter"&&l.target.blur(),l.key==="Escape"&&(o(String(e||"")),n(false));},className:c("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:l=>{l.stopPropagation(),o(String(e||"")),n(true);},className:c("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function x0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let l of e){let d=l.weight||0;d>0&&(t+=(l.progress||0)*d,a+=d,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((l,d)=>l+(d.effort_minutes||0),0)>0){let l=0,d=0;for(let i of e){let u=i.effort_minutes||60;l+=(i.progress||0)*u,d+=u;}return Math.round(l/d*10)/10}let o=e.reduce((l,d)=>l+(d.progress||0),0);return Math.round(o/e.length*10)/10}function Mc(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?Mc(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function k0({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:l=[],customFields:d=[],toolbarRightContent:i,onColumnHeaderClick:u,columnsWithFilter:m,filterDotColor:p="#00E5CC"}){let{theme:g="dark",locale:f="en",customTranslations:x,showSearch:y=true,showHierarchy:b=true,tableColumns:h,allowColumnCustomization:v=true,allowColumnResize:w=true,enableContextMenu:N=true,showCreateTaskButton:S=false,onCreateTask:F,persistFilter:T=false,financialBlur:E,healthSidebar:P,lens:k="hours",hourlyRate:j=0,rateMap:U,aggregateParentHours:ae=false,showProjectTotals:L=false,totalsDollarOverride:X}=t,Y=nl(f,x),V=g==="dark",R=D=>{if(!U||!D.assignees||D.assignees.length===0)return j;let oe=0,ye=0;for(let Fe of D.assignees){let qe=Fe.id?U[Fe.id]:void 0;if(qe==null||qe<=0)continue;let me=typeof Fe.estimatedMinutes=="number"?Fe.estimatedMinutes:0;me>0&&(oe+=qe*me,ye+=me);}if(ye>0)return oe/ye;let Se=D.assignees.map(Fe=>Fe.id?U[Fe.id]:void 0).filter(Fe=>Fe!=null&&Fe>0);return Se.length===0?j:Se.reduce((Fe,qe)=>Fe+qe,0)/Se.length},J=D=>{let oe=0,ye=0,Se=0,Fe=qe=>{for(let me of qe)if(me.subtasks&&me.subtasks.length>0){let Ke={s:oe,a:ye,q:Se};if(Fe(me.subtasks),oe-Ke.s+(ye-Ke.a)+(Se-Ke.q)===0){let yt=R(me);oe+=(me.timeLoggedMinutes??0)/60*yt,ye+=(me.effortMinutes??0)/60*yt,Se+=(me.soldEffortMinutes??0)/60*yt;}}else {let Ke=R(me);oe+=(me.timeLoggedMinutes??0)/60*Ke,ye+=(me.effortMinutes??0)/60*Ke,Se+=(me.soldEffortMinutes??0)/60*Ke;}};return D.subtasks&&Fe(D.subtasks),{dollarSpent:oe,dollarAllocated:ye,dollarQuoted:Se}},Ne=useCallback(()=>{if(!T||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let D=localStorage.getItem(T);if(D){let oe=JSON.parse(D);return {statusFilter:oe.statusFilter||"all",hideCompleted:oe.hideCompleted||!1}}}catch(D){console.error("Error loading persisted filter:",D);}return {statusFilter:"all",hideCompleted:false}},[T]),$e=useMemo(()=>{function D(oe){let ye=0,Se=0,Fe=0,qe=0,me=0,Ke=0;for(let Be of oe)if(Be.subtasks&&Be.subtasks.length>0){let yt=D(Be.subtasks);if(yt.spent+yt.allocated+yt.quoted>0)ye+=yt.spent,Se+=yt.allocated,Fe+=yt.quoted,qe+=yt.dollarSpent,me+=yt.dollarAllocated,Ke+=yt.dollarQuoted;else {let St=Be.timeLoggedMinutes??0,Et=Be.effortMinutes??0,Ta=Be.soldEffortMinutes??0;ye+=St,Se+=Et,Fe+=Ta;let Ea=R(Be);qe+=St/60*Ea,me+=Et/60*Ea,Ke+=Ta/60*Ea;}}else {let yt=Be.timeLoggedMinutes??0,ta=Be.effortMinutes??0,St=Be.soldEffortMinutes??0;ye+=yt,Se+=ta,Fe+=St;let Et=R(Be);qe+=yt/60*Et,me+=ta/60*Et,Ke+=St/60*Et;}return {spent:ye,allocated:Se,quoted:Fe,dollarSpent:qe,dollarAllocated:me,dollarQuoted:Ke}}return D(e)},[e]),z=useMemo(()=>{let D=new Map;function oe(ye){let Se=0;for(let Fe of ye)if(Fe.subtasks&&Fe.subtasks.length>0){let qe=oe(Fe.subtasks);D.set(Fe.id,qe),Se+=qe;}else Se+=Fe.weight||0;return Se}return oe(e),D},[e]),te=useMemo(()=>!P?.enabled||!P.data?P:{...P,data:{...P.data,totalHoursSpentMinutes:$e.spent,totalHoursAllocatedMinutes:$e.allocated}},[P,$e]),[xe,Re]=useState(true),[De,Ee]=useState(null),[Ve,ot]=useState("position"),[he,Ge]=useState("asc"),[je,He]=useState(""),[Ct,Dt]=useState(()=>Ne().statusFilter),[Je,ze]=useState(()=>Ne().hideCompleted),[lt,Lt]=useState(h||ww),[ke,gt]=useState(false),[A,se]=useState(false),[B,Z]=useState({isOpen:false,x:0,y:0,type:"task"}),[O,ee]=useState(null),[Ue,Ce]=useState(false),[Ie,Me]=useState(null),[Pe,nt]=useState(null),[at,dt]=useState(null),pt=useRef(0),jt=useRef(false),Mt=!!(a.onTaskMove||a.onTaskReparent),[zt,mt]=useState(null),[Pt,Ut]=useState(null),_t=D=>D==="assignees"||D==="teamLoad"?"assignees":D==="startDate"?"startDate":D==="endDate"?"endDate":null,Wt=useRef([]),rt=useCallback((D,oe)=>{Mt&&(oe.preventDefault(),pt.current=oe.clientY,ee(D),jt.current=false,Ce(false),dt({x:oe.clientX,y:oe.clientY}));},[Mt]),ca=useCallback(D=>{if(!O||(Math.abs(D.clientY-pt.current)>5&&!jt.current&&(jt.current=true,Ce(true)),dt({x:D.clientX,y:D.clientY}),!jt.current))return;let ye=document.querySelectorAll("[data-listview-row]"),Se=null,Fe=null;ye.forEach(qe=>{let me=qe.getBoundingClientRect(),Ke=qe.getAttribute("data-listview-row");if(Ke&&Ke!==O&&D.clientY>=me.top&&D.clientY<=me.bottom){Se=Ke;let Be=D.clientY-me.top,yt=me.height;Fe=Be<yt*.25?"above":Be>yt*.75?"below":"child";}}),Me(Se),nt(Fe);},[O]),xa=useCallback(()=>{if(jt.current&&O&&Ie&&Pe){if(Pe==="child"&&a.onTaskReparent)a.onTaskReparent(O,Ie);else if(Pe==="above"||Pe==="below"){let D=(Se,Fe,qe=null)=>{for(let me of Se){if(me.id===Fe)return qe;if(me.subtasks){let Ke=D(me.subtasks,Fe,me.id);if(Ke!==void 0)return Ke}}},oe=D(e,O,null),ye=D(e,Ie,null);if(a.onTaskReparent){let Se=(yt,ta)=>{if(ta===null)return yt;for(let St of yt){if(St.id===ta)return St.subtasks||[];if(St.subtasks){let Et=Se(St.subtasks,ta);if(Et.length>0||St.subtasks.some(Ta=>Ta.id===ta))return Et}}return []},Fe=Se(e,ye??null),qe=Fe.findIndex(yt=>yt.id===Ie),me=oe===ye,Ke=me?Fe.findIndex(yt=>yt.id===O):-1,Be=Pe==="below"?qe+1:qe;me&&Ke!==-1&&Ke<qe&&(Be-=1),a.onTaskReparent(O,ye??null,Math.max(0,Be));}}}ee(null),Me(null),nt(null),dt(null),jt.current=false,Ce(false);},[O,Ie,Pe,e,a]),W=(D,oe)=>oe==="assignees"?D.assignees:oe==="startDate"?D.startDate:D.endDate,ie=(D,oe,ye,Se)=>{D.preventDefault(),D.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Fe=Array.from(document.querySelectorAll("[data-listview-row]")),qe=Fe.map(Vt=>Vt.getAttribute("data-listview-row")||""),me=Math.max(0,qe.indexOf(oe)),Ke=Vt=>qe.slice(me,Vt+1);Ut({sourceTaskId:oe,column:ye,sourceIndex:Se,targetIndex:Se,rangeIds:new Set([oe])});let yt=(Vt=>{let At=Vt?.parentElement??null;for(;At;){let kr=window.getComputedStyle(At).overflowY;if((kr==="auto"||kr==="scroll")&&At.scrollHeight>At.clientHeight)return At;At=At.parentElement;}let za=document.scrollingElement;return za&&za.scrollHeight>za.clientHeight?za:null})(D.currentTarget),ta=Vt=>{let At=me,za=false;Fe.forEach((kr,fr)=>{let er=kr.getBoundingClientRect();Vt>=er.top&&Vt<=er.bottom&&(At=fr,za=true);});let hr=Fe[Fe.length-1];if(!za&&hr){let kr=hr.getBoundingClientRect();Vt>kr.bottom&&(At=Fe.length-1);}return At<me&&(At=me),At},St=D.clientY,Et=null,Ta=()=>{Et!==null&&(cancelAnimationFrame(Et),Et=null);},Ea=()=>{let Vt=ta(St),At=new Set(Ke(Vt));Ut(za=>za&&{...za,targetIndex:Vt,rangeIds:At});},Ya=()=>{if(Ta(),!yt)return;let Vt=yt,za=Vt===document.scrollingElement?{top:0,bottom:window.innerHeight}:Vt.getBoundingClientRect(),hr=60,kr=12,fr=St-za.top,er=za.bottom-St,No=Vt.scrollHeight-Vt.clientHeight;if(er<hr&&Vt.scrollTop<No){let bs=Math.max(1,Math.round(kr*(1-Math.max(0,er)/hr))),ln=()=>{Vt.scrollTop+=bs,Ea(),Vt.scrollTop<Vt.scrollHeight-Vt.clientHeight&&(Et=requestAnimationFrame(ln));};Et=requestAnimationFrame(ln);}else if(fr<hr&&Vt.scrollTop>0){let bs=Math.max(1,Math.round(kr*(1-Math.max(0,fr)/hr))),ln=()=>{Vt.scrollTop-=bs,Ea(),Vt.scrollTop>0&&(Et=requestAnimationFrame(ln));};Et=requestAnimationFrame(ln);}},aa=Vt=>{St=Vt.clientY,Ea(),Ya();},pa=Vt=>{window.removeEventListener("mousemove",aa),window.removeEventListener("mouseup",pa),Ta(),document.body.style.cursor="",document.body.style.userSelect="",Ut(null);let At=ta(Vt.clientY),za=new Map(Wt.current.map(er=>[er.id,er])),hr=za.get(oe);if(!hr)return;let kr=W(hr,ye),fr=[];for(let er of Ke(At)){if(er===oe)continue;let No=za.get(er);No&&(No.subtasks&&No.subtasks.length>0||fr.push(er));}fr.length>0&&a.onBulkFill?.(fr,ye,kr);};window.addEventListener("mousemove",aa),window.addEventListener("mouseup",pa);},st=D=>Pt?Pt.rangeIds.has(D):false;useEffect(()=>{if(O)return document.addEventListener("mousemove",ca),document.addEventListener("mouseup",xa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",ca),document.removeEventListener("mouseup",xa),document.body.style.cursor="",document.body.style.userSelect="";}},[O,ca,xa]);let[Kt,re]=useState("all"),[ve,Nt]=useState(false),ft=useRef(null),ut=useRef(null),it=useMemo(()=>{let D=0;function oe(ye,Se){for(let Fe of ye)Se>D&&(D=Se),Fe.subtasks?.length&&oe(Fe.subtasks,Se+1);}return oe(e,1),D},[e]);useEffect(()=>{if(!ve)return;let D=oe=>{ft.current?.contains(oe.target)||ut.current?.contains(oe.target)||Nt(false);};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[ve]),useEffect(()=>{if(Kt==="all"){let ye=function(Se){for(let Fe of Se)Fe.subtasks?.length&&(Fe.isExpanded===false&&a.onTaskToggleExpand?.(Fe.id),ye(Fe.subtasks));};ye(e);}else {let ye=function(Se,Fe){for(let qe of Se)if(qe.subtasks?.length){let me=Fe<Kt,Ke=qe.isExpanded!==false;me!==Ke&&a.onTaskToggleExpand?.(qe.id),ye(qe.subtasks,Fe+1);}};ye(e,1);}},[Kt]);let[q,le]=useState(null),[ge,H]=useState(0),[fe,_e]=useState(0),C=useRef(null),[$,pe]=useState(null),[K,Ze]=useState(null);useEffect(()=>{h&&Lt(D=>{if(D.length===h.length){let oe=true;for(let ye=0;ye<D.length;ye++){let Se=D[ye],Fe=h[ye];if(!Se||!Fe||Se.id!==Fe.id||Se.visible!==Fe.visible||Se.width!==Fe.width||Se.label!==Fe.label){oe=false;break}}if(oe)return D}return h});},[h]),useEffect(()=>{if(!(!T||typeof window>"u"))try{localStorage.setItem(T,JSON.stringify({statusFilter:Ct,hideCompleted:Je}));}catch(D){console.error("Error persisting filter state:",D);}},[T,Ct,Je]);let wt=useMemo(()=>{let D=new Set;function oe(ye){for(let Se of ye)Se.subtasks?.length&&(Se.isExpanded!==false&&D.add(Se.id),oe(Se.subtasks));}return oe(e),D},[e]),kt=useMemo(()=>lt.filter(D=>D.visible),[lt]),Zt=useCallback(D=>{a.onTaskToggleExpand?.(D);},[a]),ea=useCallback(D=>{Ve===D?Ge(oe=>oe==="asc"?"desc":"asc"):(ot(D),Ge("asc")),a.onSortChange?.({column:D,direction:he==="asc"?"desc":"asc"});},[Ve,he,a]),qt=useCallback(D=>{Lt(D),a.onColumnsChange?.(D);},[a]),cr=useCallback(D=>{let oe=lt.map(ye=>ye.id===D?{...ye,visible:false}:ye);qt(oe);},[lt,qt]),Ca=useCallback((D,oe)=>{ot(D),Ge(oe);},[]),Fr=useCallback((D,oe,ye)=>{N&&(D.preventDefault(),Z({isOpen:true,x:D.clientX,y:D.clientY,type:oe?"task":"header",task:oe,columnId:ye}));},[N]),An=useCallback(()=>{Z(D=>({...D,isOpen:false}));},[]),To=useCallback((D,oe)=>{if(!w)return;D.preventDefault(),D.stopPropagation();let ye=lt.find(Se=>Se.id===oe);ye&&(le(oe),H(D.clientX),_e(ye.width));},[lt,w]);useEffect(()=>{if(!q)return;let D=lt,oe=Se=>{let Fe=Se.clientX-ge,qe=Math.max(50,fe+Fe);D=D.map(me=>me.id===q?{...me,width:qe}:me),Lt(D);},ye=()=>{a.onColumnsChange?.(D),le(null);};return document.addEventListener("mousemove",oe),document.addEventListener("mouseup",ye),()=>{document.removeEventListener("mousemove",oe),document.removeEventListener("mouseup",ye);}},[q,ge,fe,a]);let Ro=useCallback((D,oe)=>{if(oe==="name"){D.preventDefault();return}pe(oe),D.dataTransfer.effectAllowed="move",D.dataTransfer.setData("text/plain",oe),D.currentTarget instanceof HTMLElement&&(D.currentTarget.style.opacity="0.5");},[]),Ln=useCallback(D=>{D.currentTarget instanceof HTMLElement&&(D.currentTarget.style.opacity="1"),pe(null),Ze(null);},[]),ii=useCallback((D,oe)=>{D.preventDefault(),oe!=="name"&&(D.dataTransfer.dropEffect="move",Ze(oe));},[]),Za=useCallback(()=>{Ze(null);},[]),fs=useCallback((D,oe)=>{if(D.preventDefault(),!$||$===oe||oe==="name")return;let ye=[...lt],Se=ye.findIndex(me=>me.id===$),Fe=ye.findIndex(me=>me.id===oe);if(Se===-1||Fe===-1)return;let qe=ye.splice(Se,1);qe[0]&&(ye.splice(Fe,0,qe[0]),qt(ye),pe(null),Ze(null));},[$,lt,qt]),Vr=useCallback(async D=>{if(a.onCreateCustomField){let oe={...D,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(oe);}se(false);},[a]),Gr=useCallback(D=>D.progress===100||D.status==="completed"?"completed":D.progress&&D.progress>0||D.status==="in-progress"?"in-progress":"todo",[]),Or=useMemo(()=>{let D=w0(e);if(je.trim()){let oe=je.toLowerCase();D=D.filter(ye=>ye.name.toLowerCase().includes(oe));}if(Ct!=="all"){let oe=new Set(D.filter(ye=>Gr(ye)===Ct).flatMap(ye=>ye.parentPath));D=D.filter(ye=>oe.has(ye.id));}if(Je){let oe=new Set(D.filter(ye=>Gr(ye)!=="completed").flatMap(ye=>ye.parentPath));D=D.filter(ye=>oe.has(ye.id));}return D.sort((oe,ye)=>{let Se,Fe;switch(Ve){case "name":Se=oe.name.toLowerCase(),Fe=ye.name.toLowerCase();break;case "startDate":Se=oe.startDate?.getTime()||0,Fe=ye.startDate?.getTime()||0;break;case "endDate":Se=oe.endDate?.getTime()||0,Fe=ye.endDate?.getTime()||0;break;case "progress":Se=oe.progress||0,Fe=ye.progress||0;break;case "status":Se=oe.status||"todo",Fe=ye.status||"todo";break;case "priority":let qe={urgent:0,high:1,medium:2,low:3,none:4};Se=qe[oe.priority]??4,Fe=qe[ye.priority]??4;break;case "position":return 0;default:return 0}return Se<Fe?he==="asc"?-1:1:Se>Fe?he==="asc"?1:-1:0}),D},[e,je,Ct,Je,Ve,he,Gr]);Wt.current=Or;let In=useCallback((D,oe)=>{let ye=qe=>{a.onTaskUpdate?.({...D,...qe});},Se=qe=>qe?D.customFields?.find(Ke=>Ke.fieldId===qe)?.value:void 0,Fe=(qe,me)=>{if(!qe)return;let Be=[...D.customFields||[]],yt=Be.findIndex(ta=>ta.fieldId===qe);yt>=0?Be[yt]={fieldId:qe,value:me}:Be.push({fieldId:qe,value:me}),ye({customFields:Be});};switch(oe.type){case "name":return null;case "status":return jsx(lg,{value:D.status||(D.progress===100?"completed":D.progress&&D.progress>0?"in-progress":"todo"),onChange:me=>{ye({status:me,progress:me==="completed"?100:me==="in-progress"?50:0});},isDark:V,locale:f,translations:Y.status});case "priority":return jsx(cg,{value:D.priority,onChange:me=>ye({priority:me}),isDark:V,locale:f});case "assignees":{let me=D.hasChildren,Ke=D.assignees||[];if(me&&D.subtasks?.length){let Be=new Map,yt=ta=>{(ta||[]).forEach(St=>{(St.assignees||[]).forEach(Et=>{Be.has(Et.name)||Be.set(Et.name,Et);}),St.subtasks?.length&&yt(St.subtasks);});};yt(D.subtasks),Ke=Array.from(Be.values());}else me&&(Ke=[]);return jsx(pc,{value:Ke,availableUsers:l,onChange:Be=>ye({assignees:Be}),isDark:V,locale:f,disabled:me})}case "startDate":return jsx(dl,{value:D.startDate,onChange:me=>ye({startDate:me}),isDark:V,locale:f,dateField:"start",startDate:D.startDate,endDate:D.endDate});case "endDate":return jsx(dl,{value:D.endDate,onChange:me=>ye({endDate:me}),isDark:V,locale:f,dateField:"end",startDate:D.startDate,endDate:D.endDate});case "progress":{let me=!!(D.subtasks&&D.subtasks.length>0),Ke=me?x0(Mc(D.subtasks||[])):D.progress||0;return jsx(xg,{value:Ke,onChange:me?void 0:Be=>{let yt=Be===100?"completed":Be>0?"in-progress":"todo";ye({progress:Be,status:yt});},isDark:V,disabled:me})}case "tags":return jsx(Fg,{value:D.tags||[],isDark:V});case "text":return jsx(kg,{value:Se(oe.customFieldId)||"",onChange:me=>Fe(oe.customFieldId,me),isDark:V});case "number":return jsx(Ng,{value:Se(oe.customFieldId)||0,onChange:me=>Fe(oe.customFieldId,me),isDark:V});case "date":let qe=Se(oe.customFieldId);return jsx(dl,{value:qe?new Date(qe):void 0,onChange:me=>Fe(oe.customFieldId,me),isDark:V,locale:f});case "dropdown":return jsx(Dg,{value:Se(oe.customFieldId)||"",options:oe.options||[],onChange:me=>Fe(oe.customFieldId,me),isDark:V});case "checkbox":return jsx(Eg,{value:Se(oe.customFieldId)||false,onChange:me=>Fe(oe.customFieldId,me),isDark:V});case "estimatedTime":{let me=D.status==="completed"||D.progress===100;return jsx(Rr,{value:D.estimatedTime,onChange:Ke=>ye({estimatedTime:Ke}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:R(D)})}case "quotedTime":{let me=D.status==="completed"||D.progress===100,Ke=E?.enabled&&(!E.columns||E.columns.includes("quotedTime"));return jsx(Rr,{value:D.quotedTime,onChange:Be=>ye({quotedTime:Be}),isDark:V,locale:f,disabled:me,isBlurred:Ke,lens:k,hourlyRate:R(D)})}case "elapsedTime":{let me=D.status==="completed"||D.progress===100,Ke=D.executedDollarsCanonical;return jsx(Rr,{value:D.elapsedTime,onChange:Be=>ye({elapsedTime:Be}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:R(D),financialOverride:Ke})}case "effortMinutes":{if(ae&&D.subtasks&&D.subtasks.length>0){let{allocated:ta}=ps(D);if(k==="financial"){let St=J(D),Et=Math.round(St.dollarAllocated),Ta=Math.round(St.dollarQuoted),Ea=Ta-Et;return jsxs("div",{className:"flex flex-col",children:[Et>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",Et.toLocaleString("es-CO")]}):null,Ea!==0&&Et>0&&Ta>0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ea>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Ea>0?"+":"",Math.abs(Ea)>=1e3?`$${(Ea/1e3).toFixed(1)}K`:`$${Ea}`]})]})}return jsx(Rr,{value:ta>0?ta:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:j})}let me=D.status==="completed"||D.progress===100,Ke=D.effortMinutes||0,Be=D.soldEffortMinutes||0,yt=R(D);if(k==="financial"&&yt&&Ke>0&&Be>0){let ta=Math.round(Ke/60*yt),Et=Math.round(Be/60*yt)-ta;return jsxs("div",{className:"flex flex-col",children:[jsx(Rr,{value:Ke,onChange:Ta=>ye({effortMinutes:Ta}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:R(D)}),Et!==0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Et>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Et>0?"+":"",Math.abs(Et)>=1e3?`$${(Et/1e3).toFixed(1)}K`:`$${Et}`]})]})}return jsx(Rr,{value:Ke,onChange:ta=>ye({effortMinutes:ta}),isDark:V,locale:f,disabled:me,lens:k,hourlyRate:R(D)})}case "timeLoggedMinutes":{let me=D.executedDollarsCanonical;if(ae&&D.subtasks&&D.subtasks.length>0){let{spent:Be}=ps(D);return jsx(Rr,{value:Be>0?Be:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:R(D),financialOverride:me})}let Ke=D.status==="completed"||D.progress===100;return jsx(Rr,{value:D.timeLoggedMinutes,onChange:a.onLogTime?Be=>{a.onLogTime?.(D,Be);}:void 0,isDark:V,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Ke,lens:k,hourlyRate:R(D),financialOverride:me})}case "soldEffortMinutes":{if(ae&&D.subtasks&&D.subtasks.length>0){let{quoted:Be}=ps(D),yt=E?.enabled&&(!E.columns||E.columns.includes("soldEffortMinutes"));return jsx(Rr,{value:Be>0?Be:void 0,isDark:V,locale:f,disabled:true,isBlurred:yt,lens:k,hourlyRate:R(D)})}let me=D.status==="completed"||D.progress===100,Ke=E?.enabled&&(!E.columns||E.columns.includes("soldEffortMinutes"));return jsx(Rr,{value:D.soldEffortMinutes,onChange:Be=>ye({soldEffortMinutes:Be}),isDark:V,locale:f,disabled:me,isBlurred:Ke,lens:k,hourlyRate:R(D)})}case "scheduleVariance":{let me=D.effortMinutes||0,Ke=D.soldEffortMinutes||0,Be=D.timeLoggedMinutes||0,yt=me>0||Ke>0||Be>0;return jsx(Bg,{startDate:D.startDate,endDate:D.endDate,scheduleVariance:D.scheduleVariance,isDark:V,locale:f,hasTimeAllocated:yt})}case "hoursBar":{if(ae&&D.hasChildren){let{spent:me,allocated:Ke,quoted:Be}=ps(D),yt=me>Ke&&Ke>0;return jsxs("span",{className:c("text-[11px] font-mono flex items-center gap-1.5",V?"text-white/50":"text-gray-500"),children:[jsx("span",{className:c("font-bold",yt?"text-[#FF453A]":V?"text-white/80":"text-gray-800"),children:us(me)}),Ke>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:V?"text-white/60":"text-gray-600",children:us(Ke)})]}),Be>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:V?"text-amber-400/70":"text-amber-600",children:us(Be)})]})]})}return jsx(Og,{task:D,isDark:V,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:k,hourlyRate:R(D)})}case "teamLoad":return D.hasChildren||D.subtasks&&D.subtasks.length>0?jsx(Hg,{task:D,isDark:V,locale:f}):jsx(pc,{value:D.assignees||[],availableUsers:l,onChange:Ke=>{a.onTaskUpdate?.({...D,assignees:Ke});},isDark:V,locale:f});case "blockers":return jsx(Ug,{blockers:D.blockers,isDark:V,locale:f});case "weight":{let me=z.get(D.id);if(me!==void 0)return jsx("span",{className:c("text-xs font-mono",me>0?V?"text-white/50":"text-gray-400":V?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?`${Number(me.toFixed(2))}%`:"\u2014"});let Ke=D.weight||0;return jsx(Cw,{value:Ke,onChange:Be=>ye({weight:Be}),isDark:V})}default:return jsx("span",{className:c("text-sm",V?"text-white/60":"text-gray-500"),children:"-"})}},[a,V,f,l,Y,ae,z]),Oo=useCallback(D=>{let ye={name:Y.columns.name,status:Y.columns.status,priority:Y.columns.priority,assignees:Y.columns.assignees,startDate:Y.columns.startDate,endDate:Y.columns.endDate,progress:Y.columns.progress,tags:Y.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:Y.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:Y.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:Y.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:Y.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:Y.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:Y.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:Y.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:Y.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:Y.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:Y.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:Y.columns.weight||(f==="es"?"Peso":"Weight")}[D.type]||D.label;return typeof ye=="string"?ye:String(ye||D.type)},[Y,f]),sn=useMemo(()=>{let ye=kt.reduce((Fe,qe)=>Fe+qe.width,0)+(v?48:0),Se={};for(let Fe of kt)Se[Fe.id]=`${Fe.width/ye*100}%`;return Se},[kt,v]);return r?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,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-[#00E5CC]"}),jsxs("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:[Y.empty.noTasks,"..."]})]})}):n?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center",children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:c("text-lg font-semibold mb-2",V?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:c("flex-1 flex items-center justify-center",V?"bg-[#0D0D0D]":"bg-white",s),style:o,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:"w-16 h-16 mx-auto mb-4 rounded-2xl bg-[#00E5CC]/10 flex items-center justify-center",children:jsx(List,{className:"w-8 h-8 text-[#00E5CC]"})}),jsx("h3",{className:c("text-lg font-semibold mb-2",V?"text-white":"text-gray-900"),children:Y.empty.noTasks}),jsx("p",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:Y.empty.addFirstTask})]})}):jsxs("div",{ref:C,className:c(V?"bg-[#0D0D0D]":"bg-white",q&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[jsx("div",{className:c("flex-shrink-0 px-6 py-4 border-b",V?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:c("text-sm",V?"text-white/60":"text-gray-600"),children:[Or.length," ",Y.pagination.tasks]}),y&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:c("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",V?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:je,onChange:D=>He(D.target.value),placeholder:Y.toolbar.searchPlaceholder,className:c("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",V?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30 font-mono":"bg-gray-100 border-gray-200 text-gray-900 placeholder:text-gray-400")})]}),jsx("div",{className:"flex-1"}),i&&jsx("div",{className:"flex items-center gap-2",children:i}),b&&it>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:ft,onClick:()=>Nt(!ve),className:c("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",V?ve?"bg-[#00E5CC]/10 border-[#00E5CC]/40 text-[#00E5CC]":"bg-white/[0.03] border-[#333] text-white/50 hover:text-white/70 hover:bg-white/[0.05]":ve?"bg-[#00E5CC]/15 border-[#00E5CC] text-[#00C4AE]":"bg-gray-100 border-gray-200 text-gray-500 hover:text-gray-700 hover:bg-gray-200"),style:{fontFamily:"'JetBrains Mono', monospace"},children:[jsx(Layers,{className:"w-3.5 h-3.5"}),Kt==="all"?f==="es"?"Todos":"All":`L${Kt}`]}),ve&&jsx("div",{ref:ut,className:c("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",V?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(it,5)},(D,oe)=>({value:oe+1,label:`L${oe+1}`}))].map(D=>jsxs("button",{onClick:()=>{re(D.value),Nt(false);},className:c("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",V?Kt===D.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Kt===D.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:D.label}),Kt===D.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(D.value)))})]}),jsx(u0,{value:Ct,hideCompleted:Je,onChange:Dt,onHideCompletedChange:ze,isDark:V,locale:f}),te?.enabled&&te.data&&!xe&&jsx("button",{onClick:()=>Re(true),className:c("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",V?"border-[#333] text-white/40 hover:text-white/70 hover:bg-white/[0.05]":"border-gray-200 text-gray-400 hover:text-gray-600 hover:bg-gray-100"),title:f==="es"?"Abrir panel de salud":"Open health panel",children:jsx(PanelRight,{className:"w-4 h-4"})}),t.toolbarEndContent,S&&F&&jsxs(motion.button,{onClick:F,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-[transform,box-shadow]",style:{background:"linear-gradient(135deg, #00E5CC 0%, #005FCC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 123, 255, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 123, 255, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-4 h-4"}),jsx("span",{children:Y.toolbar.newTask})]})]})}),jsxs("div",{style:{display:"flex",flex:"1 1 0%",overflow:"hidden",minHeight:0},children:[jsx("div",{style:{flex:"1 1 0%",overflow:"auto",minHeight:0},children:jsxs("div",{style:{width:"100%"},children:[jsxs("div",{className:c("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",V?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Mt&&jsx("div",{className:"w-5 flex-shrink-0"}),kt.map(D=>{let oe=D.id!=="name",ye=K===D.id&&$!==D.id;return jsxs("div",{className:c("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",V?"text-white/60":"text-gray-500",oe&&"cursor-grab",D.type!=="name"&&"justify-center",$===D.id&&"opacity-50",ye&&(V?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:sn[D.id],minWidth:D.minWidth},draggable:oe,onDragStart:oe?Se=>Ro(Se,D.id):void 0,onDragEnd:oe?Ln:void 0,onDragOver:oe?Se=>ii(Se,D.id):void 0,onDragLeave:oe?Za:void 0,onDrop:oe?Se=>fs(Se,D.id):void 0,onContextMenu:Se=>Fr(Se,void 0,D.id),children:[oe&&jsx(GripVertical,{className:c("w-3 h-3 flex-shrink-0 transition-opacity",V?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:Se=>{let Fe=Se.currentTarget.getBoundingClientRect();u(D.id,Fe);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Oo(D),m?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),Ve===D.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):D.sortable?jsxs("button",{draggable:false,onClick:()=>ea(D.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Oo(D),m?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:c("w-3 h-3",Ve===D.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Oo(D),m?.includes(D.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:p,display:"inline-block",flexShrink:0}})]}),w&&D.resizable&&jsx("div",{className:c("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",q===D.id&&"bg-[#00E5CC]"),onMouseDown:Se=>To(Se,D.id)})]},D.id)}),v&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:D=>{D.stopPropagation(),gt(oe=>!oe);},className:c("p-0.5 rounded transition-colors",V?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ke&&(V?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(o0,{isOpen:ke,onClose:()=>gt(false),columns:lt,customFields:d,onColumnsChange:qt,onCreateCustomField:()=>{gt(false),se(true);},isDark:V,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:Or.map((D,oe)=>{let ye=wt.has(D.id),Se=Math.min(oe*.01,.2),Fe=D.hasChildren&&D.level===0,qe=D.subtasks?.length||0;if(Fe){let{spent:St,allocated:Et,quoted:Ta}=ps(D),Ea=kw(D);return jsxs(motion.div,{"data-task-id":D.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Se},className:c("flex items-center border-y cursor-pointer transition-colors duration-500",V?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",De===D.id&&(V?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(D),children:[Mt&&jsx("div",{className:"w-5 flex-shrink-0"}),kt.map(Ya=>jsx("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",Ya.type!=="name"&&"justify-center"),style:{width:sn[Ya.id],minWidth:Ya.minWidth},children:Ya.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:aa=>{aa.stopPropagation(),Zt(D.id);},className:c("p-0.5 rounded flex-shrink-0 mt-0.5",V?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsx(ChevronDown,{className:c("w-4 h-4",V?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:c("w-4 h-4",V?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:aa=>{aa.stopPropagation(),Zt(D.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:ye?jsx(FolderOpen,{className:"w-4 h-4",style:{color:V?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:V?"#FFD60A":"#B45309"}})}),D.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:V?"#FFD60A":"#B45309"},children:D.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:c("text-[13px] font-bold uppercase tracking-wide",V?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:D.name}),jsxs("span",{className:c("text-[10px] font-mono",V?"text-white/30":"text-gray-500"),children:["(",qe," ",f==="es"?qe===1?"Tarea":"Tareas":qe===1?"Item":"Items",")"]}),Ea!==null&&jsxs("span",{className:c("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",Ea>=1?"text-[#32D74B] bg-[#32D74B]/10":Ea>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",Ea.toFixed(2)]})]})]}):Ya.type==="timeLoggedMinutes"?k==="financial"?(()=>{let aa=D.executedDollarsCanonical,pa=aa!=null?Math.round(aa):Math.round(J(D).dollarSpent);return pa>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",pa.toLocaleString("en-US")]}):null})():jsx(Rr,{value:St>0?St:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:R(D)}):Ya.type==="soldEffortMinutes"?k==="financial"?(()=>{let aa=J(D),pa=Math.round(aa.dollarQuoted);return pa>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",pa.toLocaleString("en-US")]}):null})():jsx(Rr,{value:Ta>0?Ta:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:R(D)}):Ya.type==="effortMinutes"?k==="financial"?(()=>{let aa=J(D),pa=Math.round(aa.dollarAllocated),Vt=Math.round(aa.dollarQuoted),At=Vt-pa;return jsxs("div",{className:"flex flex-col",children:[pa>0?jsxs("span",{className:c("text-sm font-mono",V?"text-white/60":"text-gray-500"),children:["$",pa.toLocaleString("es-CO")]}):null,At!==0&&pa>0&&Vt>0&&jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`]})]})})():jsx(Rr,{value:Et>0?Et:void 0,isDark:V,locale:f,disabled:true,lens:k,hourlyRate:R(D)}):In(D,Ya)},Ya.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},D.id)}let me=O===D.id,Ke=Ie===D.id,Be=Ke&&Pe==="above",yt=Ke&&Pe==="below",ta=Ke&&Pe==="child";return jsxs(motion.div,{"data-task-id":D.id,"data-listview-row":D.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:Se},className:c("flex items-center border-b transition-colors relative group",V?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",De===D.id&&(V?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:me?.4:1,backgroundColor:ta?V?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:ta?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(D),onDoubleClick:()=>a.onTaskDoubleClick?.(D),onContextMenu:St=>Fr(St,D),onMouseEnter:()=>mt(D.id),onMouseLeave:()=>mt(St=>St===D.id?null:St),children:[Be&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),yt&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Mt&&jsx("div",{className:"flex-shrink-0 flex items-center justify-center w-5 cursor-grab opacity-0 group-hover:opacity-40 hover:!opacity-80 transition-opacity",onMouseDown:St=>rt(D.id,St),style:{color:V?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),kt.map(St=>{let Et=!!(D.subtasks&&D.subtasks.length>0),Ta=_t(St.type),Ya=!!Ta&&!Et&&zt===D.id&&!Pt,aa=!!Pt&&!!Ta&&Pt.column===Ta&&st(D.id);return jsxs("div",{className:c("flex items-center px-4 py-3 min-h-[56px]",St.type!=="name"&&"justify-center"),style:{width:sn[St.id],minWidth:St.minWidth,position:"relative",backgroundColor:aa?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:aa?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:[St.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&D.level>0&&jsx("div",{style:{width:`${D.level*24}px`},className:"flex-shrink-0"}),b&&D.hasChildren&&jsx("button",{onClick:pa=>{pa.stopPropagation(),Zt(D.id);},className:c("p-0.5 rounded flex-shrink-0",V?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ye?jsx(ChevronDown,{className:c("w-4 h-4",V?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:c("w-4 h-4",V?"text-white/60":"text-gray-400")})}),b&&!D.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(D.wbsCode||D.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[D.wbsCode&&jsx("span",{className:c("text-[10px] font-mono",V?"text-[#00E5CC]":"text-[#00C4AE]"),children:D.wbsCode}),D.taskCode&&jsx("span",{className:c("text-[10px] font-mono",V?"text-white/40":"text-gray-400"),children:D.taskCode})]}),jsx("span",{className:c("truncate",D.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",D.progress===100?V?"line-through text-white/50":"line-through text-gray-400":D.hasChildren?V?"text-white":"text-gray-900":V?"text-[#D1D5DB]":"text-gray-600"),children:D.name}),D.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${D.tags[0].color}20`,color:D.tags[0].color},children:D.tags[0].name})]})]}):In(D,St),Ya&&Ta&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:pa=>ie(pa,D.id,Ta,oe),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]},St.id)}),v&&jsx("div",{className:"w-12 flex-shrink-0"})]},D.id)})}),L&&Or.length>0&&(()=>{let{spent:D,allocated:oe,quoted:ye}=$e,Se=oe-D,Fe=Se<0,qe=Fe?`+${us(Math.abs(Se))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${us(Se)} ${f==="es"?"AHORRADO":"SAVED"}`,me=k==="financial"&&j>0,Ke=X?.breakdown,Be=!!Ke&&((Ke.equipment??0)>0||(Ke.travel??0)>0),yt=Ke?.laborSpent!=null?Ke.laborSpent:X?.spent!=null?X.spent:$e.dollarSpent,ta=Ke?.laborAllocated!=null?Ke.laborAllocated:X?.allocated!=null?X.allocated:$e.dollarAllocated,St=X?.quoted!=null?X.quoted:$e.dollarQuoted,Et=(aa,pa)=>{if(me){let Vt=pa??aa/60*j;return `$${Math.round(Vt).toLocaleString("es-CO")}`}return us(aa)},Ta=me?Math.abs(ta-yt):0,Ea=me?`+$${Ta.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Fe?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:qe,Ya=me&&Be?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:c("flex items-center sticky bottom-0 z-[5]",V?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:V?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Mt&&jsx("div",{className:"w-5 flex-shrink-0"}),kt.map(aa=>jsx("div",{className:c("flex items-center px-4 py-3",aa.type!=="name"&&"justify-center"),style:{width:sn[aa.id],minWidth:aa.minWidth},children:aa.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:c("text-[11px] font-black uppercase tracking-widest",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Ya&&jsxs("span",{className:c("text-[9px] font-mono mt-0.5 flex items-center gap-1",V?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Ya]})]}):aa.type==="hoursBar"?jsxs("div",{className:"flex flex-col items-center w-full",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Et(D,me?yt:void 0)}),jsx("span",{className:c("text-[11px]",V?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:c("text-[11px]",V?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Et(oe,me?ta:void 0)})]}),oe>0&&jsx("span",{className:c("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Fe?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:me?Ea:qe})]}):aa.type==="soldEffortMinutes"?jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ye>0?Et(ye,me?St:void 0):"\u2013"}):aa.type==="effortMinutes"?(()=>{if(me&&ye>0&&oe>0){let pa=Math.round(St),Vt=Math.round(ta),At=pa-Vt,za=pa>0?Math.round(At/pa*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Et(oe,ta)}),jsxs("span",{className:c("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>=0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",za,"%)"]})]})]})}return jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:oe>0?Et(oe,me?ta:void 0):"\u2013"})})():aa.type==="timeLoggedMinutes"?jsx("span",{className:c("text-[12px] font-bold",V?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:D>0?Et(D,me?yt:void 0):"\u2013"}):aa.type==="progress"?(()=>{let pa=x0(Mc(e||[]));return jsxs("span",{className:c("text-[12px] font-bold font-mono",V?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[pa,"%"]})})():aa.type==="weight"?(()=>{let pa=e||[],Vt=[],At=fr=>{for(let er of fr)Vt.push(er),er.subtasks?.length&&At(er.subtasks);};At(pa);let hr=Vt.filter(fr=>!fr.subtasks?.length||fr.subtasks.length===0).reduce((fr,er)=>fr+(er.weight||0),0),kr=Math.abs(hr-100)<.1;return jsxs("span",{className:c("text-[12px] font-bold font-mono",kr?V?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(hr.toFixed(1)),"%"]})})():jsx("span",{className:c("text-[11px]",V?"text-white/30":"text-gray-300"),children:"\u2013"})},aa.id)),v&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),Or.length===0&&je&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:c("w-12 h-12 mx-auto mb-4",V?"text-white/30":"text-gray-400")}),jsx("p",{className:c(V?"text-white/60":"text-gray-600"),children:Y.empty.noResults})]})})]})}),te?.enabled&&te.data&&xe&&jsx(m0,{data:te.data,isDark:V,locale:f,onClose:()=>Re(false),lens:t?.lens,onUnassignedTaskClick:D=>{let oe=document.querySelector(`[data-task-id="${D}"]`);oe&&(oe.scrollIntoView({behavior:"smooth",block:"center"}),Ee(D),setTimeout(()=>Ee(null),2e3));}})]}),jsx(qg,{state:B,onClose:An,isDark:V,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:cr,onColumnSort:Ca,availableUsers:l,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),Ue&&at&&O&&createPortal(jsx("div",{style:{position:"fixed",left:at.x+12,top:at.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let oe=Ae.flattenTasks(e).find(ye=>ye.id===O);return oe?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:V?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${V?"rgba(255,255,255,0.1)":"#e5e7eb"}`,backdropFilter:"blur(8px)",boxShadow:"0 4px 12px rgba(0,0,0,0.3)"},children:[jsx(GripVertical,{className:"w-3 h-3",style:{color:"#00E5CC"}}),jsx("span",{className:"text-xs font-medium",style:{color:V?"#e6edf3":"#111827"},children:oe.name})]}):null})()}),document.body),jsx(i0,{isOpen:A,onClose:()=>se(false),onSave:Vr,isDark:V,locale:f})]})}var C0=[{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:"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:"soldEffortMinutes",type:"soldEffortMinutes",label:"Quoted",width:100,visible:false,sortable:true,resizable:true},{id:"effortMinutes",type:"effortMinutes",label:"Estimated",width:100,visible:false,sortable:true,resizable:true},{id:"timeLoggedMinutes",type:"timeLoggedMinutes",label:"Executed",width:100,visible:false,sortable:true,resizable:true},{id:"scheduleVariance",type:"scheduleVariance",label:"Sched / Var",width:180,visible:false,sortable:true,resizable:true},{id:"hoursBar",type:"hoursBar",label:"Hours",width:200,visible:false,sortable:true,resizable:true},{id:"teamLoad",type:"teamLoad",label:"Team Load",width:160,visible:false,sortable:true,resizable:true},{id:"blockers",type:"blockers",label:"Blockers",width:150,visible:false,sortable:false,resizable:true},{id:"weight",type:"weight",label:"Weight",width:80,visible:false,sortable:true,resizable:true}],T0=[{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"},{type:"scheduleVariance",labelKey:"columns.scheduleVariance",icon:"CalendarClock"},{type:"hoursBar",labelKey:"columns.hoursBar",icon:"BarChart3"},{type:"teamLoad",labelKey:"columns.teamLoad",icon:"Users"},{type:"blockers",labelKey:"columns.blockers",icon:"AlertTriangle"},{type:"weight",labelKey:"columns.weight",icon:"Scale"}],N0=[{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 Pc={bgPrimary:"#0D0D0D",bgSecondary:"#141414",bgHover:"rgba(255,255,255,0.05)",bgSelected:"#0D131E",bgAlternate:"#141414",border:"#222222",borderLight:"#1A1A1A",textPrimary:"rgba(255,255,255,0.9)",textSecondary:"rgba(255,255,255,0.6)",textMuted:"rgba(255,255,255,0.3)",accent:"#00E5CC",accentHover:"#2979FF",accentLight:"rgba(0,123,255,0.15)",statusTodo:"rgba(255,255,255,0.4)",statusInProgress:"#00E5CC",statusCompleted:"#34D399",focusRing:"#00E5CC",checkboxBg:"#1A1A1A",checkboxChecked:"#00E5CC",bgGroupHeader:"#222222",headerBg:"#1A1A1A",neonRed:"#FF2D20",neonGreen:"#3BF06E",neonAmber:"#FFD60A",neonBlue:"#3B9EFF"},Fc={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",bgGroupHeader:"#F3F4F6",headerBg:"#F9FAFB",neonRed:"#DC2626",neonGreen:"#16A34A",neonAmber:"#D97706",neonBlue:"#00E5CC"},Ac={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",bgGroupHeader:"#1f3460",headerBg:"#16213e",neonRed:"#EF4444",neonGreen:"#34D399",neonAmber:"#FBBF24",neonBlue:"#6366F1"},hl={dark:Pc,light:Fc,neutral:Ac};function D0(e){return hl[e]||hl.dark}var Lc={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",backlogTitle:"BACKLOG / UNSCHEDULED",systemStatus:"SYSTEM STATUS",budgetUtil:"Budget Util.",variance:"VARIANCE",cost:"COST",estimate:"Est",sold:"Sold",cashOut:"Cash Out",typeToAdd:"Type to add (e.g., Crane Inspection)",critical:"CRITICAL",blocker:"Blocker",risk:"Risk",delay:"delay",days:"Days"},tooltips:{progress:"Progress",status:"Status",assignees:"Assignees",duration:"Duration",days:"days"}},Ic={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",backlogTitle:"BACKLOG / SIN FECHA",systemStatus:"ESTADO DEL SISTEMA",budgetUtil:"Util. Presupuesto",variance:"VARIANZA",cost:"COSTO",estimate:"Est",sold:"Vendido",cashOut:"Desembolso",typeToAdd:"Escribe para agregar (ej: Inspecci\xF3n)",critical:"CR\xCDTICO",blocker:"Bloqueador",risk:"Riesgo",delay:"retraso",days:"D\xEDas"},tooltips:{progress:"Progreso",status:"Estado",assignees:"Asignados",duration:"Duraci\xF3n",days:"d\xEDas"}},yl={en:Lc,es:Ic};function Xs(e){return yl[e]||yl.en}function xl(e,t){let a=Xs(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 S0(e){let t=Xs(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 E0(e,t=0,a=true){let r=Xs(e),n=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 [...n.slice(t),...n.slice(0,t)]}function Qs(e){let t=[];function a(r){for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);}return a(e),t}function Rc(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()),n=new Date(t.endDate.getFullYear(),t.endDate.getMonth(),t.endDate.getDate());return a>=r&&a<=n}function F0({task:e,isDark:t}){return e.progress===100||e.status==="completed"?jsx(CheckCircle2,{className:"w-3 h-3 text-emerald-400 flex-shrink-0"}):e.progress&&e.progress>0||e.status==="in-progress"?jsx(PlayCircle,{className:"w-3 h-3 text-[#007FFF] flex-shrink-0"}):jsx(Circle,{className:c("w-3 h-3 flex-shrink-0",t?"text-white/40":"text-gray-400")})}var I0=26,Fw=22,Aw=10;function A0(e,t){let a=Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate());return Math.round((a-r)/(1e3*60*60*24))}function Oc(e,t="hours",a=0){if(!e||e<=0)return null;if(t==="financial"&&a>0){let n=Math.round(e/60*a);return n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`}let r=Math.round(e/480);return r>0?`${r}d`:null}function B0(e,t="hours",a=0){if(e.soldEffortMinutes==null||e.effortMinutes==null)return null;let r=e.soldEffortMinutes-e.effortMinutes;if(r===0)return null;let n=r<0,s;if(t==="financial"&&a>0){let o=Math.round(Math.abs(r/60)*a);s=o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`;}else {let o=Math.round(Math.abs(r)/60);s=o>=1e3?`$${(o/1e3).toFixed(1)}k`:`$${o}`;}return {text:`${n?"-":"+"}${s}`,isNegative:n}}function L0(e,t="hours",a=0){if(t==="financial"&&a>0){let n=Math.round(Math.abs(e/60)*a);return n>=1e3?`$${(n/1e3).toFixed(1)}k`:`$${n}`}let r=Math.round(Math.abs(e)/60);return r>=1e3?`$${(r/1e3).toFixed(1)}k`:`$${r}`}function Lw({segment:e,isDark:t,onClick:a,blurFinancials:r,isSelected:n,t:s,lens:o="hours",hourlyRate:l=0}){let{task:d,spanCols:i,lane:u,isStart:m,isEnd:p}=e,g=d.progress===100||d.status==="completed",f=d.isCriticalPath,x=m&&p?"rounded":m?"rounded-l":p?"rounded-r":"",y=p?Oc(d.effortMinutes,o,l):null,b=p?B0(d,o,l):null,h=p?d.blockers?.find(v=>v.severity==="critical"):null;return jsxs(motion.button,{onClick:v=>{v.stopPropagation(),a();},whileHover:{scale:1.005},className:c("absolute flex items-center gap-1.5 px-2 text-xs cursor-pointer overflow-hidden",x,g?t?"text-emerald-400":"bg-emerald-500/10 text-emerald-600 border border-emerald-200":f?t?"text-white/90":"bg-red-50 border border-red-200 text-red-700 hover:border-red-300":t?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-[#00E5CC]"),style:{top:`${u*I0}px`,left:"1px",width:`calc(${i*100}% - 2px)`,height:`${Fw}px`,zIndex:10,...t?g?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:f?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:{},borderLeftWidth:m?"3px":void 0,borderLeftColor:m?f?"#EF4444":g?"#10B981":"#1264FF":void 0,...n?{boxShadow:t?"0 0 0 1.5px rgba(0, 229, 255, 0.7), 0 0 12px rgba(0, 229, 255, 0.3)":"0 0 0 1.5px rgba(0, 229, 204, 0.7), 0 0 12px rgba(0, 229, 204, 0.2)",zIndex:20}:{}},children:[f&&m&&jsxs("span",{className:"text-[9px] font-mono font-bold text-red-400 uppercase tracking-wider flex-shrink-0",children:[s.labels.critical,":"]}),jsx("span",{className:"truncate flex-1 text-left font-medium",children:d.name}),p&&(y||b)&&jsxs("span",{className:"flex items-center gap-1 flex-shrink-0 text-[9px] font-mono text-white/35 ml-1",children:[y&&jsxs("span",{children:[s.labels.estimate,": ",y]}),b&&jsxs(Fragment,{children:[jsx("span",{className:"text-white/15",children:"|"}),jsx("span",{className:c(b.isNegative?"text-red-400":"text-emerald-400",r&&"blur-sm select-none"),children:b.text})]})]}),h&&jsxs("span",{className:"flex-shrink-0 text-[8px] font-mono px-1.5 py-0.5 rounded bg-red-500/20 text-red-400 border border-red-500/30 ml-1",children:[s.labels.blocker,": ",h.type]}),d.progress>0&&d.progress<100&&jsx("div",{className:"absolute bottom-0 left-0 h-[2px] bg-[#1264FF]",style:{width:`${d.progress}%`}})]})}function R0({tasks:e,config:t={},callbacks:a={},initialDate:r,isLoading:n=false,error:s,className:o,style:l,availableTags:d=[],onCreateTag:i,attachmentsByTask:u,comments:m,onAddComment:p,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:x,onTaskOpen:y,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:v,timerState:w,onLogTime:N,onUpdateEstimate:S,onUpdateSoldEffort:F,onStartTimer:T,onStopTimer:E,onDiscardTimer:P,blurFinancials:k=false,suppressDetailModal:j=false,lens:U="hours",hourlyRate:ae=0}){let{theme:L="dark",locale:X$1="en",customTranslations:Y,showBacklog:V=true}=t,R=xl(X$1,Y),J=L==="dark"||L==="neutral",[Ne,$e]=useState(r||new Date),[z,te]=useState(null),[xe,Re]=useState(null),[De,Ee]=useState(null),[Ve,ot]=useState({}),he=3,Ge=3,je=useCallback(O=>{Re(O.id),j||te(O),y?.(O.id);},[j,y]),[He,Ct]=useState(null),Dt=useCallback(()=>{$e(new Date(Ne.getFullYear(),Ne.getMonth()-1,1));},[Ne]),Je=useCallback(()=>{$e(new Date(Ne.getFullYear(),Ne.getMonth()+1,1));},[Ne]),ze=useCallback(()=>{$e(new Date);},[]),lt=useMemo(()=>{let O=Ne.getFullYear(),ee=Ne.getMonth(),Ue=new Date(O,ee,1),Ce=new Date(O,ee+1,0),Ie=Ue.getDay(),Me=Ce.getDate(),Pe=Qs(e),nt=new Date;nt.setHours(0,0,0,0);let at=[],dt=Ie,pt=new Date(O,ee,0).getDate();for(let Mt=dt-1;Mt>=0;Mt--){let zt=new Date(O,ee-1,pt-Mt);at.push({date:zt,isCurrentMonth:false,isToday:false,isWeekend:zt.getDay()===0||zt.getDay()===6,events:Pe.filter(mt=>Rc(zt,mt)).map(mt=>({id:mt.id,title:mt.name,start:mt.startDate,end:mt.endDate,task:mt}))});}for(let Mt=1;Mt<=Me;Mt++){let zt=new Date(O,ee,Mt),mt=zt.getTime()===nt.getTime();at.push({date:zt,isCurrentMonth:true,isToday:mt,isWeekend:zt.getDay()===0||zt.getDay()===6,events:Pe.filter(Pt=>Rc(zt,Pt)).map(Pt=>({id:Pt.id,title:Pt.name,start:Pt.startDate,end:Pt.endDate,task:Pt}))});}let jt=42-at.length;for(let Mt=1;Mt<=jt;Mt++){let zt=new Date(O,ee+1,Mt);at.push({date:zt,isCurrentMonth:false,isToday:false,isWeekend:zt.getDay()===0||zt.getDay()===6,events:Pe.filter(mt=>Rc(zt,mt)).map(mt=>({id:mt.id,title:mt.name,start:mt.startDate,end:mt.endDate,task:mt}))});}return at},[Ne,e]),Lt=useMemo(()=>Qs(e).filter(O=>!O.startDate||!O.endDate),[e]),ke=useMemo(()=>{let O=Qs(e),ee=0,Ue=0,Ce=0,Ie=0,Me=0;O.forEach(pt=>{pt.effortMinutes&&(ee+=pt.effortMinutes),pt.soldEffortMinutes&&(Ue+=pt.soldEffortMinutes),pt.scheduleVariance!=null&&(Ce+=pt.scheduleVariance,Ie++),pt.soldEffortMinutes&&pt.effortMinutes&&(Me+=pt.soldEffortMinutes-pt.effortMinutes);});let Pe=Ue>0?Math.min(100,Math.round(ee/Ue*100)):0,nt=Ie>0?Math.round(Ce/Ie):0,dt=`${Me<0?"-":"+"}${L0(Me,U,ae)}`;return {budgetUtil:Pe,avgVariance:nt,costDisplay:dt,hasCostData:Ue>0}},[e,U,ae]),gt=useMemo(()=>{let O=[0,0,0,0,0,0];return lt.forEach((ee,Ue)=>{let Ce=Math.floor(Ue/7);ee.events.forEach(Ie=>{if(Ie.task.startDate&&Ie.task.soldEffortMinutes){let Me=new Date(Ie.task.startDate),Pe=ee.date;Me.getFullYear()===Pe.getFullYear()&&Me.getMonth()===Pe.getMonth()&&Me.getDate()===Pe.getDate()&&Ce<O.length&&(O[Ce]-=Ie.task.soldEffortMinutes);}});}),O},[lt]),A=useMemo(()=>{let O=Qs(e),ee=new Map,Ue=new Set,Ce=[0,0,0,0,0,0];if(lt.length===0)return {segmentsByCell:ee,multiDayTaskIds:Ue,maxLanesPerRow:Ce};let Ie=dt=>new Date(dt.getFullYear(),dt.getMonth(),dt.getDate()),Me=Ie(lt[0].date),Pe=Ie(lt[lt.length-1].date),nt=[];for(let dt of O){if(!dt.startDate||!dt.endDate)continue;let pt=Ie(dt.startDate),jt=Ie(dt.endDate);if(pt.getTime()===jt.getTime()||jt<Me||pt>Pe)continue;let Mt=pt<Me?Me:pt,zt=jt>Pe?Pe:jt,mt=A0(Mt,Me),Pt=A0(zt,Me);mt<0||mt>41||Pt<0||Pt>41||mt!==Pt&&(Ue.add(dt.id),nt.push({task:dt,startIdx:mt,endIdx:Pt}));}nt.sort((dt,pt)=>dt.startIdx!==pt.startIdx?dt.startIdx-pt.startIdx:pt.endIdx-pt.startIdx-(dt.endIdx-dt.startIdx));let at=[[],[],[],[],[],[]];for(let{task:dt,startIdx:pt,endIdx:jt}of nt){let Mt=Math.floor(pt/7),zt=Math.floor(jt/7),mt=Ie(dt.startDate),Pt=Ie(dt.endDate),Ut=false;for(let _t=Mt;_t<=zt;_t++){let Wt=_t===Mt?pt%7:0,rt=_t===zt?jt%7:6,ca=rt-Wt+1,xa=0,W=at[_t]??[];for(at[_t]||(at[_t]=W);xa<W.length&&(W[xa]??-1)>=Wt;)xa++;if(xa>=Aw){Ut=true;break}xa>=W.length?W.push(rt):W[xa]=rt,Ce[_t]=Math.max(Ce[_t]??0,xa+1);let ie=_t===Mt&&mt>=Me,st=_t===zt&&Pt<=Pe,Kt=_t*7+Wt,re={taskId:dt.id,task:dt,rowIndex:_t,startCol:Wt,endCol:rt,spanCols:ca,lane:xa,isStart:ie,isEnd:st};ee.has(Kt)||ee.set(Kt,[]),ee.get(Kt).push(re);}Ut&&(Ue.delete(dt.id),ee.forEach((_t,Wt)=>{let rt=_t.filter(ca=>ca.taskId!==dt.id);rt.length===0?ee.delete(Wt):ee.set(Wt,rt);}));}return {segmentsByCell:ee,multiDayTaskIds:Ue,maxLanesPerRow:Ce}},[lt,e]),se=X$1==="es"?["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"]:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],B=Ne.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{month:"long",year:"numeric"}),Z=B.charAt(0).toUpperCase()+B.slice(1);return n?jsx("div",{className:c("flex-1 flex items-center justify-center",J?"bg-[#050505]":"bg-white",o),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-[#007FFF]"}),jsxs("p",{className:c("text-sm font-mono",J?"text-white/30":"text-gray-600"),children:[R.labels.noEvents,"..."]})]})}):s?jsx("div",{className:c("flex-1 flex items-center justify-center",J?"bg-[#050505]":"bg-white",o),style:l,children:jsxs("div",{className:"flex flex-col items-center gap-4 max-w-md text-center",children:[jsx("div",{className:c("w-12 h-12 rounded-full flex items-center justify-center",J?"bg-red-500/10 border border-red-500/20":"bg-red-500/10"),children:jsx("span",{className:"text-red-500 text-2xl",children:"\u26A0"})}),jsxs("div",{children:[jsx("h3",{className:c("text-lg font-semibold mb-2",J?"text-white/90":"text-gray-900"),children:"Error"}),jsx("p",{className:c("text-sm",J?"text-white/40":"text-gray-600"),children:typeof s=="string"?s:s.message})]})]})}):e.length===0?jsx("div",{className:c("flex-1 flex items-center justify-center",J?"bg-[#050505]":"bg-white",o),style:l,children:jsxs("div",{className:"text-center max-w-md",children:[jsx("div",{className:c("w-16 h-16 mx-auto mb-4 rounded-2xl flex items-center justify-center",J?"bg-[#007FFF]/10 border border-[#007FFF]/20":"bg-[#00E5CC]/10"),children:jsx(Calendar,{className:c("w-8 h-8",J?"text-[#007FFF]":"text-[#00E5CC]")})}),jsx("h3",{className:c("text-lg font-semibold mb-2",J?"text-white/90":"text-gray-900"),children:R.labels.noEvents}),jsx("p",{className:c("text-sm",J?"text-white/30":"text-gray-600"),children:R.labels.newTask})]})}):jsxs("div",{className:c("flex-1 flex flex-col w-full h-full overflow-hidden",J?"bg-[#050505]":"bg-white",o),style:l,children:[jsxs("div",{className:"flex flex-1 overflow-hidden relative",children:[jsxs("div",{className:"flex-1 flex flex-col min-w-0 relative overflow-hidden",children:[jsxs("div",{className:c("flex-shrink-0 h-10 flex items-center justify-between px-4 z-20",J?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[jsxs("div",{className:c("flex items-center gap-1.5 pl-2.5 pr-2 py-1 rounded-md text-xs transition-all",J?"bg-[#111] border border-white/10":"bg-gray-100 border border-gray-200"),children:[jsx(Calendar,{className:c("w-3.5 h-3.5",J?"text-[#007FFF]":"text-[#00E5CC]")}),jsx("span",{className:c("font-medium",J?"text-white":"text-gray-900"),children:X$1==="es"?"Calendario":"Calendar"})]}),jsx("div",{className:c("h-4 w-px",J?"bg-white/10":"bg-gray-200")}),jsxs("div",{className:"flex items-center gap-1.5 select-none",children:[jsx("button",{onClick:Dt,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",J?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("span",{className:c("text-sm font-semibold tracking-tight min-w-[150px] text-center",J?"text-white":"text-gray-900"),children:Z}),jsx("button",{onClick:Je,className:c("w-6 h-6 flex items-center justify-center rounded transition-colors",J?"text-white/50 hover:text-white hover:bg-white/5":"text-gray-500 hover:text-gray-900 hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.toolbarRightContent&&jsxs(Fragment,{children:[t.toolbarRightContent,jsx("div",{className:c("h-4 w-px",J?"bg-white/10":"bg-gray-200")})]}),jsx("button",{onClick:ze,className:c("px-2.5 py-1 text-xs rounded-md transition-all font-medium",J?"bg-white/5 border border-white/10 text-white/70 hover:bg-white/10 hover:text-white":"bg-gray-100 border border-gray-200 text-gray-700 hover:bg-gray-200"),children:R.navigation.today})]})]}),jsx("div",{className:c("grid grid-cols-7 sticky top-0 z-10",J?"bg-[#050505] border-b border-[#222]":"bg-white border-b border-gray-200"),children:se.map(O=>jsx("div",{className:c("py-2 text-center text-[10px] font-bold uppercase tracking-widest",J?"text-white/60 font-mono":"text-gray-500"),children:O},O))}),jsx("div",{className:"flex-1 overflow-y-auto",children:jsx("div",{className:c("grid grid-cols-7 min-h-[800px]",J?"bg-[#050505]":"bg-white"),style:{gridAutoRows:"minmax(140px, auto)"},onClick:()=>Re(null),children:lt.map((O,ee)=>{let Ue=ee%7===6,Ce=ee>=35;return jsxs("div",{className:c("min-h-[140px] p-2 transition-colors flex flex-col relative group overflow-visible",!Ue&&(J?"border-r border-[#222]":"border-r border-gray-200"),!Ce&&(J?"border-b border-[#222]":"border-b border-gray-200"),J?O.isCurrentMonth?"bg-[#050505] hover:bg-white/[0.02]":"bg-[#080808] opacity-50":O.isCurrentMonth?"bg-white hover:bg-gray-50":"bg-gray-50 opacity-50",O.isToday&&J&&"ring-1 ring-[#007FFF]/40 ring-inset bg-[#007FFF]/[0.03]",O.isToday&&!J&&"ring-2 ring-[#00E5CC] ring-inset"),children:[jsx("span",{className:c("text-xs font-mono select-none relative z-20",O.isToday?J?"text-[#007FFF] font-bold":"text-[#00C4AE] font-bold":O.isCurrentMonth?J?"text-white/60":"text-gray-900":J?"text-white/20":"text-gray-400"),children:String(O.date.getDate()).padStart(2,"0")}),(()=>{let Ie=Math.floor(ee/7),Me=(A.maxLanesPerRow[Ie]??0)*I0,Pe=A.segmentsByCell.get(ee);return Me===0&&!Pe?null:jsx("div",{className:"relative -mx-2 overflow-visible",style:{minHeight:`${Me}px`,zIndex:5},children:Pe?.map(nt=>jsx(Lw,{segment:nt,isDark:J,blurFinancials:k,isSelected:xe===nt.taskId,t:R,lens:U,hourlyRate:ae,onClick:()=>{je(nt.task),a.onEventClick?.({id:nt.task.id,title:nt.task.name,start:nt.task.startDate,end:nt.task.endDate,task:nt.task});}},nt.taskId))})})(),(()=>{let Ie=O.events.filter(Me=>Me.task.isMilestone&&!A.multiDayTaskIds.has(Me.id));return Ie.length===0?null:jsxs("div",{className:"flex items-center gap-1 mt-0.5 px-0.5",children:[Ie.slice(0,4).map(Me=>jsx("div",{className:"w-2 h-2 rounded-full bg-red-500 flex-shrink-0 cursor-pointer",title:Me.title,onClick:Pe=>{Pe.stopPropagation(),je(Me.task);}},Me.id)),Ie.length>4&&jsxs("span",{className:c("text-[8px] font-mono",J?"text-white/30":"text-gray-400"),children:["+",Ie.length-4]})]})})(),(()=>{let Ie=[];O.events.forEach(Pe=>{Pe.task.blockers?.forEach(nt=>{(nt.severity==="warning"||nt.severity==="critical")&&Ie.push({taskId:Pe.id,type:nt.type,severity:nt.severity,variance:Pe.task.scheduleVariance});});});let Me=Ie[0];return Me?jsx("div",{className:"mt-0.5 px-0.5",children:jsxs("div",{className:c("text-[8px] font-mono px-1.5 py-0.5 rounded flex items-center gap-1",Me.severity==="critical"?"bg-red-500/15 text-red-400 border border-red-500/20":"bg-amber-500/15 text-amber-400 border border-amber-500/20"),children:[jsx("span",{children:"\u26A0"}),jsxs("span",{className:"truncate",children:[R.labels.risk,": ",Me.type,Me.variance?` (+${Math.abs(Me.variance)}d ${R.labels.delay})`:""]})]})}):null})(),(()=>{let Ie=O.events.filter(at=>!A.multiDayTaskIds.has(at.id)),Me=Ve[ee]||he,Pe=Ie.slice(0,Me),nt=Ie.length-Me;return jsxs("div",{className:"mt-1 space-y-0.5 flex-1",children:[Pe.map(at=>jsxs(motion.button,{onClick:()=>{je(at.task),a.onEventClick?.(at);},whileHover:{scale:1.01},className:c("w-full flex items-center gap-1.5 px-1.5 py-1 rounded text-[11px] transition-all text-left",at.task.progress===100||at.task.status==="completed"?J?"text-emerald-400":"bg-emerald-500/10 text-emerald-600":J?"text-white/90":"bg-gray-50 border border-gray-200 text-gray-700 hover:border-[#00E5CC]"),style:J?at.task.progress===100||at.task.status==="completed"?{background:"rgba(16, 185, 129, 0.28)",border:"1px solid rgba(16, 185, 129, 0.50)",boxShadow:"0 0 14px rgba(16, 185, 129, 0.2), inset 0 0 14px rgba(16, 185, 129, 0.1)"}:at.task.isCriticalPath?{background:"rgba(239, 68, 68, 0.35)",border:"1px solid rgba(239, 68, 68, 0.65)",boxShadow:"0 0 18px rgba(239, 68, 68, 0.3), inset 0 0 18px rgba(239, 68, 68, 0.15)"}:{background:"rgba(18, 100, 255, 0.38)",border:"1px solid rgba(18, 100, 255, 0.65)",boxShadow:"0 0 18px rgba(18, 100, 255, 0.28), inset 0 0 18px rgba(18, 100, 255, 0.14)"}:void 0,children:[jsx("span",{className:c("flex-shrink-0 text-[9px]",at.task.isMilestone?J?"text-amber-400":"text-amber-600":at.task.isCriticalPath?"text-red-400":J?"text-[#1264FF]":"text-gray-400"),children:at.task.isMilestone?"\u25C6":"\u25CF"}),jsx("span",{className:"truncate flex-1",children:at.title})]},at.id)),nt>0&&jsxs("button",{onClick:at=>{at.stopPropagation(),ot(dt=>({...dt,[ee]:Me+Ge}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",J?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:["+",nt," ",X$1==="es"?"m\xE1s":"more"]}),Me>he&&Ie.length>he&&jsx("button",{onClick:at=>{at.stopPropagation(),ot(dt=>({...dt,[ee]:he}));},className:c("text-[10px] px-1.5 py-0.5 cursor-pointer font-mono font-medium uppercase tracking-wide transition-all rounded",J?"text-white/25 hover:text-white/50 hover:bg-white/5":"text-gray-400 hover:text-gray-600"),children:X$1==="es"?"menos":"less"})]})})(),O.isCurrentMonth&&a.onTaskCreate&&jsx("div",{className:"flex items-center justify-end mt-1",children:(()=>{let Ie=ee>=28,Me=ee%7>=5;return jsxs("div",{className:"relative",children:[jsx("button",{onClick:Pe=>{Pe.stopPropagation(),Ct(He===ee?null:ee);},className:c("w-5 h-5 rounded flex items-center justify-center transition-all",He===ee?"opacity-100 bg-[#007FFF] text-white":"opacity-0 group-hover:opacity-100",J?"hover:bg-[#007FFF] text-white/30 hover:text-white":"hover:bg-[#00E5CC] text-gray-400 hover:text-white"),children:jsx(Plus,{className:c("w-3.5 h-3.5 transition-transform",He===ee&&"rotate-45")})}),jsx(AnimatePresence,{children:He===ee&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ct(null)}),jsx(motion.div,{initial:{opacity:0,y:Ie?-5:5,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:Ie?-5:5,scale:.95},transition:{duration:.12},className:c("absolute w-[320px] rounded-lg shadow-2xl z-50",Ie?"bottom-full mb-1":"top-full mt-1",Me?"right-0":"left-0",J?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(bn,{onSubmit:Pe=>{a.onTaskCreate?.({name:Pe.name,startDate:Pe.startDate||O.date,endDate:Pe.endDate||O.date,priority:Pe.priority,assignees:Pe.assignee?[Pe.assignee]:void 0}),Ct(null);},onCancel:()=>Ct(null),availableUsers:t.availableUsers,isDark:J,locale:X$1==="es"?"es":"en",defaultDate:O.date,dropdownDirection:Ie?"up":"down"})})]})})]})})()}),ee%7===6&&(()=>{let Ie=Math.floor(ee/7),Me=gt[Ie];if(!Me||Me===0)return null;let Pe=L0(Me,U,ae);return jsxs("div",{className:c("absolute bottom-1 right-2 text-[9px] font-mono font-bold tabular-nums z-20",Me<0?"text-red-400":"text-emerald-400",k&&"blur-sm select-none"),children:[R.labels.cashOut,": ",Me<0?"-":"+",Pe]})})()]},ee)})})})]}),V&&jsxs("aside",{className:c("w-[280px] flex-shrink-0 flex flex-col overflow-hidden",J?"bg-[#050505] border-l border-[#222]":"bg-white border-l border-gray-200"),children:[jsxs("div",{className:c("flex-shrink-0 h-14 flex items-center justify-between px-4",J?"bg-[#080808] border-b border-[#222]":"bg-gray-50 border-b border-gray-200"),children:[jsx("span",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",J?"text-white/40":"text-gray-500"),children:R.labels.backlogTitle}),jsx("div",{className:"flex items-center gap-2",children:jsx("span",{className:c("text-[10px] font-mono tabular-nums",J?"text-white/20":"text-gray-400"),children:Lt.length})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-2",children:Lt.length===0?jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[jsx("div",{className:c("w-10 h-10 rounded-xl flex items-center justify-center mb-3",J?"bg-white/5":"bg-gray-100"),children:jsx(Calendar,{className:c("w-5 h-5",J?"text-white/20":"text-gray-400")})}),jsx("p",{className:c("text-xs font-mono",J?"text-white/20":"text-gray-400"),children:X$1==="es"?"Sin tareas pendientes":"No unscheduled tasks"})]}):Lt.map(O=>jsxs("button",{onClick:()=>{je(O);},className:c("w-full text-left rounded-md p-3 transition-all group/card",J?"bg-[#0A0A0A] border border-white/[0.05] hover:border-white/[0.12] hover:bg-[#0E0E0E]":"bg-white border border-gray-100 hover:border-gray-200 hover:shadow-sm"),children:[jsxs("div",{className:"flex items-start gap-2 mb-2",children:[jsx("div",{className:c("w-1 h-1 rounded-full mt-1.5 flex-shrink-0",J?"bg-white/20":"bg-gray-300")}),jsx("span",{className:c("text-sm font-medium leading-snug line-clamp-2",J?"text-white/80 group-hover/card:text-white":"text-gray-800"),children:O.name})]}),O.tags&&O.tags.length>0&&jsxs("div",{className:"flex flex-wrap gap-1 ml-3",children:[O.tags.slice(0,3).map(ee=>jsx("span",{className:"text-[9px] font-mono uppercase tracking-wider px-1.5 py-0.5 rounded",style:{backgroundColor:`${ee.color}15`,color:ee.color,border:`1px solid ${ee.color}30`},children:ee.name},ee.id)),O.tags.length>3&&jsxs("span",{className:c("text-[9px] font-mono px-1 py-0.5",J?"text-white/20":"text-gray-400"),children:["+",O.tags.length-3]})]}),(O.effortMinutes||O.soldEffortMinutes)&&jsxs("div",{className:c("flex items-center gap-2 mt-1.5 ml-3 text-[9px] font-mono",J?"text-white/25":"text-gray-400",k&&"blur-sm select-none"),children:[Oc(O.effortMinutes,U,ae)&&jsxs("span",{children:[R.labels.estimate,": ",Oc(O.effortMinutes,U,ae)]}),(()=>{let ee=B0(O,U,ae);return ee?jsx("span",{className:ee.isNegative?"text-red-400":"text-emerald-400",children:ee.text}):null})()]}),jsxs("div",{className:"flex items-center justify-between mt-2 ml-3",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[O.priority&&jsx(Flag,{className:c("w-3 h-3",O.priority==="urgent"||O.priority==="high"?"text-red-400":O.priority==="medium"?"text-yellow-400":"text-green-400")}),jsx(F0,{task:O,isDark:J})]}),O.assignees&&O.assignees.length>0&&jsx("div",{className:"flex -space-x-1",children:O.assignees.slice(0,2).map((ee,Ue)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[8px] font-mono font-bold text-white ring-1 ring-[#050505]",style:{backgroundColor:ee.color||"#007FFF"},title:ee.name,children:ee.initials||ee.name?.slice(0,2).toUpperCase()},Ue))})]})]},O.id))}),a.onTaskCreate&&jsx("div",{className:c("flex-shrink-0 px-3 py-2.5 border-t",J?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:jsx("input",{type:"text",placeholder:R.labels.typeToAdd,className:c("w-full text-[11px] font-mono bg-transparent outline-none",J?"text-white/70 placeholder:text-white/15":"text-gray-700 placeholder:text-gray-400"),onKeyDown:O=>{O.key==="Enter"&&O.target.value.trim()&&(a.onTaskCreate?.({name:O.target.value.trim()}),O.target.value="");}})}),ke.hasCostData&&jsxs("div",{className:c("flex-shrink-0 px-4 py-3 border-t space-y-2.5",J?"border-[#222] bg-[#080808]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:c("text-[10px] font-mono font-bold uppercase tracking-[0.2em]",J?"text-white/40":"text-gray-500"),children:["\u25C8 ",R.labels.systemStatus]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:c("text-[10px] font-mono",J?"text-white/40":"text-gray-500"),children:R.labels.budgetUtil}),jsxs("span",{className:c("text-[10px] font-mono font-bold tabular-nums",J?"text-white/60":"text-gray-700",k&&"blur-sm select-none"),children:[ke.budgetUtil,"%"]})]}),jsx("div",{className:c("h-1.5 rounded-full overflow-hidden",J?"bg-white/5":"bg-gray-200"),children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ke.budgetUtil}%`,background:ke.budgetUtil>90?"#EF4444":ke.budgetUtil>70?"#F59E0B":"linear-gradient(to right, #00E5CC, #8B5CF6)"}})})]}),jsxs("div",{className:"grid grid-cols-2 gap-2",children:[jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",J?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",J?"text-white/25":"text-gray-400"),children:R.labels.variance}),jsxs("div",{className:c("text-[11px] font-mono font-bold tabular-nums",ke.avgVariance>0?"text-emerald-400":ke.avgVariance<0?"text-red-400":J?"text-white/50":"text-gray-600"),children:[ke.avgVariance>0?"+":"",ke.avgVariance," ",R.labels.days]})]}),jsxs("div",{className:c("rounded-md px-2 py-1.5 text-center",J?"bg-white/[0.03] border border-white/[0.06]":"bg-gray-100 border border-gray-200"),children:[jsx("div",{className:c("text-[8px] font-mono uppercase tracking-wider mb-0.5",J?"text-white/25":"text-gray-400"),children:R.labels.cost}),jsx("div",{className:c("text-[11px] font-mono font-bold tabular-nums",ke.costDisplay.startsWith("-")?"text-red-400":"text-emerald-400",k&&"blur-sm select-none"),children:ke.costDisplay})]})]})]})]})]}),!j&&jsx(Mo,{task:z,isOpen:!!z,onClose:()=>te(null),onTaskUpdate:O=>{a.onTaskUpdate?.(O),te(O);},theme:L==="dark"?"dark":"light",locale:X$1,availableUsers:t.availableUsers?.map(O=>({id:O.id,name:O.name,avatar:O.avatar,initials:O.name?.slice(0,2).toUpperCase()||"U",color:"#8B5CF6"}))||[],availableTags:d,onCreateTag:i,attachments:z?u?.get(z.id)||[]:[],onUploadAttachments:a.onUploadAttachments,onDeleteAttachment:a.onDeleteAttachment,availableTasks:Qs(e).filter(O=>O.id!==z?.id),comments:m?.filter(O=>O.taskId===z?.id).map(O=>({...O,createdAt:O.createdAt instanceof Date?O.createdAt:new Date(O.createdAt),updatedAt:O.updatedAt instanceof Date?O.updatedAt:O.updatedAt?new Date(O.updatedAt):void 0})),onAddComment:p,currentUser:g,mentionableUsers:f,onUploadCommentAttachments:x,enableTimeTracking:b,timeTrackingSummary:h,timeEntries:v,isTimerRunning:w?.isRunning,timerElapsedSeconds:w?.elapsedSeconds,onTimeLog:N,onEstimateUpdate:S,onSoldEffortUpdate:F,onTimerStart:T,onTimerStop:E,onTimerDiscard:P,blurFinancials:k}),jsx(AnimatePresence,{children:De&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:()=>Ee(null),className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:c("fixed left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-[320px] max-h-[400px] rounded-xl shadow-2xl z-50 overflow-hidden",J?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08]":"bg-white border border-gray-200"),children:[jsxs("div",{className:c("px-4 py-3 border-b flex items-center justify-between",J?"border-white/[0.08] bg-[#080808]":"border-gray-200"),children:[jsx("span",{className:c("font-medium text-sm",J?"text-white/90":"text-gray-900"),children:De.date.toLocaleDateString(X$1==="es"?"es-ES":"en-US",{weekday:"long",month:"long",day:"numeric"})}),jsx("button",{onClick:()=>Ee(null),className:c("p-1 rounded",J?"hover:bg-white/10 text-white/40":"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-1.5",children:De.events.map(O=>jsxs("button",{onClick:()=>{Ee(null),je(O.task);},className:c("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-left transition-colors",J?"hover:bg-white/5 border border-white/5":"hover:bg-gray-50 border border-gray-100"),children:[jsx(F0,{task:O.task,isDark:J}),jsx("span",{className:c("text-sm truncate flex-1",J?"text-white/80":"text-gray-900"),children:O.title}),(O.task.priority==="high"||O.task.priority==="urgent")&&jsx(Flag,{className:"w-3.5 h-3.5 text-red-400"})]},O.id))})]})]})})]})}var $c={bgPrimary:"#050505",bgSecondary:"#080808",bgHover:"rgba(255, 255, 255, 0.02)",bgToday:"rgba(0, 229, 204, 0.08)",bgWeekend:"#050505",bgOtherMonth:"#080808",border:"#222222",borderLight:"#1a1a1a",textPrimary:"rgba(255, 255, 255, 0.90)",textSecondary:"rgba(255, 255, 255, 0.60)",textMuted:"rgba(255, 255, 255, 0.30)",textToday:"#007FFF",accent:"#007FFF",accentHover:"#3399FF",accentLight:"rgba(0, 229, 204, 0.15)",statusTodo:"rgba(255, 255, 255, 0.40)",statusInProgress:"#007FFF",statusCompleted:"#34D399",focusRing:"#007FFF",glass:"rgba(20, 20, 20, 0.6)",glassBorder:"rgba(255, 255, 255, 0.08)",glassHover:"rgba(255, 255, 255, 0.05)",neonRed:"#FF2E2E",glowBlue:"0 0 10px rgba(0, 229, 204, 0.3)",glowRed:"0 0 10px rgba(255, 46, 46, 0.4)"},Hc={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",glass:"rgba(255, 255, 255, 0.8)",glassBorder:"rgba(0, 0, 0, 0.08)",glassHover:"rgba(0, 0, 0, 0.04)",neonRed:"#DC2626",glowBlue:"0 0 10px rgba(0, 229, 204, 0.15)",glowRed:"0 0 10px rgba(220, 38, 38, 0.2)"},zc={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",glass:"rgba(26, 26, 46, 0.6)",glassBorder:"rgba(255, 255, 255, 0.06)",glassHover:"rgba(255, 255, 255, 0.04)",neonRed:"#EF4444",glowBlue:"0 0 10px rgba(99, 102, 241, 0.3)",glowRed:"0 0 10px rgba(239, 68, 68, 0.3)"},kl={dark:$c,light:Hc,neutral:zc};function O0(e){return kl[e]||kl.dark}function Bw({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:l}){let[d,i]=useState(false),u=useMemo(()=>t.filter(g=>e.cardIds.includes(g.id)),[t,e.cardIds]),m=useMemo(()=>{let g=u.length,f=new Set(u.flatMap(b=>b.assignedUserIds||[])).size,x=u.map(b=>b.priority).filter(Boolean),y=new Set(u.flatMap(b=>b.labels||[])).size;return {totalCards:g,uniqueAssignees:f,priorities:x,labels:y}},[u]),p=()=>{n?.(e.id);};return jsxs("div",{className:c("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:c("card-stack-chevron",e.isExpanded&&"expanded"),children:jsx("polyline",{points:"6 9 12 15 18 9"})})}),jsx("h3",{className:"card-stack-title",children:e.title}),jsx("div",{className:"card-stack-badge",children:m.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"]})]}),d&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:g=>{g.stopPropagation(),o?.(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:[m.uniqueAssignees," assignees"]})]}),m.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:[m.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(g=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(g),children:a(g)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(g),children:[jsx("h4",{children:g.title}),g.description&&jsxs("p",{children:[g.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,g.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"})]})})]},g.id))})})]})}var H0={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ei(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 ti(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 z0(e){return {created:"#10b981",status_changed:"#00E5CC",assignee_changed:"#8b5cf6",priority_changed:"#f59e0b",moved:"#00E5CC",title_updated:"#6366f1",description_updated:"#6366f1",dates_changed:"#ec4899",labels_changed:"#00E5CC",dependency_added:"#a855f7",dependency_removed:"#ef4444",comment_added:"#84cc16",archived:"#6b7280",restored:"#10b981"}[e]||"#6b7280"}function U0({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:l}){let d=useMemo(()=>({...H0,...o}),[o]),[i,u]=useState(new Set),m=useRef(null),p=useMemo(()=>{if(!d.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],N=h.get(w);N?N.push(v):h.set(w,[v]);}),Array.from(h.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((N,S)=>S.timestamp.getTime()-N.timestamp.getTime())}))},[e,d.groupByDay]),{uniqueUsers:g,uniqueTypes:f}=useMemo(()=>{let h=new Set,v=new Set;return e.forEach(w=>{h.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(v)}},[e]),x=h=>{u(v=>{let w=new Set(v);return w.has(h)?w.delete(h):w.add(h),w});},y=h=>{let w=new Date().getTime()-h.getTime(),N=Math.floor(w/6e4),S=Math.floor(w/36e5),F=Math.floor(w/864e5);return N<1?"just now":N<60?`${N}m ago`:S<24?`${S}h ago`:F<7?`${F}d ago`:h.toLocaleDateString()},b=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&&m.current){let h=m.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:c("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:c("history-timeline",d.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 v=h.target.value;a({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxs("option",{value:h,children:[ti(h)," ",h.replace("_"," ")]},h))]}),g.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let v=h.target.value;a({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),g.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})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:m,children:p.map(h=>jsxs("div",{className:"history-timeline-group",children:[d.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((v,w)=>{let N=i.has(v.id),S=s===v.id,F=z0(v.type);return jsxs("div",{"data-event-id":v.id,className:c("history-timeline-event",N&&"expanded",S&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:F},children:d.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:ti(v.type)})}),w<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:F}})]}),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:[d.showAvatars&&v.userAvatar&&jsx("img",{src:v.userAvatar,alt:v.userName||v.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:v.userName||v.userId}),jsx("span",{className:"history-timeline-event-action",children:ei(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:d.useRelativeTime?y(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),x(v.id);},children:[N?"\u25BC":"\u25B6"," Show changes"]}),N&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([T,E])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(E.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(E.to)})]})]},T)),v.metadata&&Object.keys(v.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(v.metadata).map(([T,E])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(E)})]},T))]})]})]})]},v.id)})})]},h.date?.toISOString()||"all"))})]})}function V0({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:l,onSpeedChange:d,className:i}){let u=[.5,1,1.5,2,3],m=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:c("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:c("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:m&&ti(m.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:m&&ei(m)}),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:m&&m.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:g=>l(parseInt(g.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${p}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((g,f)=>jsx("div",{className:c("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>l(f),title:ei(g)},g.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:n,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:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(g=>jsxs("button",{className:c("history-replay-speed-btn",e.speed===g&&"active"),onClick:()=>d(g),children:[g,"x"]},g))})]}),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:m&&m.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(g=>jsx("span",{className:"history-replay-card-preview-label-tag",children:g},g))})]})]})]})]}):jsxs("div",{className:c("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 Uc(e){return {blocks:"#ef4444",blocked_by:"#dc2626",depends_on:"#f59e0b",required_by:"#d97706",relates_to:"#6b7280",duplicates:"#8b5cf6",parent_of:"#00E5CC",child_of:"#00C4AE",similar_to:"#10b981"}[e]||"#6b7280"}function Wc(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 G0(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 j0(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Uw(e,t,a,r,n,s=100){let o=e.map(d=>({...d,x:d.x??a/2+Math.random()*100-50,y:d.y??r/2+Math.random()*100-50,vx:0,vy:0})),l=new Map(o.map(d=>[d.id,d]));for(let d=0;d<s;d++){let i=1-d/s;o.forEach(u=>{let m=a/2,p=r/2;u.vx+=(m-u.x)*n.centerForce*i,u.vy+=(p-u.y)*n.centerForce*i,o.forEach(g=>{if(u.id===g.id)return;let f=u.x-g.x,x=u.y-g.y,y=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(y*y);u.vx+=f/y*b,u.vy+=x/y*b;});}),t.forEach(u=>{let m=l.get(typeof u.source=="string"?u.source:u.source.id),p=l.get(typeof u.target=="string"?u.target:u.target.id);if(!m||!p)return;let g=p.x-m.x,f=p.y-m.y,x=Math.sqrt(g*g+f*f)||1,y=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=g*y,m.vy+=f*y,p.vx-=g*y,p.vy-=f*y;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function _0({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:l,className:d}){let i=useRef(null),[u,m]=useState([]),[p,g]=useState(null),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(1),[w,N]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let U=Uw(e,t,a.width,a.height,a,150);m(U);},[e,t,a]);let S=useCallback((U,ae)=>{a.enableDragging&&(ae.stopPropagation(),g(U));},[a.enableDragging]),F=useCallback(U=>{if(!p||!i.current)return;let L=i.current.getBoundingClientRect(),X=(U.clientX-L.left-w.x)/h,Y=(U.clientY-L.top-w.y)/h;m(V=>V.map(R=>R.id===p?{...R,x:X,y:Y,fx:X,fy:Y}:R));},[p,h,w]),T=useCallback(()=>{g(null);},[]),E=useCallback((U,ae)=>{ae.stopPropagation(),l?.({type:"node-click",node:U,position:{x:ae.clientX,y:ae.clientY}});},[l]),P=useCallback((U,ae)=>{ae.stopPropagation(),l?.({type:"edge-click",edge:U,position:{x:ae.clientX,y:ae.clientY}});},[l]),k=useCallback(U=>{let ae=u.find(L=>L.id===U);return ae?{x:ae.x,y:ae.y}:{x:0,y:0}},[u]),j=useCallback(U=>{if(U.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return U.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ae=U.card.priority;return ae==="URGENT"?"#ef4444":ae==="HIGH"?"#f59e0b":ae==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return U.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:c("relationships-graph-empty",d),children:[jsx("div",{className:"relationships-graph-empty-icon",children:"\u{1F517}"}),jsx("p",{className:"relationships-graph-empty-text",children:"No relationships to display"}),jsx("p",{className:"relationships-graph-empty-subtext",children:"Add relationships between cards to see the graph"})]}):jsxs("div",{className:c("relationships-graph",d),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:o.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:o.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:()=>v(U=>Math.min(U+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(U=>Math.max(U-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),N({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(U=>U.type))).map(U=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Uc(U)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[G0(U)," ",Wc(U)]})]},U))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:F,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(U=>{let ae=k(typeof U.source=="string"?U.source:U.source.id),L=k(typeof U.target=="string"?U.target:U.target.id),X=j0(U.type),Y=y===U.id,V=U.onCriticalPath;return jsxs("g",{className:c("relationships-graph-edge",Y&&"hovered",V&&"critical"),onMouseEnter:()=>b(U.id),onMouseLeave:()=>b(null),onClick:R=>P(U,R),children:[jsx("line",{x1:ae.x,y1:ae.y,x2:L.x,y2:L.y,stroke:Uc(U.type),strokeWidth:V?a.edgeWidth*2:a.edgeWidth,strokeOpacity:Y?1:.6,markerEnd:X?"url(#arrowhead)":void 0}),a.showEdgeLabels&&Y&&jsx("text",{x:(ae.x+L.x)/2,y:(ae.y+L.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Wc(U.type)})]},U.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(U=>{let ae=f===U.id,L=U.onCriticalPath;return jsxs("g",{className:c("relationships-graph-node",ae&&"hovered",L&&"critical"),transform:`translate(${U.x}, ${U.y})`,onMouseDown:X=>S(U.id,X),onMouseEnter:()=>x(U.id),onMouseLeave:()=>x(null),onClick:X=>E(U,X),children:[jsx("circle",{r:L?a.nodeSize*1.2:a.nodeSize,fill:j(U),stroke:L?"#fbbf24":"#ffffff",strokeWidth:L?3:2,opacity:ae?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:U.card.title.length>20?U.card.title.substring(0,20)+"...":U.card.title})]},U.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 Y0({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[l,d]=useState(false),[i,u]=useState(null),[m,p]=useState(null),g=useRef(null),f=l||n;useEffect(()=>{e&&g.current&&g.current.focus();},[e]),useEffect(()=>{let h=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let x=()=>{f||(o(""),u(null),p(null),t());},y=async()=>{if(!(!s.trim()||f)){d(true),u(null),p(null);try{let h=await r(s.trim());p(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{d(false);}}},b=()=>{m&&(a(m),x());};return e?jsxs(oa,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:x}),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-[#00E5CC]",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:x,disabled:f,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:m?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!"})]}),m.explanation&&jsx("div",{className:"p-4 rounded-lg bg-[#00E5CC]/10 border border-[#00E5CC]/30",children:jsx("p",{className:"text-sm text-white/90",children:m.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",m.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:m.columns.map((h,v)=>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},v))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",m.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[m.cards.slice(0,10).map((h,v)=>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-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},v)),m.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",m.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:g,value:s,onChange:h=>o(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-[#00E5CC]/50 transition-all resize-none",disabled:f}),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,v)=>jsx("button",{onClick:()=>o(h),disabled:f,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},v))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:f&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:x,disabled:f,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"}),m?jsx("button",{onClick:b,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:y,disabled:!s.trim()||f,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:f?"Generating...":"Generate Plan"})]})]})]})})]}):null}var Vc={"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 Vw={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Gw={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 jw(e,t,a){let r=Vc[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function ai(e){return `$${e.toFixed(4)}`}var Gc=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=jw(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(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let r=a.length,n=a.reduce((m,p)=>m+p.cost,0),s=a.reduce((m,p)=>m+p.inputTokens,0),o=a.reduce((m,p)=>m+p.outputTokens,0),l=a.filter(m=>m.success),d=a.reduce((m,p)=>m+p.duration,0),i={},u={};return a.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,u[m.feature]=(u[m.feature]||0)+m.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:u,averageDuration:r>0?d/r:0,successRate:r>0?l.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let l=this.operations.filter(u=>u.timestamp>=o).length,d=Math.max(0,n-l),i=l/n*100;return {used:l,limit:n,remaining:d,percentUsed:i,isExceeded:l>=n}}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)}},En=new Gc;function Q0({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(En.getStats()),[s,o]=useState(En.checkLimit(a));if(useEffect(()=>{if(!e)return;let d=setInterval(()=>{n(En.getStats()),o(En.checkLimit(a));},1e3);return ()=>clearInterval(d)},[e,a]),useEffect(()=>{let d=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[e,t]),!e)return null;let l=En.getRecentOperations(5);return jsxs(oa,{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:d=>d.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[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-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/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:ai(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-[#00E5CC] 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(([d,i])=>{let u=r.costsByFeature[d]||0,m=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:d.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:ai(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${m}%`}})})]},d)})})]}),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(d=>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:d.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(d.timestamp).toLocaleTimeString()," \u2022"," ",d.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[d.inputTokens+d.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ai(d.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${d.success?"bg-green-400":"bg-red-400"}`})]})]},d.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 tf({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,l]=useState(""),[d,i]=useState(""),[u,m]=useState(""),[p,g]=useState(false),[f,x]=useState(null),[y,b]=useState(null),[h,v]=useState(null),w=useRef(null),N=p||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let P=k=>{k.key==="Escape"&&!N&&S();};if(e)return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[e,N]);let S=()=>{N||(l(""),i(""),m(""),x(null),b(null),v(null),t());},F=async()=>{if(!(!o.trim()||N)){g(true),x(null),b(null),v(null);try{let P=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:d||void 0,endDate:u||void 0});b(P.tasks.tasks),v({from_cache:P.from_cache,tokens_used:P.tokens_used,mock_mode:P.mock_mode,similarity:P.similarity,tokens_saved:P.tokens_saved});}catch(P){x(P instanceof Error?P.message:"Failed to generate tasks");}finally{g(false);}}},T=()=>{y&&(a(y),S());};if(!e)return null;let E=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(oa,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:S}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:P=>P.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[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-[#00E5CC]",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:S,disabled:N,className:"text-white/60 hover:text-white transition-colors disabled:opacity-50",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-4",children:y?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[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-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",E,"% 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:[y.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:y.map((P,k)=>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:["#",k+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:P.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"})]}),P.start," \u2192 ",P.end]}),jsxs("span",{children:[P.duration," days"]}),P.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",P.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${P.priority==="high"?"bg-red-500/20 text-red-400":P.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:P.priority})]})},P.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:P=>l(P.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-[#00E5CC]/50 transition-all resize-none",disabled:N}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Start Date (Optional)"}),jsx("input",{type:"date",value:d,onChange:P=>i(P.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-[#00E5CC]/50 transition-all",disabled:N})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:P=>m(P.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-[#00E5CC]/50 transition-all",disabled:N})]})]}),f&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:f}),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((P,k)=>jsx("button",{onClick:()=>l(P),disabled:N,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:P},k))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:N&&jsxs("div",{className:"flex items-center gap-2 text-[#00E5CC] 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:S,disabled:N,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),y?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:F,disabled:!o.trim()||N,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all disabled:opacity-50",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#ffffff"},children:N?"Generating...":"Generate Tasks"})]})]})]})})]})}function Nl({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(y=>{t&&mi(()=>Promise.resolve(t(y)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,h,v)=>{console.warn(`Retry attempt ${h} after ${v}ms: ${b.message}`);}}).then(b=>{b.success||console.error(`Failed to persist board after ${b.attempts} attempts:`,b.error);});},[t]),s=useCallback(async(y,b,h)=>{r(v=>{let w=v.cards.find(P=>P.id===y);if(!w)return v;let N=w.columnId,S={...w,columnId:b,position:h},F=v.cards.map(P=>P.id===y?S:P),T=v.columns.map(P=>{if(P.id===N)return {...P,cardIds:P.cardIds.filter(k=>k!==y)};if(P.id===b){let k=F.filter(j=>j.columnId===b).sort((j,U)=>j.position-U.position);return {...P,cardIds:k.map(j=>j.id)}}return P}),E={...v,cards:F,columns:T};return n(E),E});},[n]),o=useCallback(async(y,b)=>{r(h=>{let v=h.cards.map(N=>N.id===y?{...N,...b}:N),w={...h,cards:v};return n(w),w});},[n]),l=useCallback(async y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...y,id:b},w=h.columns.map(S=>S.id===y.columnId?{...S,cardIds:[...S.cardIds,b]}:S),N={...h,cards:[...h.cards,v],columns:w};return n(N),N});},[n]),d=useCallback(async y=>{r(b=>{let h=b.cards.find(S=>S.id===y);if(!h)return b;let v=b.cards.filter(S=>S.id!==y),w=b.columns.map(S=>S.id===h.columnId?{...S,cardIds:S.cardIds.filter(F=>F!==y)}:S),N={...b,cards:v,columns:w};return n(N),N});},[n]),i=useCallback(async y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let v={...y,id:b,cardIds:[]},w={...h,columns:[...h.columns,v]};return n(w),w});},[n]),u=useCallback(async(y,b)=>{r(h=>{let v=h.columns.map(N=>N.id===y?{...N,...b}:N),w={...h,columns:v};return n(w),w});},[n]),m=useCallback(async y=>{r(b=>{let h=b.cards.filter(N=>N.columnId!==y),v=b.columns.filter(N=>N.id!==y),w={...b,cards:h,columns:v};return n(w),w});},[n]),p=useCallback(y=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(y),b},[l]),g=useCallback(y=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(y),b},[i]),f=useCallback(()=>{r(y=>{let b={...y,cards:[],columns:[]};return n(b),b});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:l,onCardDelete:d,onColumnCreate:i,onColumnUpdate:u,onColumnDelete:m},setBoard:r,helpers:{addCard:p,addColumn:g,deleteCard:d,deleteColumn:m,clearBoard:f}}}function rf({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=Nl({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(d,i,u={})=>{s.addCard({title:i,columnId:d,position:r.cards.filter(m=>m.columnId===d).length,...u});},addColumn:(d,i)=>{let u=r.columns.length>0?Math.max(...r.columns.map(m=>m.position)):0;s.addColumn({title:d,position:i??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var ri={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},nf={by:"none",order:"asc"};function sf({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...ri,...e}),[s,o]=useState({...nf,...t}),l=useCallback(x=>{n(y=>({...y,...x}));},[]),d=useCallback(x=>{o(y=>({...y,...x}));},[]),i=useCallback(()=>{n(ri),o(nf);},[]),u=useCallback(()=>{a&&n({...ri,assignees:[a]});},[a]),m=useCallback(()=>{n({...ri,dateFilter:"overdue"});},[]),p=useCallback(()=>{n({...ri,priorities:["HIGH","URGENT"]});},[]),g=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]),f=useCallback(x=>{let y=[...x];if(r.search){let b=r.search.toLowerCase();y=y.filter(h=>h.title.toLowerCase().includes(b)||h.description?.toLowerCase().includes(b));}if(r.dateFilter!=="all"){let b=new Date,h=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),N=`${h}-${v}-${w}`;y=y.filter(S=>{if(!S.endDate&&!S.dueDate)return false;let F=S.endDate||S.dueDate;if(!F)return false;let T;if(typeof F=="string")T=F.split("T")[0]||F;else {let E=F.getUTCFullYear(),P=String(F.getUTCMonth()+1).padStart(2,"0"),k=String(F.getUTCDate()).padStart(2,"0");T=`${E}-${P}-${k}`;}switch(r.dateFilter){case "overdue":return T<N;case "today":return T===N;case "this-week":let E=new Date(N+"T00:00:00"),P=new Date(T+"T00:00:00"),k=new Date(E);return k.setDate(k.getDate()+7),P>=E&&P<=k;case "custom":if(r.dateRange){let j=typeof F=="string"?new Date(F):F;return j>=r.dateRange.start&&j<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(y=y.filter(b=>b.priority&&r.priorities.includes(b.priority))),r.assignees.length>0&&(y=y.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>r.assignees.includes(v)))),r.labels.length>0&&(y=y.filter(b=>b.labels&&b.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(y=y.filter(b=>r.columns.includes(b.columnId))),s.by!=="none"&&y.sort((b,h)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,N=h.createdAt?new Date(h.createdAt).getTime():0;v=w-N;break;case "priority":let S={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},F=S[b.priority||"LOW"],T=S[h.priority||"LOW"];v=F-T;break;case "dueDate":let E=b.endDate||b.dueDate,P=h.endDate||h.dueDate;if(!E)return 1;if(!P)return -1;let k=typeof E=="string"?new Date(E).getTime():E.getTime(),j=typeof P=="string"?new Date(P).getTime():P.getTime();v=k-j;break;case "title":v=b.title.localeCompare(h.title);break;case "estimate":let U=b.estimatedTime||0,ae=h.estimatedTime||0;v=U-ae;break;default:v=0;}return s.order==="asc"?v:-v}),y},[r,s]);return {filters:r,sort:s,setFilters:l,setSort:d,resetFilters:i,filterMyTasks:u,filterOverdue:m,filterHighPriority:p,applyFilters:f,hasActiveFilters:g}}var df,cf;if(typeof window<"u")try{let e=ci("ai");df=e.generateObject,cf=e.generateText;}catch{}function uf(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(df&&cf&&e.apiKey),o=useCallback(async m=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",m),{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: ${m}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(p){let g=p instanceof Error?p:new Error("Failed to generate plan");throw n(g),g}finally{a(false);}},[s]),l=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",m.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(p){let g=p instanceof Error?p:new Error("Failed to suggest assignee");throw n(g),g}finally{a(false);}},[s]),d=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(p){let g=p instanceof Error?p:new Error("Failed to predict risks");throw n(g),g}finally{a(false);}},[s]),i=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",m.title),[{title:`Subtask 1 for: ${m.title}`,position:m.position+.1,columnId:m.columnId},{title:`Subtask 2 for: ${m.title}`,position:m.position+.2,columnId:m.columnId}]}catch(p){let g=p instanceof Error?p:new Error("Failed to generate subtasks");throw n(g),g}finally{a(false);}},[s]),u=useCallback(async m=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(p){let g=p instanceof Error?p:new Error("Failed to estimate effort");throw n(g),g}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:l,onPredictRisks:d,onGenerateSubtasks:i,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function _c(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function pf(e){let{cards:t}=e,[a,r]=_c(),n=useCallback(m=>a.selectedCardIds.includes(m),[a.selectedCardIds]),s=useCallback((m,p)=>{if(!p){r({selectedCardIds:[m],lastSelectedCardId:m});return}let g=p.ctrlKey||p.metaKey,f=p.shiftKey;if(g)a.selectedCardIds.includes(m)?r({selectedCardIds:a.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,m],lastSelectedCardId:m});else if(f&&a.lastSelectedCardId){let x=t.find(b=>b.id===m),y=t.find(b=>b.id===a.lastSelectedCardId);if(x&&y&&x.columnId===y.columnId){let b=t.filter(T=>T.columnId===x.columnId).sort((T,E)=>T.position-E.position),h=b.findIndex(T=>T.id===a.lastSelectedCardId),v=b.findIndex(T=>T.id===m),[w,N]=h<v?[h,v]:[v,h],S=b.slice(w,N+1).map(T=>T.id),F=Array.from(new Set([...a.selectedCardIds,...S]));r({selectedCardIds:F,lastSelectedCardId:m});}else r({selectedCardIds:[m],lastSelectedCardId:m});}else r({selectedCardIds:[m],lastSelectedCardId:m});},[t,a,r]),o=useCallback(m=>{r({selectedCardIds:a.selectedCardIds.filter(p=>p!==m),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),l=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),d=useCallback(()=>{r({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),i=useCallback(m=>{a.selectedCardIds.includes(m)?o(m):r({selectedCardIds:[...a.selectedCardIds,m],lastSelectedCardId:m});},[a,o,r]),u=useCallback(()=>t.filter(m=>a.selectedCardIds.includes(m.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:l,selectAll:d,toggleCard:i,getSelectedCards:u}}var mf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function gf(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...mf,...a}),[a]),[s,o]=useState([]),l=useCallback((x,y,b,h,v)=>{if(y.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let w={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:x,cardIds:y,columnId:b,strategy:h,color:v,isExpanded:true,position:s.filter(N=>N.columnId===b).length,createdAt:new Date};o(N=>[...N,w]);},[n.minCardsPerStack,s]),d=useCallback(x=>{o(y=>y.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(y=>y.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),u=useCallback((x,y)=>{o(b=>b.map(h=>h.id===x&&!h.cardIds.includes(y)?{...h,cardIds:[...h.cardIds,y]}:h));},[]),m=useCallback((x,y)=>{o(b=>b.map(h=>{if(h.id===x){let v=h.cardIds.filter(w=>w!==y);return v.length<n.minCardsPerStack?null:{...h,cardIds:v}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),p=useCallback(x=>s.filter(y=>y.columnId===x).sort((y,b)=>y.position-b.position),[s]),g=useCallback(async x=>{let y=t.filter(N=>N.columnId===x);if(y.length<n.minCardsPerStack*2)return [];let b=[],h=new Map;y.forEach(N=>{N.labels&&N.labels.length>0&&N.labels.forEach(S=>{h.has(S)||h.set(S,[]),h.get(S).push(N);});}),h.forEach((N,S)=>{N.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${S}`,cardIds:N.map(F=>F.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${N.length} cards with label "${S}"`,confidence:.85});});let v=new Map;y.forEach(N=>{N.assignedUserIds&&N.assignedUserIds.length>0&&N.assignedUserIds.forEach(S=>{v.has(S)||v.set(S,[]),v.get(S).push(N);});}),v.forEach((N,S)=>{N.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${S.slice(-4)}`,cardIds:N.map(F=>F.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${N.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(y.forEach(N=>{N.priority&&(w.has(N.priority)||w.set(N.priority,[]),w.get(N.priority).push(N));}),w.forEach((N,S)=>{if(N.length>=n.minCardsPerStack){let F={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[S.toLowerCase()]||"\u26AA";b.push({stack:{title:`${F} ${S} Priority`,cardIds:N.map(T=>T.id),columnId:x,strategy:"priority",color:S==="high"||S==="urgent"?"#ef4444":"#10b981"},reason:`${N.length} cards with ${S} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let N of y){let F=(await r.findSimilar(N,y)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(F.length>=n.minCardsPerStack-1){let T=[N.id,...F.map(P=>P.card.id)],E=F.reduce((P,k)=>P+k.similarity,0)/F.length;b.push({stack:{title:`\u2728 Similar to "${N.title.substring(0,30)}${N.title.length>30?"...":""}"`,cardIds:T,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${F.length+1} similar tasks`,confidence:E});}}return b.filter(N=>N.confidence>=n.autoStackConfidenceThreshold).sort((N,S)=>S.confidence-N.confidence).slice(0,5)},[t,n,r]),f=useCallback(x=>{l(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[l]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(y=>y.columnId)).forEach(async y=>{let b=await g(y),h=b[0];b.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:l,deleteStack:d,toggleStack:i,addToStack:u,removeFromStack:m,getStacksForColumn:p,getSuggestions:g,applySuggestion:f,config:n}}var ff=createContext(null);function bf({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(d=>{let{Column:i}=ci("@libxai/core");s.set(d.id,new i(d));}),t?.cards?.forEach(d=>{let{Card:i}=ci("@libxai/core");o.set(d.id,new i(d));});let l=null;if(t?.board){let{Board:d}=ci("@libxai/core");l=new d(t.board);}r.current=new BoardStore({board:l,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(ff.Provider,{value:{store:n},children:e})}function Dl(){let e=useContext(ff);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ni(){let e=Dl(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let l=useCallback(h=>{e.updateBoard(h);},[e]),d=useCallback(h=>{e.addColumn(h);},[e]),i=useCallback((h,v)=>{e.updateColumn(h,v);},[e]),u=useCallback(h=>{e.deleteColumn(h);},[e]),m=useCallback(h=>e.getColumn(h),[e]),p=useCallback(h=>{e.addCard(h);},[e]),g=useCallback((h,v)=>{e.updateCard(h,v);},[e]),f=useCallback(h=>{e.deleteCard(h);},[e]),x=useCallback((h,v,w)=>{e.moveCard(h,v,w);},[e]),y=useCallback(h=>e.getCard(h),[e]),b=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:l,addColumn:d,updateColumn:i,deleteColumn:u,getColumn:m,addCard:p,updateCard:g,deleteCard:f,moveCard:x,getCard:y,getCardsByColumn:b}}function yf(e){let{cards:t}=ni();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!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(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function xf(e="position",t="asc"){let{cards:a}=ni();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let l={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},d=n.priority?l[n.priority]:0,i=s.priority?l[s.priority]:0;o=d-i;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var Sl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Su.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 n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let l=await Promise.resolve(o.apply(s,a));l!==void 0&&(n=l,a[0]=l);}catch(l){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,l,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},l5=new Sl;function wf({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:l=0,getItemKey:d}){let i=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:l}),m=u.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},g=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:p,className:n,children:jsx("div",{style:g,children:m.map(f=>{let x=e[f.index];if(!x)return null;let y=d?d(x,f.index):f.index,b={position:"absolute",top:o?0:f.start,left:o?f.start:0,width:o?f.size:"100%",height:o?"100%":f.size};return jsx("div",{style:b,"data-index":f.index,children:r(x,f.index)},y)})})})}function kf(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 Tf({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:l=16,getItemKey:d,horizontal:i=true}){let u=useRef(null),m=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:o,gap:l}),p=m.getVirtualItems(),g={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:g,className:s,children:jsx("div",{style:f,children:p.map(x=>{let y=e[x.index];if(!y)return null;let b=d?d(y,x.index):x.index,h={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:h,"data-index":x.index,children:n(y,x.index)},b)})})})}function Nf(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 Df(e,t=10){return e>t}var Xc={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Jc={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Qc={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Zc={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},eu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},tu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},au={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},ru={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)"},ou={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)"},nu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},su={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}},iu={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}},El={spacing:Xc,borderRadius:Jc,fontSize:Qc,fontWeight:Zc,lineHeight:eu,zIndex:tu,duration:au,easing:ru,shadows:ou,opacity:nu,kanban:su,gantt:iu};function Sf(e,t,a){return e[t]??a}function lu(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?lu(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function u5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function du(e="asakaa"){let t=lu(El),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=u5(n);a.push(` ${s}: ${o};`);}return `:root {
|
|
414
414
|
${a.join(`
|
|
415
415
|
`)}
|
|
416
|
-
}`}function
|
|
416
|
+
}`}function si(e,t="asakaa"){let a=[],r=lu(e);for(let[n,s]of Object.entries(r)){let o=`--${t}-color-${n}`;a.push(` ${o}: ${s};`);}return `:root {
|
|
417
417
|
${a.join(`
|
|
418
418
|
`)}
|
|
419
|
-
}`}var
|
|
419
|
+
}`}var Ml={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:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},cu={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:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},uu={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:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function pu(e=Ml,t="asakaa"){let a=du(t),r=si(e,t);return `${a}
|
|
420
420
|
|
|
421
|
-
${r}`}function
|
|
421
|
+
${r}`}function Ef(){return `/**
|
|
422
422
|
* ASAKAA Design Tokens
|
|
423
423
|
* Auto-generated from design-tokens.ts
|
|
424
424
|
* Do not edit this file directly
|
|
425
425
|
*/
|
|
426
426
|
|
|
427
|
-
${
|
|
427
|
+
${pu(Ml)}
|
|
428
428
|
|
|
429
429
|
/* Light theme */
|
|
430
430
|
[data-theme="light"] {
|
|
431
|
-
${
|
|
431
|
+
${si(cu,"asakaa").split(`
|
|
432
432
|
`).slice(1,-1).join(`
|
|
433
433
|
`)}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/* Neutral theme */
|
|
437
437
|
[data-theme="neutral"] {
|
|
438
|
-
${
|
|
438
|
+
${si(uu,"asakaa").split(`
|
|
439
439
|
`).slice(1,-1).join(`
|
|
440
440
|
`)}
|
|
441
441
|
}
|
|
442
|
-
`}var p5=({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
|
|
443
|
-
export{
|
|
442
|
+
`}var p5=({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 Mf({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:n,themes:s}=qn();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([o,l])=>{let d=o,i=d===r;return jsxs("button",{onClick:()=>n(d),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(p5,{theme:d})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:l.displayName})]},d)})})}
|
|
443
|
+
export{Q0 as AIUsageDashboard,Gw as AI_FEATURES,Vc as AI_MODELS,ud as AddCardButton,sd as AddColumnButton,yo as AttachmentUploader,bf as BoardProvider,Ri as BulkOperationsToolbar,Cd as BurnDownChart,N0 as CUSTOM_FIELD_TYPES,R0 as CalendarBoard,So as Card,hd as CardDetailModal,vd as CardDetailModalV2,V0 as CardHistoryReplay,U0 as CardHistoryTimeline,_0 as CardRelationshipsGraph,Bw as CardStack,Pd as CardTemplateSelector,Hl as CircuitBreaker,Un as Column,Wi as ColumnManager,gd as CommandPalette,Id as ConfigMenu,Qn as ContextMenu,Ls as DEFAULT_SHORTCUTS,C0 as DEFAULT_TABLE_COLUMNS,Md as DEFAULT_TEMPLATES,xs as DateRangePicker,ws as DependenciesSelector,zs as DependencyLine,Td as DistributionCharts,Kl as EditableColumnTitle,Gn as ErrorBoundary,xm as ExportDropdown,Ad as ExportImportModal,Ld as FilterBar,Zm as GANTT_AI_SYSTEM_PROMPT,el as GanttAIAssistant,Ym as GanttBoard,Xn as GanttI18nContext,Xi as GanttMilestone,Ui as GanttToolbar,tf as GenerateGanttTasksDialog,Y0 as GeneratePlanModal,Sd as GroupBySelector,Zl as HealthBar,jo as KanbanBoard,od as KanbanToolbar,Ps as KanbanViewAdapter,Ed as KeyboardShortcutsHelp,k0 as ListView,ya as MenuIcons,Sl as PluginManager,un as PrioritySelector,ed as ProfitabilityReport,bn as QuickTaskCreate,Vw as RATE_LIMITS,T0 as STANDARD_FIELDS,Nd as SwimlaneBoardView,Yl as TagBadge,cp as TagList,Wo as TagPicker,ji as TaskBar,Mo as TaskDetailModal,Qm as TaskFormModal,Gi as TaskGrid,$d as ThemeModal,im as ThemeProvider,Mf as ThemeSwitcher,fo as TimeInputPopover,Xl as TimePill,Jl as TimePopover,Ji as Timeline,mn as UserAssignmentSelector,kd as VelocityChart,Tf as VirtualGrid,wf as VirtualList,En as aiUsageTracker,Jc as borderRadius,pi as calculatePosition,$c as calendarDarkTheme,Lc as calendarEnTranslations,Ic as calendarEsTranslations,Hc as calendarLightTheme,zc as calendarNeutralTheme,kl as calendarThemes,yl as calendarTranslations,rl as cardToGanttTask,sg as cardsToGanttTasks,c as cn,zp as createKanbanView,Jf as createRetryWrapper,Bd as darkTheme,Ml as darkTokenTheme,$i as defaultTheme,El as designTokens,au as duration,ru as easing,Ef as exportTokensToCSS,Io as findTaskByName,Qc as fontSize,Zc as fontWeight,ai as formatCost,zi as ganttEnTranslations,dm as ganttEsTranslations,ng as ganttTaskToCardUpdate,xt as ganttThemes,iu as ganttTokens,Hd as ganttTranslations,Ae as ganttUtils,du as generateCSSVariables,pu as generateCompleteCSS,Kf as generateInitialPositions,eg as generateTasksContext,si as generateThemeVariables,O0 as getCalendarTheme,Xs as getCalendarTranslations,D0 as getListViewTheme,lc as getListViewTranslations,S0 as getMonthNames,Sf as getToken,cm as getTranslations,E0 as getWeekdayNames,su as kanbanTokens,Rd as lightTheme,cu as lightTokenTheme,eu as lineHeight,Pc as listViewDarkTheme,sc as listViewEnTranslations,ic as listViewEsTranslations,Fc as listViewLightTheme,Ac as listViewNeutralTheme,hl as listViewThemes,ol as listViewTranslations,xl as mergeCalendarTranslations,nl as mergeListViewTranslations,zd as mergeTranslations,Od as neutralTheme,uu as neutralTokenTheme,nu as opacity,rg as parseLocalCommand,rc as parseNaturalDate,oc as parseNaturalDuration,nc as parseProgress,ag as parseStatus,l5 as pluginManager,Xf as retrySyncOperation,mi as retryWithBackoff,ou as shadows,Df as shouldVirtualizeGrid,Xc as spacing,xn as themes,uf as useAI,rf as useBoard,ni as useBoardCore,Dl as useBoardStore,gf as useCardStacking,ad as useDragState,yf as useFilteredCards,sf as useFilters,Yr as useGanttI18n,Nl as useKanbanState,om as useKeyboardShortcuts,pf as useMultiSelect,_c as useSelectionState,xf as useSortedCards,qn as useTheme,Nf as useVirtualGrid,kf as useVirtualList,og as validateAIResponse,pd as withErrorBoundary,fi as wouldCreateCircularDependency,tu as zIndex};//# sourceMappingURL=index.js.map
|
|
444
444
|
//# sourceMappingURL=index.js.map
|