@libxai/board 1.9.25 → 1.9.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -411,7 +411,7 @@ ${lg(e).map(a=>{let n=a.startDate?a.startDate.toISOString().split("T")[0]:"no da
|
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
413
|
Today's date: ${new Date().toISOString().split("T")[0]}`}function lg(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function Un(e,t){let r=lg(e),a=t.toLowerCase().trim(),n=r.find(c=>c.name.toLowerCase()===a);if(n)return n;let s=r.find(c=>c.name.toLowerCase().includes(a));if(s)return s;let o=a.split(/\s+/);return r.find(c=>{let l=c.name.toLowerCase();return o.every(i=>l.includes(i))})}function md(e,t=new Date){let r=e.toLowerCase().trim(),a=new Date(t);if(a.setHours(0,0,0,0),r==="today"||r==="hoy")return a;if(r==="tomorrow"||r==="ma\xF1ana"){let u=new Date(a);return u.setDate(u.getDate()+1),u}if(r==="yesterday"||r==="ayer"){let u=new Date(a);return u.setDate(u.getDate()-1),u}if(r==="next week"||r==="la pr\xF3xima semana"){let u=new Date(a);return u.setDate(u.getDate()+7),u}let n=r.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 p={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(p!==void 0){let f=new Date(a),x=f.getDay(),h=p-x;return h<=0&&(h+=7),f.setDate(f.getDate()+h),f}}let s=r.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let u=parseInt(s[1],10),p=s[2].toLowerCase(),f=new Date(a);return p==="day"||p==="d\xEDa"||p==="dias"?f.setDate(f.getDate()+u):p==="week"||p==="semana"||p==="semanas"?f.setDate(f.getDate()+u*7):(p==="month"||p==="mes"||p==="meses")&&f.setMonth(f.getMonth()+u),f}if(r.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(r);let c=r.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(c&&c[1]&&c[2]&&c[3]){let u=parseInt(c[1],10),p=parseInt(c[2],10)-1,f=parseInt(c[3],10);return new Date(f,p,u)}let l={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=r.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 u=parseInt(i[1],10),p=l[i[2].toLowerCase()],f=i[3]?parseInt(i[3],10):a.getFullYear();if(p!==void 0)return new Date(f,p,u)}let d={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=r.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 u=d[m[1].toLowerCase()],p=parseInt(m[2],10),f=m[3]?parseInt(m[3],10):a.getFullYear();if(u!==void 0)return new Date(f,u,p)}return null}function gd(e){let r=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(r&&r[1]&&r[2]){let a=parseInt(r[1],10),n=r[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return a;if(n==="week"||n==="semana"||n==="semanas")return a*7;if(n==="month"||n==="mes"||n==="meses")return a*30}return null}function fd(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let r=parseInt(t[1],10);return Math.max(0,Math.min(100,r))}return null}function cg(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 dg(e,t){let r=e.toLowerCase().trim(),a=r.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(a&&a[1]&&a[2]){let i=a[1].trim(),d=a[2].trim(),m=Un(t,i),u=md(d);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(!u)return {type:"move_task",taskId:m.id,taskName:m.name,message:`Could not parse the date "${d}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let p=m.startDate&&m.endDate?Math.round((m.endDate.getTime()-m.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(u);return f.setDate(f.getDate()+p),{type:"move_task",taskId:m.id,taskName:m.name,updates:{startDate:u,endDate:f},message:`Moved "${m.name}" to ${u.toLocaleDateString()}.`,success:true}}let n=r.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let i=n[1].trim(),d=n[2].trim(),m=Un(t,i),u=gd(d);if(!m)return {type:"resize_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"};if(!u||!m.endDate)return {type:"resize_task",taskId:m.id,taskName:m.name,message:`Could not parse the duration "${d}".`,success:false,error:"Invalid duration"};let p=new Date(m.endDate);return p.setDate(p.getDate()+u),{type:"resize_task",taskId:m.id,taskName:m.name,updates:{endDate:p},message:`Extended "${m.name}" by ${u} days. New end date: ${p.toLocaleDateString()}.`,success:true}}let s=r.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(),d=s[2].trim(),m=Un(t,i),u=fd(d);return m?u===null?{type:"set_progress",taskId:m.id,taskName:m.name,message:`Could not parse the progress value "${d}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:m.id,taskName:m.name,updates:{progress:u},message:`Set "${m.name}" progress to ${u}%.`,success:true}:{type:"set_progress",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let o=r.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let i=o[1].trim(),d=o[2].trim(),m=Un(t,i);return m?{type:"rename_task",taskId:m.id,taskName:m.name,updates:{name:d},message:`Renamed "${m.name}" to "${d}".`,success:true}:{type:"rename_task",taskName:i,message:`Could not find a task named "${i}".`,success:false,error:"Task not found"}}let c=r.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]&&c[2]){let i=c[1].trim(),d=c[2].trim(),m=Un(t,i),u=Un(t,d);return m?u?{type:"link_tasks",taskId:u.id,taskName:u.name,dependencyFrom:m.id,dependencyTo:u.id,message:`Linked "${m.name}" \u2192 "${u.name}".`,success:true}:{type:"link_tasks",taskName:d,message:`Could not find a task named "${d}".`,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 l=r.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(l&&l[1]){let i=l[1].trim(),d=Un(t,i);return d?{type:"delete_task",taskId:d.id,taskName:d.name,message:`Deleted "${d.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 ug(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 Vw(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 jw(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function ul(e,t=[],r=[]){let a=e.assignedUserIds?.map(d=>{let m=r.find(u=>u.id===d);return m?{name:m.name,initials:m.initials,color:m.color}:null}).filter(d=>d!==null),n=t.filter(d=>d.metadata?.parentCardId===e.id).map(d=>ul(d,t,r)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(d=>d.type==="finish-to-start").map(d=>d.taskId));let o=d=>{if(d)return typeof d=="string"?new Date(d):d},c=o(e.startDate),l=o(e.endDate),i=e.metadata?.isMilestone===true||c&&l&&Math.abs(l.getTime()-c.getTime())<=864e5;return {id:e.id,name:e.title,startDate:c,endDate:l,progress:e.progress||0,status:Vw(e.metadata?.status),assignees:a?.length?a: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 pg(e,t=[]){let r;return e.assignees&&e.assignees.length>0&&(r=e.assignees.map(a=>t.find(s=>s.name===a.name||s.initials===a.initials)?.id).filter(a=>a!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:r?.length?r:void 0,metadata:{status:jw(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function mg(e,t=[]){return e.filter(a=>!a.metadata?.parentCardId).map(a=>ul(a,e,t))}var bd={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"}},hd={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"}},pl={en:bd,es:hd};function yd(e){return pl[e]||pl.en}function ml(e,t){let r=yd(e);return t?{columns:{...r.columns,...t.columns},toolbar:{...r.toolbar,...t.toolbar},filters:{...r.filters,...t.filters},status:{...r.status,...t.status},actions:{...r.actions,...t.actions},empty:{...r.empty,...t.empty},pagination:{...r.pagination,...t.pagination},bulk:{...r.bulk,...t.bulk}}:r}var xd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function gg(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 fg({value:e,onChange:t,isDark:r,translations:a,disabled:n=false}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let p=f=>{c.current&&!c.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let l=gg(e),i=xd[0],d=xd.find(p=>p.value===l)??i,m=d.icon,u=p=>{switch(gg(p)){case "completed":return a.completed;case "in-progress":return a.inProgress;default:return a.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(m,{className:g("w-4 h-4 flex-shrink-0",d.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",r?"text-white/60":"text-gray-500"),children:u(e)}),jsx(ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:xd.map(p=>{let f=p.icon;return jsxs("button",{onClick:x=>{x.stopPropagation(),t(p.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",l===p.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",p.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:u(p.value)})]},p.value)})})]})}var vd=[{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 hg({value:e="none",onChange:t,isDark:r,locale:a,disabled:n=false}){let[s,o]=useState(false),c=useRef(null);useEffect(()=>{let d=m=>{c.current&&!c.current.contains(m.target)&&o(false);};return s&&document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[s]);let l=vd.find(d=>d.value===e)??vd[4],i=a==="es"?"es":"en";return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]})]}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:d=>{d.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:l.label[i]}),jsx(ChevronDown,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[120px]",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:vd.map(d=>jsxs("button",{onClick:m=>{m.stopPropagation(),t(d.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===d.value&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",d.bg)}),jsx("span",{className:r?"text-white":"text-gray-900",children:d.label[i]})]},d.value))})]})}function ei(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function wd(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]"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"bg-[#00E5CC]"}function bl({value:e=[],availableUsers:t=[],onChange:r,isDark:a,locale:n,disabled:s=false}){let[o,c]=useState(false),[l,i]=useState(""),d=useRef(null),m=useRef(null);useEffect(()=>{let x=h=>{d.current&&!d.current.contains(h.target)&&(c(false),i(""));};return o&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]),useEffect(()=>{o&&m.current&&m.current.focus();},[o]);let u=t.filter(x=>x.name.toLowerCase().includes(l.toLowerCase())),p=x=>e.some(h=>h.name===x),f=x=>{if(r){if(p(x.name))r(e.filter(h=>h.name!==x.name));else {let h={name:x.name,initials:ei(x.name),color:x.color||wd(x.name).replace("bg-","").replace("-500",""),avatar:x.avatarUrl,id:x.id};r([...e,h]);}c(false),i("");}};return s||!r?e.length===0?jsx("span",{className:g("text-sm",a?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((x,h)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",a?"border-[#0D0D0D]":"border-white",!x.avatar&&wd(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||ei(x.name)},`${x.name}-${h}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",a?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:d,className:"relative",children:[jsx("button",{onClick:x=>{x.stopPropagation(),c(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:g("w-4 h-4",a?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((x,h)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",a?"border-[#0D0D0D]":"border-white",!x.avatar&&wd(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||ei(x.name)},`${x.name}-${h}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",a?"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:a?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${a?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:a?"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 ${a?"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:a?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:m,type:"text",value:l,onChange:x=>i(x.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:x=>x.stopPropagation(),style:{flex:1,fontSize:12,color:a?"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 ${a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((x,h)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:x.color?`${x.color}20`:a?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:x.color||(a?"#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||ei(x.name)}),x.name.split(" ")[0],jsx("button",{onClick:b=>{b.stopPropagation(),r(e.filter(y=>y.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}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:u.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:a?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):u.map(x=>{let h=p(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:h?a?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:a?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:b=>{h||(b.currentTarget.style.backgroundColor=a?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:b=>{h||(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"}):ei(x.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:x.name}),h&&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 Cg({startDate:e,endDate:t,onChange:r,singleDateMode:a=false,singleDateField:n="end",isDark:s,locale:o,disabled:c=false,placeholder:l}){let[i,d]=useState(false),[m,u]=useState(n),[p,f]=useState(()=>{let E=n==="start"?e:t;if(E){let G=E instanceof Date?E:new Date(E);return new Date(G.getFullYear(),G.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),x=useRef(null),h=useRef(null),b=useRef(null),[y,v]=useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let E=G=>{let O=G.target;x.current&&x.current.contains(O)||b.current&&b.current.contains(O)||d(false);};return i&&document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),useLayoutEffect(()=>{if(!i){v(null);return}let E=()=>{let G=h.current?.getBoundingClientRect();if(!G)return;let O=520,ee=360,I=window.innerHeight-G.bottom,Ae=I<ee&&G.top>I,H=Ae?G.top-4:G.bottom+4,ge=Math.min(Math.max(G.left,8),window.innerWidth-O-8);v({top:H,left:ge,flipUp:Ae});};return E(),window.addEventListener("scroll",E,true),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,true),window.removeEventListener("resize",E);}},[i]),useEffect(()=>{i&&u(a?n:"start");},[i,a,n]);let P=E=>E?E.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):l||"-",L=useCallback(()=>{let E=p.getFullYear(),G=p.getMonth(),O=new Date(E,G,1),I=new Date(E,G+1,0).getDate(),Ae=O.getDay(),H=[],N=new Date(E,G,0).getDate();for(let Xe=Ae-1;Xe>=0;Xe--)H.push({date:new Date(E,G-1,N-Xe),isCurrentMonth:false});for(let Xe=1;Xe<=I;Xe++)H.push({date:new Date(E,G,Xe),isCurrentMonth:true});let De=42-H.length;for(let Xe=1;Xe<=De;Xe++)H.push({date:new Date(E,G+1,Xe),isCurrentMonth:false});return H},[p]),k=E=>{if(a)n==="start"?r(E,C||void 0):r(w||void 0,E),d(false);else if(m==="start"){let G=C&&E>C?E:C;r(E,G||void 0),u("end");}else {let G=w&&E<w?E:w;r(G||void 0,E),d(false);}},D=()=>{let E=new Date,G=new Date(E);G.setDate(E.getDate()+1);let O=new Date(E);O.setDate(E.getDate()+((6-E.getDay()+7)%7||7));let ee=new Date(E);ee.setDate(E.getDate()+((1-E.getDay()+7)%7||7));let I=new Date(E);I.setDate(E.getDate()+(6-E.getDay()+7)%7+7);let Ae=new Date(E);Ae.setDate(E.getDate()+14);let H=new Date(E);return H.setDate(E.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:E,display:E.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:G,display:G.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:O,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:ee,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:I,display:I.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Ae,display:Ae.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:H,display:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(c){let E=a&&n==="start"?w:C;return jsxs("div",{className:"flex items-center gap-2",children:[jsx(Calendar,{className:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:P(E)})]})}let F=a&&n==="start"?w:C;return jsxs("div",{ref:x,className:"relative",children:[jsxs("button",{ref:h,onClick:E=>{E.stopPropagation(),d(!i);let G=n==="start"?w:C;G&&f(new Date(G.getFullYear(),G.getMonth(),1));},className:g("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:g("w-4 h-4",s?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm",s?"text-white/60":"text-gray-500"),children:P(F)})]}),i&&y&&createPortal(jsxs("div",{ref:b,className:g("rounded-xl shadow-2xl overflow-hidden flex",s?"bg-[#1A1A1A] border border-[#222]":"bg-white border border-gray-200"),style:{position:"fixed",top:y.flipUp?void 0:y.top,bottom:y.flipUp?window.innerHeight-y.top:void 0,left:y.left,zIndex:10001},onClick:E=>E.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[D().map((E,G)=>jsxs("button",{className:g("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:()=>k(E.date),children:[jsx("span",{children:E.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:E.display})]},G)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{a?n==="start"?r(void 0,C||void 0):r(w||void 0,void 0):r(void 0,void 0),d(false);},className:g("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:[!a&&jsx("div",{className:g("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:g("font-medium",s?"text-white":"text-gray-900"),children:p.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:g("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(p.getFullYear(),p.getMonth()-1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:g("w-4 h-4",s?"text-white":"text-gray-600")})}),jsx("button",{onClick:()=>f(new Date(p.getFullYear(),p.getMonth()+1)),className:g("p-1 rounded",s?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:g("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(E=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:E},E))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:L().map((E,G)=>{let O=E.date.toDateString()===new Date().toDateString(),ee=w?.toDateString()===E.date.toDateString(),I=C?.toDateString()===E.date.toDateString(),Ae=ee||I,H=!a&&w&&C&&E.date>=w&&E.date<=C;return jsx("button",{onClick:()=>k(new Date(E.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!E.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),E.isCurrentMonth&&(s?"text-white":"text-gray-900"),O&&"ring-2 ring-[#00E5CC]",ee&&"bg-[#00E5CC] text-white",I&&!ee&&"bg-[#7C3AED] text-white",H&&!Ae&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Ae&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:E.date.getDate()},G)})})]})]}),document.body)]})}function yl({value:e,onChange:t,isDark:r,locale:a,disabled:n=false,dateField:s="end",startDate:o,endDate:c}){let l=e?e instanceof Date?e:new Date(e):null;return jsx(Cg,{startDate:s==="start"?l:o||null,endDate:s==="end"?l:c||null,onChange:(u,p)=>{t&&t(s==="start"?u:p);},singleDateMode:true,singleDateField:s,isDark:r,locale:a,disabled:n||!t,placeholder:"-"})}function fs(e=600){let[t,r]=useState(false),a=useRef(null),n=useCallback(()=>{a.current&&clearTimeout(a.current),r(true),a.current=setTimeout(()=>{r(false);},e);},[e]);return useEffect(()=>()=>{a.current&&clearTimeout(a.current);},[]),{isFlashing:t,triggerFlash:n}}function xl(e,t={}){let{enabled:r=true,duration:a=400,steps:n=8}=t,[s,o]=useState(e),[c,l]=useState(false),i=useRef(e),d=useRef([]);return useEffect(()=>{if(d.current.forEach(clearTimeout),d.current=[],!r||e===i.current||e===void 0){o(e),i.current=e;return}let m=i.current??0,u=e,p=u-m,f=a/n;l(true);for(let x=1;x<=n;x++){let h=setTimeout(()=>{let b=x/n,y=1-Math.pow(1-b,3),v=Math.round(m+p*y);o(v),x===n&&(l(false),o(u));},f*x);d.current.push(h);}return i.current=e,()=>{d.current.forEach(clearTimeout),d.current=[];}},[e,r,a,n]),{displayValue:s,isAnimating:c}}function Tg(e,t={}){let{delay:r=1500,onCancel:a}=t,[n,s]=useState(null),[o,c]=useState(0),l=useRef(null),i=useRef(null),d=useCallback(p=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(p),c(0);let f=Date.now();i.current=setInterval(()=>{let x=Date.now()-f,h=Math.min(x/r*100,100);c(h);},16),l.current=setTimeout(()=>{i.current&&clearInterval(i.current),e?.(p),s(null),c(0);},r);},[r,e]),m=useCallback(()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current),s(null),c(0),a?.();},[a]);return useEffect(()=>()=>{l.current&&clearTimeout(l.current),i.current&&clearInterval(i.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:d,cancelChange:m}}function Dg({value:e=0,onChange:t,isDark:r,disabled:a=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,c]=useState(false),[l,i]=useState(""),d=useRef(null),{isFlashing:m,triggerFlash:u}=fs(),{displayValue:p,isAnimating:f}=xl(e,{enabled:n,duration:300,steps:6}),x=w=>{if(a||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),P=w.clientX-C.left,L=Math.round(P/C.width*100),k=Math.max(0,Math.min(100,L));k!==e&&(t(k),s&&u());},h=useCallback(w=>{a||!t||(w.stopPropagation(),i(String(e)),c(true));},[a,t,e]);useEffect(()=>{o&&d.current&&(d.current.focus(),d.current.select());},[o]);let b=useCallback(()=>{c(false);let w=parseInt(l,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&u());}},[l,t,e,s,u]),y=useCallback(w=>{w.key==="Enter"&&b(),w.key==="Escape"&&c(false);},[b]),v=p??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",m&&(r?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[v>0?jsx("div",{onClick:x,className:g("flex-1 h-2 rounded-full overflow-hidden",r?"bg-white/[0.05]":"bg-gray-200",!a&&t&&"cursor-pointer"),children:jsx("div",{className:g("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:d,value:l,onChange:w=>i(w.target.value.replace(/[^0-9]/g,"")),onBlur:b,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",r?"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:g("text-xs font-mono",r?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:h,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",v===0?r?"text-[#6B7280]":"text-gray-400":r?"text-white/60":"text-gray-500",!a&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!a&&t?"Click to edit":void 0,children:[v,"%"]})]})}function Mg({value:e="",onChange:t,isDark:r,placeholder:a="-",disabled:n=false}){let[s,o]=useState(false),[c,l]=useState(e),i=useRef(null);useEffect(()=>{s&&i.current&&(i.current.focus(),i.current.select());},[s]),useEffect(()=>{l(e);},[e]);let d=()=>{c!==e&&t?.(c),o(false);},m=u=>{u.key==="Enter"?d():u.key==="Escape"&&(l(e),o(false));};return n||!t?jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:e||a}):s?jsx("input",{ref:i,type:"text",value:c,onChange:u=>l(u.target.value),onBlur:d,onKeyDown:m,onClick:u=>u.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:u=>{u.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(r?"text-white/30":"text-gray-400")),children:e||a})}function Lg({value:e,onChange:t,isDark:r,placeholder:a="-",min:n,max:s,disabled:o=false,enableSlotMachine:c=true,enableSaveFlash:l=true}){let[i,d]=useState(false),[m,u]=useState(e?.toString()||""),p=useRef(null),{isFlashing:f,triggerFlash:x}=fs(),{displayValue:h,isAnimating:b}=xl(e,{enabled:c&&!i});useEffect(()=>{i&&p.current&&(p.current.focus(),p.current.select());},[i]),useEffect(()=>{u(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(m);if(!isNaN(w)){let C=w;n!==void 0&&(C=Math.max(n,C)),s!==void 0&&(C=Math.min(s,C)),C!==e&&(t?.(C),l&&x());}d(false);},v=w=>{w.key==="Enter"?y():w.key==="Escape"&&(u(e?.toString()||""),d(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500",b&&"font-medium"),children:h!==void 0?h:a}):i?jsx("input",{ref:p,type:"number",value:m,onChange:w=>u(w.target.value),onBlur:y,onKeyDown:v,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),d(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",h===void 0&&(r?"text-white/30":"text-gray-400"),f&&(r?"bg-green-500/30":"bg-green-500/20"),b&&"font-medium scale-105"),children:h!==void 0?h:a})}function Ag({value:e,options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false}){let[o,c]=useState(false),l=useRef(null);return useEffect(()=>{let i=d=>{l.current&&!l.current.contains(d.target)&&c(false);};return o&&document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[o]),s||!r?jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:i=>{i.stopPropagation(),c(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",!e&&(a?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("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",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(i=>jsxs("button",{onClick:d=>{d.stopPropagation(),r(i),c(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===i&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:i}),e===i&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},i))})]})}function Rg({value:e=false,onChange:t,isDark:r,disabled:a=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:c,progress:l,startChange:i,cancelChange:d}=Tg(t,{delay:s}),m=p=>{p.stopPropagation(),!a&&t&&(n?c?d():i(!e):t(!e));},u=c?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:m,disabled:a||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",u?"bg-[#00E5CC] border-[#00E5CC]":r?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(a||!t)&&"opacity-50 cursor-not-allowed",c&&"ring-2 ring-offset-1",c&&u&&"ring-green-500/50",c&&!u&&"ring-red-500/50",c&&(r?"ring-offset-[#050505]":"ring-offset-white")),children:[c&&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:u?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${l/100*50.26} 50.26`,className:"transition-all duration-100"})}),c?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):u?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),c&&jsx("button",{onClick:p=>{p.stopPropagation(),d();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",r?"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 Bg({value:e=[],options:t=[],onChange:r,isDark:a,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:c=2}){let[l,i]=useState(false),d=useRef(null);useEffect(()=>{let h=b=>{d.current&&!d.current.contains(b.target)&&i(false);};return l&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[l]);let m=e.slice(0,c),u=e.length-m.length,p=e.length===0?n:m.join(", ")+(u>0?` +${u}`:"");if(s||!r)return jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:p});let f=h=>{let b=e.includes(h),y=b?e.filter(v=>v!==h):[...e,h];!b&&o!=null&&e.length>=o||r(y);},x=o!=null&&e.length>=o;return jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{onClick:h=>{h.stopPropagation(),i(!l);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",a?"text-white/60":"text-gray-500",e.length===0&&(a?"text-white/30":"text-gray-400")),children:p}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")})]}),l&&jsx("div",{className:g("absolute z-50 top-full left-0 mt-1 py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",a?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let b=e.includes(h),y=!b&&x;return jsxs("button",{disabled:y,onClick:v=>{v.stopPropagation(),f(h);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",y?"opacity-40 cursor-not-allowed":a?"hover:bg-white/[0.05]":"hover:bg-gray-100",b&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:a?"text-white":"text-gray-900",children:h}),b&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Lk(e){if(!e)return [];if(typeof e=="string"){let t=e.split("/").filter(Boolean).pop()||e;return [{id:e,name:t,url:e}]}return e.filter(t=>t&&t.id)}function Hg({value:e,isDark:t,placeholder:r="-",onOpen:a}){let n=Lk(e);if(n.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:r});let s=n[0],o=n.length-1,c=o>0?`${s.name} +${o}`:s.name;return a?jsxs("button",{onClick:l=>{l.stopPropagation(),a(s);},title:n.map(l=>l.name).join(`
|
|
414
|
-
`),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsx("span",{className:"truncate",children:c})]}):jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),c]})}function zg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.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:g("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 Rk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function Bk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let c=parseFloat(a[1]),l=a[2]?parseInt(a[2],10):0;return Math.round(c*60)+l}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 Ia({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:c=false,lens:l="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=useState(false),[p,f]=useState(""),x=useRef(null),{isFlashing:h,triggerFlash:b}=fs(),y=l==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Rk(e,a);useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),useEffect(()=>{if(e){let k=Math.floor(e/60),D=e%60;k>0&&D>0?f(`${k}h ${D}m`):k>0?f(`${k}h`):f(`${D}m`);}else f("");},[e,m]);let C=()=>{let k=Bk(p);k!==e&&(t?.(k),o&&b()),u(false);},P=k=>{k.key==="Enter"?C():k.key==="Escape"&&u(false);};if(c)return jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let L=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(L,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsx("input",{ref:x,type:"text",value:p,onChange:k=>f(k.target.value),onBlur:C,onKeyDown:P,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"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:k=>{k.stopPropagation(),u(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",h&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(L,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function _g({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=l=>l.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),c=()=>{if(r==null)return null;let l=n==="es";return r===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:l?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):r>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),c()]})}function qg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:c="hours",hourlyRate:l=0}){let i=r==="es",d=c==="financial"&&l>0,m=H=>d?`$${Math.round(H*l).toLocaleString("en-US")}`:`${H}h`,[u,p]=useState(false),[f,x]=useState(false),[h,b]=useState(null),y=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,P=Math.round(v/60*10)/10,L=Math.round(w/60*10)/10,k=w>0?v/w*100:0,D=k>100?Math.round((v-w)/60*10)/10:0,F=k>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!h)return;let H=ge=>{y.current&&!y.current.contains(ge.target)&&(x(false),b(null));};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[f,h]);let E=H=>{if(H.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(ge=>!ge),b(null);return}o&&o(e);},G=H=>{x(false),b(H);},O=async(H,ge)=>{h==="log"&&a&&H?a(e,H,ge):h==="estimate"&&n?n(e,H):h==="quoted"&&s&&s(e,H),b(null);},ee=a||n||s||o,I=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(H=>H.show),Ae=h==="estimate"?w:h==="quoted"?C:void 0;return w===0&&v===0&&C===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:H=>H.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&ee&&jsx("button",{onClick:E,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:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",H.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",H.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:I.map(H=>jsxs("button",{onClick:ge=>{ge.stopPropagation(),G(H.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:ge=>{ge.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ge=>{ge.target.style.background="transparent";},children:[jsx(H.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),H.label]},H.mode))})}),jsx(AnimatePresence,{children:h&&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(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:H=>H.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(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 H=v===0,N=(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:H?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(P)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(L)]}),D>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:N?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:N?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(D)," ",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(k,100)}%`,backgroundColor:F,borderRadius:2,transition:"width 0.3s"}})})]}),ee&&jsx("button",{onClick:E,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",H.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",H.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:I.map(H=>jsxs("button",{onClick:ge=>{ge.stopPropagation(),G(H.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:ge=>{ge.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ge=>{ge.target.style.background="transparent";},children:[jsx(H.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),H.label]},H.mode))})}),jsx(AnimatePresence,{children:h&&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(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function Gk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Vk(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 Yg({assignee:e,size:t=28,isDark:r}){let a=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:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Xg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Gk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:m.map((p,f)=>jsx(Yg,{assignee:p,size:24,isDark:t},p.name+f))}),u>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("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:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let c=o?.percentage??0,l=!!o&&c>0,i=l?Vk(c):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Yg,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),l&&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:[c,"% LOAD"]})]})}var jk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Qg({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",jk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function s1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function i1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function o0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:c,onColumnHide:l,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:f,onTaskIndent:x,onTaskOutdent:h}){let b=useRef(null),y=a==="es"?t0.es:t0.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let D=b.current;if(!D)return;let F=D.getBoundingClientRect(),E=8,G=e.x,O=e.y;e.y+F.height>window.innerHeight-E&&(O=Math.max(E,e.y-F.height)),e.x+F.width>window.innerWidth-E&&(G=Math.max(E,window.innerWidth-F.width-E)),(G!==e.x||O!==e.y)&&w({left:G,top:O});},[e.x,e.y,e.isOpen]),useEffect(()=>{let D=E=>{b.current&&!b.current.contains(E.target)&&t();},F=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",D),document.addEventListener("keydown",F),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",F);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let D=[];return n&&D.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),D.push({id:"sep1",label:"",icon:null,separator:true}),c&&(D.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),D.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),d.length>0&&D.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(F=>({id:`assign-${F.id}`,label:F.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:F.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],O=E.some(ee=>ee.name===F.name)?E.filter(ee=>ee.name!==F.name):[...E,{name:F.name,initials:s1(F.name),color:F.color||i1(F.name),avatar:F.avatarUrl}];c({...e.task,assignees:O}),t();}}))})),m&&D.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&D.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&D.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),D.push({id:"sep2",label:"",icon:null,separator:true}),s&&D.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||h)&&(D.push({id:"sep3",label:"",icon:null,separator:true}),f&&(D.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),D.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&D.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&D.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&D.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),D},P=()=>{if(!e.columnId)return [];let D=[];return i&&(D.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),D.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),l&&e.columnId!=="name"&&(D.push({id:"sep-hide",label:"",icon:null,separator:true}),D.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId),t();}})),D},L=e.type==="task"?C():P(),k={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:k,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:L.map(D=>D.separator?jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},D.id):D.submenu?jsx(l1,{item:D,isDark:r},D.id):jsxs("button",{onClick:D.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",D.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsx("span",{className:g(D.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:D.icon}),D.label]},D.id))})}function l1({item:e,isDark:t}){let[r,a]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxs("button",{className:g("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:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsx("div",{className:g("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(c=>jsxs("button",{onClick:c.onClick,className:g("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:c.icon}),c.label]},c.id))})]})}var t0={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 m0={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"}),multiselect:jsx(Tag,{className:"w-4 h-4"}),person:jsx(Users,{className:"w-4 h-4"}),file:jsx(Paperclip,{className:"w-4 h-4"})},N1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function f0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:c}){let[l,i]=useState(""),[d,m]=useState(null),[u,p]=useState(null),f=useRef(null),x=c==="es"?g0.es:g0.en;useLayoutEffect(()=>{if(!e||!f.current)return;let L=()=>{if(!f.current)return;let k=f.current.parentElement;if(k){let G=k.getBoundingClientRect();p({top:G.bottom+4,right:window.innerWidth-G.right});}let D=f.current.getBoundingClientRect(),E=window.innerHeight-D.top-20;m(Math.max(300,E));};return requestAnimationFrame(L),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[e]),useEffect(()=>{if(!e)return;let L=setTimeout(()=>{let k=F=>{f.current&&!f.current.contains(F.target)&&t();},D=F=>{F.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",D),f._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(L),f._cleanup&&f._cleanup();}},[e,t]);let h=useMemo(()=>{let L=new Set([...N1]);return r.forEach(k=>{k.type&&k.type!=="assignees"&&L.add(k.type);}),Array.from(L)},[r]);if(!e)return null;let b=L=>{let k=x.columns[L];if(k)return k;let D=r.find(F=>F.type===L);return D?.label?D.label:L},y=L=>{if(L==="name")return;let k=r.map(D=>D.id===L?{...D,visible:!D.visible}:D);n(k);},v=(L,k)=>{let D=r.find(E=>E.type===L&&(!k||E.customFieldId===k));if(D){y(D.id);return}let F={id:k||L,type:L,label:k?a.find(E=>E.id===k)?.name||L:b(L),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};n([...r,F]);},w=h.filter(L=>L!=="assignees"&&b(L).toLowerCase().includes(l.toLowerCase())),C=a.filter(L=>L.name.toLowerCase().includes(l.toLowerCase())),P=o?"#00E5FF":"#00E5CC";return jsxs("div",{ref:f,style:{...d?{maxHeight:`${d}px`}:{},...u?{top:u.top,right:u.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:L=>{L.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",L.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent",L.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:l,onChange:L=>i(L.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:L=>{L&&L.style.setProperty("--focus-border",P);},onFocus:L=>{L.currentTarget.style.borderColor=P,L.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:L=>{L.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",L.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:L=>L.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(L=>{let k=r.find(E=>E.type===L&&!E.customFieldId),D=k?.visible??false,F=L==="name";return jsxs("button",{onClick:()=>{F||(k?y(k.id):v(L));},disabled:F,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:F?.4:1,cursor:F?"not-allowed":"pointer"},onMouseEnter:E=>{F||(E.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:E=>{E.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:D?P:"transparent",border:D?`1.5px solid ${P}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${P}40`:"none"},children:D&&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:D?P:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:m0[L]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:D?500:400,color:D?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(L),children:b(L)})]},L)})})]}),C.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:C.map(L=>{let D=r.find(F=>F.customFieldId===L.id)?.visible??false;return jsxs("button",{onClick:()=>v(L.type,L.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:F=>{F.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:F=>{F.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:D?P:"transparent",border:D?`1.5px solid ${P}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${P}40`:"none"},children:D&&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:D?P:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:m0[L.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:D?500:400,color:D?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:L.name})]},L.id)})})]})]})]})}var g0={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",multiselect:"Multi-select",person:"Person",file:"File",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 I1=[{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 y0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=useState(""),[c,l]=useState("text"),[i,d]=useState([""]),m=n==="es"?h0.es:h0.en;useEffect(()=>{e&&(o(""),l("text"),d([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let u=()=>{if(!s.trim())return;let h={name:s.trim(),type:c};c==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},p=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},x=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};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:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:m.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:I1.map(h=>jsxs("button",{onClick:()=>l(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:c===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:g("text-xs",c===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[h.type]})]},h.type))})]}),c==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${m.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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:g("p-2 rounded-lg transition-colors",a?"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:p,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"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:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsx("button",{onClick:u,disabled:!s.trim(),className:g("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 h0={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 w0={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 k0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,c]=useState(false),l=useRef(null),i=useRef(0),d=s==="es"?w0.es:w0.en;useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||l.current&&!l.current.contains(x.target)&&c(false);},f=x=>{x.key==="Escape"&&c(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),c(f=>!f);},className:g("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",u&&(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"}),d.filters,u&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("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:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsx("div",{className:"py-2",children:m.map(p=>{let f=e===p.value&&!t,x=()=>p.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"}):p.icon;return jsxs("button",{onClick:()=>{r(p.value),a(false),c(false);},className:g("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:g(f?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),c(false);},className:g("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:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function C0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function go(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function T0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",c=n==="financial";return jsxs("div",{className:g("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:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:c?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsx("button",{onClick:a,className:g("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"})})})]}),c&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let l=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=l-d,u=l>0?Math.round(m/l*100):0,p=l-i,f=l>0?Math.round(p/l*100):0,x=l>0?Math.min(Math.round(d/l*100),120):0,h=d>l&&l>0,b=h?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(l)})]}),(()=>{let y=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=v>0||w>0,P=(L,k)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:L}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(k)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(i)})]}),C&&jsxs(Fragment,{children:[P(o?"Mano de obra":"Labor",y),v>0&&P(o?"Activos":"Equipment",v),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=v>0||w>0,P=(L,k)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:L}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(k)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:go(d)})]}),C&&jsxs(Fragment,{children:[P(o?"Mano de obra":"Labor",y),v>0&&P(o?"Activos":"Equipment",v),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),l>0&&jsx("div",{className:g("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(x,100)}%`,backgroundColor:b}})}),i>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=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:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[p>=0?"+":"",go(p),l>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",f,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[m>=0?`+${go(m)} ${o?"disponible (caja)":"available (cash)"}`:`${go(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,l>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let l=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(l/i*100),100):0,p=(i>0?l/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:C0(l)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:C0(i)})]}),i>0&&jsx("div",{className:g("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:`${d}%`,backgroundColor:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:g("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:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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:g("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:g("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:g("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:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(l=>jsxs("button",{onClick:()=>s?.(l.id),className:g("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:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:l.name})]},l.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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 l=e.scheduleVarianceDays??0,i=l>0,d=l<0,m=e.scheduleVarianceLabel||(i?`+${l} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${l} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("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((l,i)=>{let d=l.utilizationPercent>=100?"#F87171":l.utilizationPercent>=80?"#FFD60A":l.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:l.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[l.utilizationPercent,"%"]})]}),jsx("div",{className:g("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(l.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${l.name}-${i}`)})})]})]})}var X1=[{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 L0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...L0(n.subtasks,t+1,s));}return a}function J1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),l=s.endDate.getTime()-o;if(l<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,l))/l*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function ws(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=ws(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function vs(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function Q1({value:e,onChange:t,isDark:r}){let[a,n]=useState(false),[s,o]=useState(String(e||""));return a?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:c=>c.stopPropagation(),onChange:c=>o(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(s);!isNaN(c)&&c>=0&&c<=100?t(c):s===""&&t(0),n(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:c=>{c.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function P0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let c of e){let l=c.weight||0;l>0&&(t+=(c.progress||0)*l,r+=l,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((c,l)=>c+(l.effort_minutes||0),0)>0){let c=0,l=0;for(let i of e){let d=i.effort_minutes||60;c+=(i.progress||0)*d,l+=d;}return Math.round(c/l*10)/10}let o=e.reduce((c,l)=>c+(l.progress||0),0);return Math.round(o/e.length*10)/10}function Ud(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Ud(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function A0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:c=[],customFields:l=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:f="en",customTranslations:x,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:v=true,allowColumnCustomization:w=true,allowColumnResize:C=true,enableContextMenu:P=true,showCreateTaskButton:L=false,onCreateTask:k,persistFilter:D=false,financialBlur:F,healthSidebar:E,lens:G="hours",hourlyRate:O=0,rateMap:ee,aggregateParentHours:I=false,showProjectTotals:Ae=false,totalsDollarOverride:H}=t,ge=ml(f,x),N=p==="dark",De=S=>{if(!ee||!S.assignees||S.assignees.length===0)return O;let J=0,me=0;for(let Ce of S.assignees){let We=Ce.id?ee[Ce.id]:void 0;if(We==null||We<=0)continue;let re=typeof Ce.estimatedMinutes=="number"?Ce.estimatedMinutes:0;re>0&&(J+=We*re,me+=re);}if(me>0)return J/me;let ve=S.assignees.map(Ce=>Ce.id?ee[Ce.id]:void 0).filter(Ce=>Ce!=null&&Ce>0);return ve.length===0?O:ve.reduce((Ce,We)=>Ce+We,0)/ve.length},Xe=S=>{let J=0,me=0,ve=0,Ce=We=>{for(let re of We)if(re.subtasks&&re.subtasks.length>0){let we={s:J,a:me,q:ve};if(Ce(re.subtasks),J-we.s+(me-we.a)+(ve-we.q)===0){let at=De(re);J+=(re.timeLoggedMinutes??0)/60*at,me+=(re.effortMinutes??0)/60*at,ve+=(re.soldEffortMinutes??0)/60*at;}}else {let we=De(re);J+=(re.timeLoggedMinutes??0)/60*we,me+=(re.effortMinutes??0)/60*we,ve+=(re.soldEffortMinutes??0)/60*we;}};return S.subtasks&&Ce(S.subtasks),{dollarSpent:J,dollarAllocated:me,dollarQuoted:ve}},He=useCallback(()=>{if(!D||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(D);if(S){let J=JSON.parse(S);return {statusFilter:J.statusFilter||"all",hideCompleted:J.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[D]),Y=useMemo(()=>{function S(J){let me=0,ve=0,Ce=0,We=0,re=0,we=0;for(let ze of J)if(ze.subtasks&&ze.subtasks.length>0){let at=S(ze.subtasks);if(at.spent+at.allocated+at.quoted>0)me+=at.spent,ve+=at.allocated,Ce+=at.quoted,We+=at.dollarSpent,re+=at.dollarAllocated,we+=at.dollarQuoted;else {let bt=ze.timeLoggedMinutes??0,mt=ze.effortMinutes??0,mr=ze.soldEffortMinutes??0;me+=bt,ve+=mt,Ce+=mr;let xr=De(ze);We+=bt/60*xr,re+=mt/60*xr,we+=mr/60*xr;}}else {let at=ze.timeLoggedMinutes??0,tt=ze.effortMinutes??0,bt=ze.soldEffortMinutes??0;me+=at,ve+=tt,Ce+=bt;let mt=De(ze);We+=at/60*mt,re+=tt/60*mt,we+=bt/60*mt;}return {spent:me,allocated:ve,quoted:Ce,dollarSpent:We,dollarAllocated:re,dollarQuoted:we}}return S(e)},[e]),Ee=useMemo(()=>{let S=new Map;function J(me){let ve=0;for(let Ce of me)if(Ce.subtasks&&Ce.subtasks.length>0){let We=J(Ce.subtasks);S.set(Ce.id,We),ve+=We;}else ve+=Ce.weight||0;return ve}return J(e),S},[e]),te=useMemo(()=>!E?.enabled||!E.data?E:{...E,data:{...E.data,totalHoursSpentMinutes:Y.spent,totalHoursAllocatedMinutes:Y.allocated}},[E,Y]),[Be,Se]=useState(true),[Le,$e]=useState(null),[Ye,le]=useState("position"),[Qe,je]=useState("asc"),[Ie,Ct]=useState(""),[it,qe]=useState(()=>He().statusFilter),[Pe,xt]=useState(()=>He().hideCompleted),[St,Re]=useState(y||X1),[ct,A]=useState(false),[X,B]=useState(false),[q,ce]=useState({isOpen:false,x:0,y:0,type:"task"}),[ue,_e]=useState(null),[V,ye]=useState(false),[Fe,Ue]=useState(null),[dt,Ze]=useState(null),[Tt,gt]=useState(null),rr=useRef(0),ar=useRef(false),Er=!!(r.onTaskMove||r.onTaskReparent),[_t,Mr]=useState(null),[Ft,Pr]=useState(null),Kt=S=>S==="assignees"||S==="teamLoad"?"assignees":S==="startDate"?"startDate":S==="endDate"?"endDate":null,qt=useRef([]),ea=useCallback((S,J)=>{Er&&(J.preventDefault(),rr.current=J.clientY,_e(S),ar.current=false,ye(false),gt({x:J.clientX,y:J.clientY}));},[Er]),pa=useCallback(S=>{if(!ue||(Math.abs(S.clientY-rr.current)>5&&!ar.current&&(ar.current=true,ye(true)),gt({x:S.clientX,y:S.clientY}),!ar.current))return;let me=document.querySelectorAll("[data-listview-row]"),ve=null,Ce=null;me.forEach(We=>{let re=We.getBoundingClientRect(),we=We.getAttribute("data-listview-row");if(we&&we!==ue&&S.clientY>=re.top&&S.clientY<=re.bottom){ve=we;let ze=S.clientY-re.top,at=re.height;Ce=ze<at*.25?"above":ze>at*.75?"below":"child";}}),Ue(ve),Ze(Ce);},[ue]),et=useCallback(()=>{if(ar.current&&ue&&Fe&&dt){if(dt==="child"&&r.onTaskReparent)r.onTaskReparent(ue,Fe);else if(dt==="above"||dt==="below"){let S=(ve,Ce,We=null)=>{for(let re of ve){if(re.id===Ce)return We;if(re.subtasks){let we=S(re.subtasks,Ce,re.id);if(we!==void 0)return we}}},J=S(e,ue,null),me=S(e,Fe,null);if(r.onTaskReparent){let ve=(at,tt)=>{if(tt===null)return at;for(let bt of at){if(bt.id===tt)return bt.subtasks||[];if(bt.subtasks){let mt=ve(bt.subtasks,tt);if(mt.length>0||bt.subtasks.some(mr=>mr.id===tt))return mt}}return []},Ce=ve(e,me??null),We=Ce.findIndex(at=>at.id===Fe),re=J===me,we=re?Ce.findIndex(at=>at.id===ue):-1,ze=dt==="below"?We+1:We;re&&we!==-1&&we<We&&(ze-=1),r.onTaskReparent(ue,me??null,Math.max(0,ze));}}}_e(null),Ue(null),Ze(null),gt(null),ar.current=false,ye(false);},[ue,Fe,dt,e,r]),Ke=(S,J)=>J==="assignees"?S.assignees:J==="startDate"?S.startDate:S.endDate,ha=(S,J,me,ve)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Ce=Array.from(document.querySelectorAll("[data-listview-row]")),We=Ce.map(Et=>Et.getAttribute("data-listview-row")||""),re=Math.max(0,We.indexOf(J)),we=Et=>We.slice(re,Et+1);Pr({sourceTaskId:J,column:me,sourceIndex:ve,targetIndex:ve,rangeIds:new Set([J])});let at=(Et=>{let Lt=Et?.parentElement??null;for(;Lt;){let Ta=window.getComputedStyle(Lt).overflowY;if((Ta==="auto"||Ta==="scroll")&&Lt.scrollHeight>Lt.clientHeight)return Lt;Lt=Lt.parentElement;}let Fr=document.scrollingElement;return Fr&&Fr.scrollHeight>Fr.clientHeight?Fr:null})(S.currentTarget),tt=Et=>{let Lt=re,Fr=false;Ce.forEach((Ta,ma)=>{let Yr=Ta.getBoundingClientRect();Et>=Yr.top&&Et<=Yr.bottom&&(Lt=ma,Fr=true);});let kr=Ce[Ce.length-1];if(!Fr&&kr){let Ta=kr.getBoundingClientRect();Et>Ta.bottom&&(Lt=Ce.length-1);}return Lt<re&&(Lt=re),Lt},bt=S.clientY,mt=null,mr=()=>{mt!==null&&(cancelAnimationFrame(mt),mt=null);},xr=()=>{let Et=tt(bt),Lt=new Set(we(Et));Pr(Fr=>Fr&&{...Fr,targetIndex:Et,rangeIds:Lt});},zr=()=>{if(mr(),!at)return;let Et=at,Fr=Et===document.scrollingElement?{top:0,bottom:window.innerHeight}:Et.getBoundingClientRect(),kr=60,Ta=12,ma=bt-Fr.top,Yr=Fr.bottom-bt,yo=Et.scrollHeight-Et.clientHeight;if(Yr<kr&&Et.scrollTop<yo){let Ns=Math.max(1,Math.round(Ta*(1-Math.max(0,Yr)/kr))),Fn=()=>{Et.scrollTop+=Ns,xr(),Et.scrollTop<Et.scrollHeight-Et.clientHeight&&(mt=requestAnimationFrame(Fn));};mt=requestAnimationFrame(Fn);}else if(ma<kr&&Et.scrollTop>0){let Ns=Math.max(1,Math.round(Ta*(1-Math.max(0,ma)/kr))),Fn=()=>{Et.scrollTop-=Ns,xr(),Et.scrollTop>0&&(mt=requestAnimationFrame(Fn));};mt=requestAnimationFrame(Fn);}},$t=Et=>{bt=Et.clientY,xr(),zr();},Wt=Et=>{window.removeEventListener("mousemove",$t),window.removeEventListener("mouseup",Wt),mr(),document.body.style.cursor="",document.body.style.userSelect="",Pr(null);let Lt=tt(Et.clientY),Fr=new Map(qt.current.map(Yr=>[Yr.id,Yr])),kr=Fr.get(J);if(!kr)return;let Ta=Ke(kr,me),ma=[];for(let Yr of we(Lt)){if(Yr===J)continue;let yo=Fr.get(Yr);yo&&(yo.subtasks&&yo.subtasks.length>0||ma.push(Yr));}ma.length>0&&r.onBulkFill?.(ma,me,Ta);};window.addEventListener("mousemove",$t),window.addEventListener("mouseup",Wt);},_r=S=>Ft?Ft.rangeIds.has(S):false;useEffect(()=>{if(ue)return document.addEventListener("mousemove",pa),document.addEventListener("mouseup",et),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",pa),document.removeEventListener("mouseup",et),document.body.style.cursor="",document.body.style.userSelect="";}},[ue,pa,et]);let[pr,Kr]=useState("all"),[sa,se]=useState(false),pe=useRef(null),ft=useRef(null),j=useMemo(()=>{let S=0;function J(me,ve){for(let Ce of me)ve>S&&(S=ve),Ce.subtasks?.length&&J(Ce.subtasks,ve+1);}return J(e,1),S},[e]);useEffect(()=>{if(!sa)return;let S=J=>{pe.current?.contains(J.target)||ft.current?.contains(J.target)||se(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[sa]),useEffect(()=>{if(pr==="all"){let me=function(ve){for(let Ce of ve)Ce.subtasks?.length&&(Ce.isExpanded===false&&r.onTaskToggleExpand?.(Ce.id),me(Ce.subtasks));};me(e);}else {let me=function(ve,Ce){for(let We of ve)if(We.subtasks?.length){let re=Ce<pr,we=We.isExpanded!==false;re!==we&&r.onTaskToggleExpand?.(We.id),me(We.subtasks,Ce+1);}};me(e,1);}},[pr]);let[fe,Q]=useState(null),[$,Z]=useState(0),[xe,T]=useState(0),U=useRef(null),[de,_]=useState(null),[ke,st]=useState(null);useEffect(()=>{y&&Re(S=>{if(S.length===y.length){let J=true;for(let me=0;me<S.length;me++){let ve=S[me],Ce=y[me];if(!ve||!Ce||ve.id!==Ce.id||ve.visible!==Ce.visible||ve.width!==Ce.width||ve.label!==Ce.label){J=false;break}}if(J)return S}return y});},[y]),useEffect(()=>{if(!(!D||typeof window>"u"))try{localStorage.setItem(D,JSON.stringify({statusFilter:it,hideCompleted:Pe}));}catch(S){console.error("Error persisting filter state:",S);}},[D,it,Pe]);let oe=useMemo(()=>{let S=new Set;function J(me){for(let ve of me)ve.subtasks?.length&&(ve.isExpanded!==false&&S.add(ve.id),J(ve.subtasks));}return J(e),S},[e]),rt=useMemo(()=>St.filter(S=>S.visible),[St]),pt=useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),Ut=useCallback(S=>{Ye===S?je(J=>J==="asc"?"desc":"asc"):(le(S),je("asc")),r.onSortChange?.({column:S,direction:Qe==="asc"?"desc":"asc"});},[Ye,Qe,r]),Qt=useCallback(S=>{Re(S),r.onColumnsChange?.(S);},[r]),ya=useCallback(S=>{let J=St.map(me=>me.id===S?{...me,visible:false}:me);Qt(J);},[St,Qt]),Wr=useCallback((S,J)=>{le(S),je(J);},[]),Ga=useCallback((S,J,me)=>{P&&(S.preventDefault(),ce({isOpen:true,x:S.clientX,y:S.clientY,type:J?"task":"header",task:J,columnId:me}));},[P]),lr=useCallback(()=>{ce(S=>({...S,isOpen:false}));},[]),Ba=useCallback((S,J)=>{if(!C)return;S.preventDefault(),S.stopPropagation();let me=St.find(ve=>ve.id===J);me&&(Q(J),Z(S.clientX),T(me.width));},[St,C]);useEffect(()=>{if(!fe)return;let S=St,J=ve=>{let Ce=ve.clientX-$,We=Math.max(50,xe+Ce);S=S.map(re=>re.id===fe?{...re,width:We}:re),Re(S);},me=()=>{r.onColumnsChange?.(S),Q(null);};return document.addEventListener("mousemove",J),document.addEventListener("mouseup",me),()=>{document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",me);}},[fe,$,xe,r]);let Wo=useCallback((S,J)=>{if(J==="name"){S.preventDefault();return}_(J),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",J),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),Pn=useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),_(null),st(null);},[]),_n=useCallback((S,J)=>{S.preventDefault(),J!=="name"&&(S.dataTransfer.dropEffect="move",st(J));},[]),zo=useCallback(()=>{st(null);},[]),gi=useCallback((S,J)=>{if(S.preventDefault(),!de||de===J||J==="name")return;let me=[...St],ve=me.findIndex(re=>re.id===de),Ce=me.findIndex(re=>re.id===J);if(ve===-1||Ce===-1)return;let We=me.splice(ve,1);We[0]&&(me.splice(Ce,0,We[0]),Qt(me),_(null),st(null));},[de,St,Qt]),qr=useCallback(async S=>{if(r.onCreateCustomField){let J={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(J);}B(false);},[r]),ho=useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),xa=useMemo(()=>{let S=L0(e);if(Ie.trim()){let J=Ie.toLowerCase();S=S.filter(me=>me.name.toLowerCase().includes(J));}if(it!=="all"){let J=new Set(S.filter(me=>ho(me)===it).flatMap(me=>me.parentPath));S=S.filter(me=>J.has(me.id));}if(Pe){let J=new Set(S.filter(me=>ho(me)!=="completed").flatMap(me=>me.parentPath));S=S.filter(me=>J.has(me.id));}return S.sort((J,me)=>{let ve,Ce;switch(Ye){case "name":ve=J.name.toLowerCase(),Ce=me.name.toLowerCase();break;case "startDate":ve=J.startDate?.getTime()||0,Ce=me.startDate?.getTime()||0;break;case "endDate":ve=J.endDate?.getTime()||0,Ce=me.endDate?.getTime()||0;break;case "progress":ve=J.progress||0,Ce=me.progress||0;break;case "status":ve=J.status||"todo",Ce=me.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};ve=We[J.priority]??4,Ce=We[me.priority]??4;break;case "position":return 0;default:return 0}return ve<Ce?Qe==="asc"?-1:1:ve>Ce?Qe==="asc"?1:-1:0}),S},[e,Ie,it,Pe,Ye,Qe,ho]);qt.current=xa;let en=useCallback((S,J)=>{let me=We=>{r.onTaskUpdate?.({...S,...We});},ve=We=>We?S.customFields?.find(we=>we.fieldId===We)?.value:void 0,Ce=(We,re)=>{if(!We)return;let ze=[...S.customFields||[]],at=ze.findIndex(tt=>tt.fieldId===We);at>=0?ze[at]={fieldId:We,value:re}:ze.push({fieldId:We,value:re}),me({customFields:ze});};switch(J.type){case "name":return null;case "status":return jsx(fg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:re=>{me({status:re,progress:re==="completed"?100:re==="in-progress"?50:0});},isDark:N,locale:f,translations:ge.status});case "priority":return jsx(hg,{value:S.priority,onChange:re=>me({priority:re}),isDark:N,locale:f});case "assignees":{let re=S.hasChildren,we=S.assignees||[];if(re&&S.subtasks?.length){let ze=new Map,at=tt=>{(tt||[]).forEach(bt=>{(bt.assignees||[]).forEach(mt=>{ze.has(mt.name)||ze.set(mt.name,mt);}),bt.subtasks?.length&&at(bt.subtasks);});};at(S.subtasks),we=Array.from(ze.values());}else re&&(we=[]);return jsx(bl,{value:we,availableUsers:c,onChange:ze=>me({assignees:ze}),isDark:N,locale:f,disabled:re})}case "startDate":return jsx(yl,{value:S.startDate,onChange:re=>me({startDate:re}),isDark:N,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsx(yl,{value:S.endDate,onChange:re=>me({endDate:re}),isDark:N,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let re=!!(S.subtasks&&S.subtasks.length>0),we=re?P0(Ud(S.subtasks||[])):S.progress||0;return jsx(Dg,{value:we,onChange:re?void 0:ze=>{let at=ze===100?"completed":ze>0?"in-progress":"todo";me({progress:ze,status:at});},isDark:N,disabled:re})}case "tags":return jsx(zg,{value:S.tags||[],isDark:N});case "text":return jsx(Mg,{value:ve(J.customFieldId)||"",onChange:re=>Ce(J.customFieldId,re),isDark:N});case "number":return jsx(Lg,{value:ve(J.customFieldId)||0,onChange:re=>Ce(J.customFieldId,re),isDark:N});case "date":let We=ve(J.customFieldId);return jsx(yl,{value:We?new Date(We):void 0,onChange:re=>Ce(J.customFieldId,re),isDark:N,locale:f});case "dropdown":return jsx(Ag,{value:ve(J.customFieldId)||"",options:J.options||[],onChange:re=>Ce(J.customFieldId,re),isDark:N});case "checkbox":return jsx(Rg,{value:ve(J.customFieldId)||false,onChange:re=>Ce(J.customFieldId,re),isDark:N});case "multiselect":return jsx(Bg,{value:ve(J.customFieldId)||[],options:J.options||[],onChange:re=>Ce(J.customFieldId,re),isDark:N,maxSelectable:J.maxSelectable});case "person":{let re=ve(J.customFieldId)||[];return jsx(bl,{value:re.map(we=>({name:we.name,avatar:we.avatar,initials:we.initials||(we.name||"?").slice(0,2).toUpperCase(),color:we.color||"#00E5CC"})),availableUsers:c,onChange:we=>Ce(J.customFieldId,we),isDark:N,locale:f})}case "file":return jsx(Hg,{value:ve(J.customFieldId),isDark:N,onOpen:re=>{re.url&&window.open(re.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let re=S.status==="completed"||S.progress===100;return jsx(Ia,{value:S.estimatedTime,onChange:we=>me({estimatedTime:we}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)})}case "quotedTime":{let re=S.status==="completed"||S.progress===100,we=F?.enabled&&(!F.columns||F.columns.includes("quotedTime"));return jsx(Ia,{value:S.quotedTime,onChange:ze=>me({quotedTime:ze}),isDark:N,locale:f,disabled:re,isBlurred:we,lens:G,hourlyRate:De(S)})}case "elapsedTime":{let re=S.status==="completed"||S.progress===100,we=S.executedDollarsCanonical;return jsx(Ia,{value:S.elapsedTime,onChange:ze=>me({elapsedTime:ze}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S),financialOverride:we})}case "effortMinutes":{if(I&&S.subtasks&&S.subtasks.length>0){let{allocated:tt}=ws(S);if(G==="financial"){let bt=Xe(S),mt=Math.round(bt.dollarAllocated),mr=Math.round(bt.dollarQuoted),xr=mr-mt;return jsxs("div",{className:"flex flex-col",children:[mt>0?jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",mt.toLocaleString("es-CO")]}):null,xr!==0&&mt>0&&mr>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xr>0?"+":"",Math.abs(xr)>=1e3?`$${(xr/1e3).toFixed(1)}K`:`$${xr}`]})]})}return jsx(Ia,{value:tt>0?tt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:O})}let re=S.status==="completed"||S.progress===100,we=S.effortMinutes||0,ze=S.soldEffortMinutes||0,at=De(S);if(G==="financial"&&at&&we>0&&ze>0){let tt=Math.round(we/60*at),mt=Math.round(ze/60*at)-tt;return jsxs("div",{className:"flex flex-col",children:[jsx(Ia,{value:we,onChange:mr=>me({effortMinutes:mr}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)}),mt!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",mt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[mt>0?"+":"",Math.abs(mt)>=1e3?`$${(mt/1e3).toFixed(1)}K`:`$${mt}`]})]})}return jsx(Ia,{value:we,onChange:tt=>me({effortMinutes:tt}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)})}case "timeLoggedMinutes":{let re=S.executedDollarsCanonical;if(I&&S.subtasks&&S.subtasks.length>0){let{spent:ze}=ws(S);return jsx(Ia,{value:ze>0?ze:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S),financialOverride:re})}let we=S.status==="completed"||S.progress===100;return jsx(Ia,{value:S.timeLoggedMinutes,onChange:r.onLogTime?ze=>{r.onLogTime?.(S,ze);}:void 0,isDark:N,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:we,lens:G,hourlyRate:De(S),financialOverride:re})}case "soldEffortMinutes":{if(I&&S.subtasks&&S.subtasks.length>0){let{quoted:ze}=ws(S),at=F?.enabled&&(!F.columns||F.columns.includes("soldEffortMinutes"));return jsx(Ia,{value:ze>0?ze:void 0,isDark:N,locale:f,disabled:true,isBlurred:at,lens:G,hourlyRate:De(S)})}let re=S.status==="completed"||S.progress===100,we=F?.enabled&&(!F.columns||F.columns.includes("soldEffortMinutes"));return jsx(Ia,{value:S.soldEffortMinutes,onChange:ze=>me({soldEffortMinutes:ze}),isDark:N,locale:f,disabled:re,isBlurred:we,lens:G,hourlyRate:De(S)})}case "scheduleVariance":{let re=S.effortMinutes||0,we=S.soldEffortMinutes||0,ze=S.timeLoggedMinutes||0,at=re>0||we>0||ze>0;return jsx(_g,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:N,locale:f,hasTimeAllocated:at})}case "hoursBar":{if(I&&S.hasChildren){let{spent:re,allocated:we,quoted:ze}=ws(S),at=re>we&&we>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",N?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",at?"text-[#FF453A]":N?"text-white/80":"text-gray-800"),children:vs(re)}),we>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:N?"text-white/60":"text-gray-600",children:vs(we)})]}),ze>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:N?"text-amber-400/70":"text-amber-600",children:vs(ze)})]})]})}return jsx(qg,{task:S,isDark:N,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:G,hourlyRate:De(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsx(Xg,{task:S,isDark:N,locale:f}):jsx(bl,{value:S.assignees||[],availableUsers:c,onChange:we=>{r.onTaskUpdate?.({...S,assignees:we});},isDark:N,locale:f});case "blockers":return jsx(Qg,{blockers:S.blockers,isDark:N,locale:f});case "weight":{let re=Ee.get(S.id);if(re!==void 0)return jsx("span",{className:g("text-xs font-mono",re>0?N?"text-white/50":"text-gray-400":N?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?`${Number(re.toFixed(2))}%`:"\u2014"});let we=S.weight||0;return jsx(Q1,{value:we,onChange:ze=>me({weight:ze}),isDark:N})}default:return jsx("span",{className:g("text-sm",N?"text-white/60":"text-gray-500"),children:"-"})}},[r,N,f,c,ge,I,Ee]),tn=useCallback(S=>{let me={name:ge.columns.name,status:ge.columns.status,priority:ge.columns.priority,assignees:ge.columns.assignees,startDate:ge.columns.startDate,endDate:ge.columns.endDate,progress:ge.columns.progress,tags:ge.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:ge.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:ge.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:ge.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:ge.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:ge.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:ge.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:ge.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:ge.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:ge.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:ge.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:ge.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof me=="string"?me:String(me||S.type)},[ge,f]),Kn=useMemo(()=>{let me=rt.reduce((Ce,We)=>Ce+We.width,0)+(w?48:0),ve={};for(let Ce of rt)ve[Ce.id]=`${Ce.width/me*100}%`;return ve},[rt,w]);return a?jsx("div",{className:g("flex-1 flex items-center justify-center",N?"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:g("text-sm",N?"text-white/60":"text-gray-600"),children:[ge.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",N?"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:g("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",N?"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:g("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:ge.empty.noTasks}),jsx("p",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:ge.empty.addFirstTask})]})}):jsxs("div",{ref:U,className:g(N?"bg-[#0D0D0D]":"bg-white",fe&&"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:g("flex-shrink-0 px-6 py-4 border-b",N?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:[xa.length," ",ge.pagination.tasks]}),h&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",N?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Ie,onChange:S=>Ct(S.target.value),placeholder:ge.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",N?"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&&j>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:pe,onClick:()=>se(!sa),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",N?sa?"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]":sa?"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"}),pr==="all"?f==="es"?"Todos":"All":`L${pr}`]}),sa&&jsx("div",{ref:ft,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",N?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(j,5)},(S,J)=>({value:J+1,label:`L${J+1}`}))].map(S=>jsxs("button",{onClick:()=>{Kr(S.value),se(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",N?pr===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":pr===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:S.label}),pr===S.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsx(k0,{value:it,hideCompleted:Pe,onChange:qe,onHideCompletedChange:xt,isDark:N,locale:f}),te?.enabled&&te.data&&!Be&&jsx("button",{onClick:()=>Se(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",N?"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,L&&k&&jsxs(motion.button,{onClick:k,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:ge.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:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",N?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Er&&jsx("div",{className:"w-5 flex-shrink-0"}),rt.map(S=>{let J=S.id!=="name",me=ke===S.id&&de!==S.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",N?"text-white/60":"text-gray-500",J&&"cursor-grab",S.type!=="name"&&"justify-center",de===S.id&&"opacity-50",me&&(N?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Kn[S.id],minWidth:S.minWidth},draggable:J,onDragStart:J?ve=>Wo(ve,S.id):void 0,onDragEnd:J?Pn:void 0,onDragOver:J?ve=>_n(ve,S.id):void 0,onDragLeave:J?zo:void 0,onDrop:J?ve=>gi(ve,S.id):void 0,onContextMenu:ve=>Ga(ve,void 0,S.id),children:[J&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",N?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxs("button",{draggable:false,onClick:ve=>{let Ce=ve.currentTarget.getBoundingClientRect();d(S.id,Ce);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[tn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),Ye===S.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxs("button",{draggable:false,onClick:()=>Ut(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[tn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",Ye===S.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[tn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),C&&S.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",fe===S.id&&"bg-[#00E5CC]"),onMouseDown:ve=>Ba(ve,S.id)})]},S.id)}),w&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:S=>{S.stopPropagation(),A(J=>!J);},className:g("p-0.5 rounded transition-colors",N?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ct&&(N?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(f0,{isOpen:ct,onClose:()=>A(false),columns:St,customFields:l,onColumnsChange:Qt,onCreateCustomField:()=>{A(false),B(true);},isDark:N,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:xa.map((S,J)=>{let me=oe.has(S.id),ve=Math.min(J*.01,.2),Ce=S.hasChildren&&S.level===0,We=S.subtasks?.length||0;if(Ce){let{spent:bt,allocated:mt,quoted:mr}=ws(S),xr=J1(S);return jsxs(motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",N?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Le===S.id&&(N?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[Er&&jsx("div",{className:"w-5 flex-shrink-0"}),rt.map(zr=>jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",zr.type!=="name"&&"justify-center"),style:{width:Kn[zr.id],minWidth:zr.minWidth},children:zr.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:$t=>{$t.stopPropagation(),pt(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",N?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsx(ChevronDown,{className:g("w-4 h-4",N?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",N?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:$t=>{$t.stopPropagation(),pt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:me?jsx(FolderOpen,{className:"w-4 h-4",style:{color:N?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:N?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:N?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",N?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxs("span",{className:g("text-[10px] font-mono",N?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),xr!==null&&v&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",xr>=1?"text-[#32D74B] bg-[#32D74B]/10":xr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",xr.toFixed(2)]})]})]}):zr.type==="timeLoggedMinutes"?G==="financial"?(()=>{let $t=S.executedDollarsCanonical,Wt=$t!=null?Math.round($t):Math.round(Xe(S).dollarSpent);return Wt>0?jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("en-US")]}):null})():jsx(Ia,{value:bt>0?bt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):zr.type==="soldEffortMinutes"?G==="financial"?(()=>{let $t=Xe(S),Wt=Math.round($t.dollarQuoted);return Wt>0?jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("en-US")]}):null})():jsx(Ia,{value:mr>0?mr:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):zr.type==="effortMinutes"?G==="financial"?(()=>{let $t=Xe(S),Wt=Math.round($t.dollarAllocated),Et=Math.round($t.dollarQuoted),Lt=Et-Wt;return jsxs("div",{className:"flex flex-col",children:[Wt>0?jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("es-CO")]}):null,Lt!==0&&Wt>0&&Et>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lt>0?"+":"",Math.abs(Lt)>=1e3?`$${(Lt/1e3).toFixed(1)}K`:`$${Lt}`]})]})})():jsx(Ia,{value:mt>0?mt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):en(S,zr)},zr.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let re=ue===S.id,we=Fe===S.id,ze=we&&dt==="above",at=we&&dt==="below",tt=we&&dt==="child";return jsxs(motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:g("flex items-center border-b transition-colors relative group",N?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Le===S.id&&(N?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:re?.4:1,backgroundColor:tt?N?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:tt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:bt=>Ga(bt,S),onMouseEnter:()=>Mr(S.id),onMouseLeave:()=>Mr(bt=>bt===S.id?null:bt),children:[ze&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Er&&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:bt=>ea(S.id,bt),style:{color:N?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),rt.map(bt=>{let mt=!!(S.subtasks&&S.subtasks.length>0),mr=Kt(bt.type),zr=!!mr&&!mt&&_t===S.id&&!Ft,$t=!!Ft&&!!mr&&Ft.column===mr&&_r(S.id);return jsxs("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",bt.type!=="name"&&"justify-center"),style:{width:Kn[bt.id],minWidth:bt.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:[bt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsx("button",{onClick:Wt=>{Wt.stopPropagation(),pt(S.id);},className:g("p-0.5 rounded flex-shrink-0",N?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsx(ChevronDown,{className:g("w-4 h-4",N?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",N?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",N?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsx("span",{className:g("text-[10px] font-mono",N?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?N?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?N?"text-white":"text-gray-900":N?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):en(S,bt),zr&&mr&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Wt=>ha(Wt,S.id,mr,J),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}})]},bt.id)}),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),Ae&&xa.length>0&&(()=>{let{spent:S,allocated:J,quoted:me}=Y,ve=J-S,Ce=ve<0,We=Ce?`+${vs(Math.abs(ve))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${vs(ve)} ${f==="es"?"AHORRADO":"SAVED"}`,re=G==="financial"&&O>0,we=H?.breakdown,ze=!!we&&((we.equipment??0)>0||(we.travel??0)>0),at=we?.laborSpent!=null?we.laborSpent:H?.spent!=null?H.spent:Y.dollarSpent,tt=we?.laborAllocated!=null?we.laborAllocated:H?.allocated!=null?H.allocated:Y.dollarAllocated,bt=H?.quoted!=null?H.quoted:Y.dollarQuoted,mt=($t,Wt)=>{if(re){let Et=Wt??$t/60*O;return `$${Math.round(Et).toLocaleString("es-CO")}`}return vs($t)},mr=re?Math.abs(tt-at):0,xr=re?`+$${mr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ce?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,zr=re&&ze?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",N?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:N?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Er&&jsx("div",{className:"w-5 flex-shrink-0"}),rt.map($t=>jsx("div",{className:g("flex items-center px-4 py-3",$t.type!=="name"&&"justify-center"),style:{width:Kn[$t.id],minWidth:$t.minWidth},children:$t.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),zr&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",N?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),zr]})]}):$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:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(S,re?at:void 0)}),jsx("span",{className:g("text-[11px]",N?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",N?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(J,re?tt:void 0)})]}),J>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ce?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:re?xr:We})]}):$t.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?mt(me,re?bt:void 0):"\u2013"}):$t.type==="effortMinutes"?(()=>{if(re&&me>0&&J>0){let Wt=Math.round(bt),Et=Math.round(tt),Lt=Wt-Et,Fr=Wt>0?Math.round(Lt/Wt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(J,tt)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lt>=0?"+":"",Math.abs(Lt)>=1e3?`$${(Lt/1e3).toFixed(1)}K`:`$${Lt}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Fr,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:J>0?mt(J,re?tt:void 0):"\u2013"})})():$t.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?mt(S,re?at:void 0):"\u2013"}):$t.type==="progress"?(()=>{let Wt=P0(Ud(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",N?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Wt,"%"]})})():$t.type==="weight"?(()=>{let Wt=e||[],Et=[],Lt=ma=>{for(let Yr of ma)Et.push(Yr),Yr.subtasks?.length&&Lt(Yr.subtasks);};Lt(Wt);let kr=Et.filter(ma=>!ma.subtasks?.length||ma.subtasks.length===0).reduce((ma,Yr)=>ma+(Yr.weight||0),0),Ta=Math.abs(kr-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Ta?N?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(kr.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",N?"text-white/30":"text-gray-300"),children:"\u2013"})},$t.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),xa.length===0&&Ie&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",N?"text-white/30":"text-gray-400")}),jsx("p",{className:g(N?"text-white/60":"text-gray-600"),children:ge.empty.noResults})]})})]})}),te?.enabled&&te.data&&Be&&jsx(T0,{data:te.data,isDark:N,locale:f,onClose:()=>Se(false),lens:t?.lens,onUnassignedTaskClick:S=>{let J=document.querySelector(`[data-task-id="${S}"]`);J&&(J.scrollIntoView({behavior:"smooth",block:"center"}),$e(S),setTimeout(()=>$e(null),2e3));}})]}),jsx(o0,{state:q,onClose:lr,isDark:N,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:ya,onColumnSort:Wr,availableUsers:c,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),V&&Tt&&ue&&createPortal(jsx("div",{style:{position:"fixed",left:Tt.x+12,top:Tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let J=Te.flattenTasks(e).find(me=>me.id===ue);return J?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:N?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${N?"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:N?"#e6edf3":"#111827"},children:J.name})]}):null})()}),document.body),jsx(y0,{isOpen:X,onClose:()=>B(false),onSave:qr,isDark:N,locale:f})]})}var I0=[{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}],R0=[{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"}],B0=[{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 Wd={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"},zd={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"},Gd={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"},Sl={dark:Wd,light:zd,neutral:Gd};function $0(e){return Sl[e]||Sl.dark}function El(e,t,r,a,n=5){let s=[],o=[],c=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,f)=>p.startSerial-f.startSerial||f.endSerial-p.endSerial);for(let p of c){let f=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(x<b||f>y));)h++;(s[h]=s[h]||[]).push([f,x]),o.push({t:p,s:f,e:x,lane:h,contL:p.startSerial<r,contR:p.endSerial>a});}let l={};for(let p=r;p<=a;p++)l[p]=new Set;o.forEach(p=>{for(let f=p.s;f<=p.e;f++)l[f].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let f=+p,x=m[f],h=[];for(let b=0;b<n;b++)l[f].has(b)||h.push(b);if(x.length<=h.length)x.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);x.slice(0,b).forEach((y,v)=>i.push({it:y,day:f,lane:h[v]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var Z1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],eC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function O0(e){return e==="es"?Z1:eC}function H0(e){return (e.getDay()+6)%7}function U0(e,t){let r=new Date(e,t,1),a=H0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},c=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},l=c(r),i=new Date(e,t+1,0),d=c(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:c,monthStartSerial:l,monthEndSerial:d}}function oi(e,t){return H0(e.serialToDate(t))>=5}function tC(e){let t=[],r=(a,n,s)=>{for(let o of a){let c=n||o.id,l=s||o.name;t.push({t:o,phaseId:c,phaseName:l}),o.subtasks?.length&&r(o.subtasks,c,l);}};return r(e,"",""),t}function W0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function z0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Ml(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=tC(t),c=42,l=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=W0(d.startDate),f=W0(d.endDate);if(!p||!f)continue;let x=r.dateToSerial(p),h=r.dateToSerial(f);if(h<1||x>c)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?z0(v):z0(y*n),C=d.assignees?.[0],P=C?.initials||(C?.name?nC(C.name):void 0),L=d.displayId||d.wbsCode||"",k=aC(L||d.id)?"":L||d.id;l.push({uid:d.id,id:k,name:d.name,projectId:s,startSerial:Math.max(x,1),endSerial:Math.min(h,c),hrs:y,cost:w,critical:!!d.isCriticalPath,who:P,realStart:p,realEnd:f,phaseId:m,phaseName:u});}let i=[];return {calTasks:l,dayItems:i,isEmpty:l.length===0&&i.length===0}}var rC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function aC(e){return rC.test(e)||/^task-\d+/.test(e)}function nC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var oC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],sC=["January","February","March","April","May","June","July","August","September","October","November","December"];function G0(e,t,r){return `${(r==="es"?oC:sC)[t]} ${e}`}var Vd=26,iC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Pl({locale:e}){let t=O0(e);return jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Fl({bar:e,ws:t,money:r,projColor:a,slotH:n=Vd}){let{t:s}=e,o=e.s-t,c=e.e-e.s+1,l="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${c}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:l,style:d,children:[s.critical&&c>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),c>=3?jsx("span",{className:"val",children:i}):null]})}function Ll({chip:e,ws:t,slotH:r=Vd}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:iC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Al({more:e,ws:t,slotH:r=Vd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function V0({projects:e}){return jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var uC=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function j0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[s,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:uC.map(o=>jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function _0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:c,phaseFilter:l="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,f]=useState(false),x=useRef(null),h=d==="es";useEffect(()=>{if(!p)return;let y=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let b=l==="all"?h?"Todas":"All":c?.find(y=>y.id===l)?.name??(h?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),c&&c.length>0&&i?jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:l!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),c.map(y=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,m,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var pC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function K0({off:e,onToggle:t}){let r=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:pC.map(a=>{let n=r.includes(a.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:a.nm}),jsx("div",{className:"sub",children:a.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var fC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},bC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function Y0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=useRef(null);useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let c=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${c} elementos`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",c," ",c===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:bC[d.type]},children:fC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var q0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function X0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=q0[r]||q0.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:n.title}),jsxs("p",{children:[n.body,jsx("br",{}),jsx("b",{children:e})]}),a?jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function Q0(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function xC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var J0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function vC(e){return J0[e%J0.length]}function wC(e){return e>1?"over":e>=.9?"warn":"ok"}var jd="\xA0";function Ro(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function Z0(e,t,r){let a=new Map,n=new Set;for(let c of t)c.isWeekend||c.isHoliday||n.add(Q0(c.date));if(n.size===0)return a;let s=new Map;e.forEach((c,l)=>{s.set(c.userId,{color:vC(l),initials:xC(c.name)});});let o=new Map;for(let c of e)for(let l of c.dailyEstimated){if(!l.date||!n.has(l.date))continue;o.has(l.date)||o.set(l.date,new Map);let i=o.get(l.date);i.set(c.userId,(i.get(c.userId)??0)+(l.hours||0));}for(let c of n){let l=o.get(c)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((l.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(c,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function ef({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=Q0(n.date),o=n.isWeekend||n.isHoliday,c=o?void 0:t.get(s),l=!!c&&c.capacity>0,i=l?c.assigned/c.capacity:0,m="cal-cap-cell "+(o?"off":wC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:m,role:l&&a?"button":void 0,tabIndex:l&&a?0:void 0,title:o?void 0:u,onClick:p=>{!l||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!l||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsx("div",{className:"nums",children:o||!l?jsx("span",{children:o?"\u2014":`0h${jd}/${jd}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Ro(c.assigned),"h"]}),jsxs("span",{children:["/",jd,Ro(c.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:l?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function tf({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=useRef(null);useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),c=o>0&&s>o,l=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:c?{color:"var(--red)"}:void 0,children:[Ro(s),"h asignadas / ",Ro(o),"h"]}),c?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Ro(l),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Ro(i.hours),"h / ",Ro(i.capacity),"h"]})]},i.name)})})]})}var _d=28,CC=182;function af({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:c,capRows:l,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=c==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxs("div",{style:{display:"contents"},children:[jsx(TC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),l&&l[x]?jsx(ef,{days:l[x].days,capByDay:l[x].capByDay,onSelectDay:u}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,onTaskOpen:l,onMore:i}){let d=useMemo(()=>El(a,n,t,r),[a,n,t,r]),m=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),u=[];for(let f=t;f<=r;f++)u.push(f);let p={height:`${CC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:p,children:[jsx("div",{className:"cal-week-bg",children:u.map(f=>{let x=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return oi(e,f)&&(b+=" wknd"),h||(b+=" out"),f===c&&(b+=" today"),m.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsx("div",{onClick:()=>l?.(f.t.uid),style:{cursor:l?"pointer":"default",display:"contents"},children:jsx(Fl,{bar:f,ws:t,money:s,projColor:o,slotH:_d})},`b${x}`)),d.chips.map((f,x)=>jsx(Ll,{chip:f,ws:t,slotH:_d},`c${x}`)),d.more.map((f,x)=>jsx(Al,{more:f,ws:t,slotH:_d,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${x}`))]})]})}var NC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DC(e){return NC.test(e)||/^task-\d+/.test(e)}function SC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function nf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function EC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function of(e,t){let r=EC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,c=n.costAtCompletion,l=c!=null?nf(c):nf(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?SC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=DC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:l,who:d,projColor:n.color});}return a}function sf({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(s.taskId));},children:[jsxs("div",{className:"row1",children:[s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsx("div",{className:"nom",children:s.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsx("span",{children:o}),s.who?jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function lf({onExpand:e}){return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Cs(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function cf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:c}){let l=useRef(null),i=n==="es";useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${Cs(r.oldProjectEnd,n)} \u2192 ${Cs(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:l,className:"cal-pop",style:{width:"324px",zIndex:60,...c},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[Cs(r.oldStart,n)," \u2013 ",Cs(r.oldEnd,n)," \u2192 ",jsxs("b",{children:[Cs(r.newStart,n)," \u2013 ",Cs(r.newEnd,n)]})]})]}),d?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var LC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function df({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:c}){let l=o==="es",i=useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,f)=>p.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:l?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:l?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(l?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${l?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxs("button",{type:"button",onClick:()=>c?.(u.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:n,flex:"none"}}),u.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,u.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:LC[u.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function AC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Il(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Kd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function uf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Il(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,c=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Il(d).filter(f=>r.has(f)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of m){let x=c(f);x>u&&(u=x);}let p=Kd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)c(i.id);let l=0;return s.forEach(i=>{i>l&&(l=i);}),{finish:s,start:n,projectEnd:l}}function pf(e,t,r){let a=new Map(e.map(l=>[l.id,l])),n=new Map;for(let l of e)for(let i of Il(l))n.has(i)||n.set(i,[]),n.get(i).push(l.id);let s=new Map,o=[...e].sort((l,i)=>(t.get(i.id)??0)-(t.get(l.id)??0));for(let l of o){let i=n.get(l.id)??[];if(i.length===0)s.set(l.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-Kd(p)*864e5));}s.set(l.id,d===1/0?r:d);}}let c=new Set;for(let l of e){let i=(s.get(l.id)??0)-(t.get(l.id)??0);Math.abs(i)<864e5/2&&Il(l).length+(n.get(l.id)?.length??0)>0&&c.add(l.id);}return c}function Rl(e,t,r,a){let n=AC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),c=new Date(s.endDate),l=uf(n,new Map),i=pf(n,l.finish,l.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=uf(d,new Map([[t,r.getTime()]])),u=pf(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=l.start.get(b.id),v=m.start.get(b.id);if(y!=null&&v!=null&&Math.abs(v-y)>=864e5/2){let w=Kd(p.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-l.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((l.projectEnd-(l.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:c,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(l.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function mf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var BC=132,Bl=26,$C="#5B7FD4";function gf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:c,onMoneyChange:l,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:u,canReschedule:p,onReschedule:f,members:x=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[v,w]=useState("mes"),[C,P]=useState(()=>{let V=new Date,ye={y:V.getFullYear(),m:V.getMonth()},Fe=(e??[]).map(Ze=>Ze.startDate?new Date(Ze.startDate):null).filter(Ze=>!!Ze&&!isNaN(Ze.getTime()));if(Fe.length===0||(e??[]).some(Ze=>{let Tt=Ze.startDate?new Date(Ze.startDate):null,gt=Ze.endDate?new Date(Ze.endDate):Tt;if(!Tt||isNaN(Tt.getTime()))return false;let rr=new Date(ye.y,ye.m,1),ar=new Date(ye.y,ye.m+1,0,23,59,59);return Tt<=ar&&(gt??Tt)>=rr}))return ye;let dt=Fe.reduce((Ze,Tt)=>Ze<Tt?Ze:Tt);return {y:dt.getFullYear(),m:dt.getMonth()}}),[L,k]=useState(false),[D,F]=useState([]),[E,G]=useState("all"),[O,ee]=useState(null),[I,Ae]=useState(null),[H,ge]=useState(false),[N,De]=useState(null),[Xe,He]=useState(false),Y=useMemo(()=>U0(C.y,C.m),[C.y,C.m]),Ee=a||$C,te=useMemo(()=>{let V=new Set;for(let ye of h){let Fe=new Date(`${ye}T12:00:00`),Ue=Y.dateToSerial(Fe);Ue>=1&&Ue<=42&&V.add(Ue);}return V},[h,Y]);useEffect(()=>{y?.({start:mf(Y.serialToDate(1)),end:mf(Y.serialToDate(42))});},[C.y,C.m]);let Be=x.length,Se=useMemo(()=>{let V=b?.hoursPerDay;if(!V)return 8;let ye=[V.monday,V.tuesday,V.wednesday,V.thursday,V.friday].map(Fe=>Fe||0).filter(Fe=>Fe>0);return ye.length?Math.round(ye.reduce((Fe,Ue)=>Fe+Ue,0)/ye.length*10)/10:8},[b]),Le=useMemo(()=>Ml({tasks:e,grid:Y,projectColor:()=>Ee,hourlyRate:o,projectId:r}),[e,Y,Ee,o,r]),$e=useMemo(()=>{if(d===false)return [];let V=new Map;for(let ye of Le.calTasks)ye.phaseId&&ye.phaseName&&V.set(ye.phaseId,ye.phaseName);return [...V.entries()].map(([ye,Fe])=>({id:ye,name:Fe})).sort((ye,Fe)=>ye.name.localeCompare(Fe.name))},[Le.calTasks,d]),Ye=!D.includes("tareas"),le=!D.includes("cpm"),Qe=useMemo(()=>{let V=Ye?Le.calTasks:[];return E!=="all"&&(V=V.filter(ye=>ye.phaseId===E)),le||(V=V.map(ye=>ye.critical?{...ye,critical:false}:ye)),V},[Le.calTasks,Ye,le,E]),je=useMemo(()=>{let V=new Set;return D.includes("hitos")&&(V.add("hito"),V.add("desembolso")),D.includes("ext")&&V.add("ext"),D.includes("aus")&&V.add("aus"),Le.dayItems.filter(ye=>!V.has(ye.type))},[Le.dayItems,D]),Ie=!D.includes("festivos"),Ct=new Date,it=Y.dateToSerial(new Date(Ct.getFullYear(),Ct.getMonth(),Ct.getDate())),qe=V=>F(ye=>ye.includes(V)?ye.filter(Fe=>Fe!==V):[...ye,V]),Pe=()=>P(V=>{let ye=new Date(V.y,V.m-1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),xt=()=>P(V=>{let ye=new Date(V.y,V.m+1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),St=()=>{let V=new Date;P({y:V.getFullYear(),m:V.getMonth()});},Re=(V,ye,Fe)=>{if(!p||ye===0)return;let Ue=Le.calTasks.find(rr=>rr.uid===V);if(!Ue)return;let dt=ye*864e5,Ze=new Date(Ue.realStart.getTime()+dt),Tt=new Date(Ue.realEnd.getTime()+dt),gt=Rl(e,V,Ze,Tt);gt&&De({uid:V,taskId:Ue.id,taskName:Ue.name,sim:gt,anchor:Fe});},ct=async()=>{if(!N||!f)return;He(true);let V=[{id:N.uid,startDate:N.sim.newStart,endDate:N.sim.newEnd},...N.sim.movedSuccessors.map(Fe=>({id:Fe.id,startDate:Fe.newStart,endDate:Fe.newEnd}))],ye=await f(V);He(false),ye&&De(null);},A=G0(C.y,C.m,n),X=[{id:"",name:t,color:Ee}],B=useMemo(()=>of(e,o),[e,o]),q=useMemo(()=>{if(v==="lookahead"){let V=Y.weeks.find(Fe=>it>=Fe.ws&&it<=Fe.we)??Y.weeks[0],ye=Y.weeks.indexOf(V);return Y.weeks.slice(ye,ye+2)}return v==="semana"?[Y.weeks.find(ye=>it>=ye.ws&&it<=ye.we)??Y.weeks[0]]:[]},[v,Y.weeks,it]),ce=useMemo(()=>{let V={};return q.forEach((ye,Fe)=>{let Ue=[];for(let Ze=ye.ws;Ze<=ye.we;Ze++)Ue.push({serial:Ze,date:Y.serialToDate(Ze),isWeekend:oi(Y,Ze),isHoliday:te.has(Ze)});let dt=Z0(x,Ue,Se);V[Fe]={days:Ue,capByDay:dt};}),V},[q,Y,te,x,Se]),ue=v==="semana"||v==="lookahead",_e=v==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsx(j0,{view:v,onViewChange:w,money:c==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:V=>l(V==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsx(_0,{monthLabel:A,onPrev:Pe,onNext:xt,onToday:St,layersOpen:L,onToggleLayers:()=>k(V=>!V),layersOff:D,phases:$e,phaseFilter:E,onPhaseChange:G,locale:n,children:L?jsx(K0,{off:D,onToggle:qe}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:_e?"hidden":void 0},children:[_e?jsx(df,{grid:Y,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,locale:n,onTaskOpen:i}):ue?jsxs(Fragment,{children:[jsx(Pl,{locale:n}),jsx(af,{grid:Y,weeks:q,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,locale:n,capRows:ce,teamSize:Be,onTaskOpen:i,onMore:(V,ye,Fe)=>ee({day:V,items:ye,tasks:Fe}),onCapDay:(V,ye,Fe)=>{for(let Ue of Object.keys(ce)){let dt=ce[+Ue].capByDay.get(V);if(dt){Ae({dayLabel:ye,perPerson:dt.perPerson,anchor:Fe.getBoundingClientRect()});break}}}})]}):Le.isEmpty?jsxs(Fragment,{children:[jsx(Pl,{locale:n}),jsx("div",{className:"cal-weeks",children:Y.weeks.map(V=>jsx(ff,{grid:Y,ws:V.ws,we:V.we,todaySerial:it,showFestivos:Ie,holidaySerials:te,locale:n,deadlineDays:new Set},V.ws))}),jsx(X0,{monthLabel:A,locale:n,onCreateTask:u})]}):jsxs(Fragment,{children:[jsx(Pl,{locale:n}),jsx("div",{className:"cal-weeks",children:Y.weeks.map(V=>jsx(OC,{grid:Y,ws:V.ws,we:V.we,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,showFestivos:Ie,holidaySerials:te,locale:n,onTaskOpen:i,onMore:(ye,Fe,Ue)=>ee({day:ye,items:Fe,tasks:Ue}),canReschedule:p,onDragReschedule:Re,pendingGhost:N?{uid:N.uid,days:Math.round((N.sim.newStart.getTime()-N.sim.oldStart.getTime())/864e5)}:null},V.ws))})]}),O?jsx(Y0,{dayLabel:`${Y.serialToDate(O.day).getDate()}`,items:O.items,tasks:O.tasks.map(V=>({swatch:Ee,taskId:V.id,label:V.name,critical:V.critical,value:c==="$"?V.cost:`${V.hrs}h`})),onClose:()=>ee(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,I?jsx(tf,{dayLabel:I.dayLabel,perPerson:I.perPerson,onClose:()=>Ae(null),style:{position:"fixed",top:`${I.anchor.top-8}px`,left:`${I.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,N?jsx(cf,{taskName:N.taskName,taskId:N.sim.taskId,sim:N.sim,busy:Xe,locale:n,onConfirm:ct,onCancel:()=>De(null),style:{position:"fixed",top:`${N.anchor.top+12}px`,left:`${Math.min(N.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),H?jsx(sf,{items:B,money:c,projColor:Ee,onItemClick:V=>i?.(V),onCollapse:()=>ge(false)}):jsx(lf,{onExpand:()=>ge(true)})]}),jsx(V0,{projects:X})]})}function ff({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let c=[];for(let l=t;l<=r;l++)c.push(l);return jsx("div",{className:"cal-week-bg",children:c.map(l=>{let i=e.serialToDate(l),d=l>=e.monthStartSerial&&l<=e.monthEndSerial,m=n&&s.has(l),u="cal-day";return oi(e,l)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),l===a&&(u+=" today"),o.has(l)&&(u+=" deadline-day"),jsxs("div",{className:u,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},l)})})}function OC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:f,pendingGhost:x}){let h=useMemo(()=>El(a,n,t,r),[a,n,t,r]),b=useMemo(()=>new Set(n.filter(L=>L.type==="deadline").map(L=>L.serial)),[n]),y=Math.max(BC,h.laneCount*Bl+36),v=useRef(null),[w,C]=useState(null),P=(L,k)=>{if(!p||!f){m?.(k);return}L.preventDefault();let D=v.current;if(!D)return;let F=D.getBoundingClientRect().width/7,E=L.clientX,G=0,O=I=>{let Ae=Math.round((I.clientX-E)/F);G=Ae,C({id:k,days:Ae});},ee=I=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",ee),C(null),G===0){m?.(k);return}let Ae=new DOMRect(I.clientX,I.clientY,0,0);f(k,G,Ae);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",ee);};return jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${y}px`},children:[jsx(ff,{grid:e,ws:t,we:r,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[h.bars.map((L,k)=>{let D=w?.id===L.t.uid?w.days:null,F=x?.uid===L.t.uid?x.days:null,E=D??F??0,G=D==null&&F!=null,O=E!==0?{...L,s:L.s+E,e:L.e+E}:L;return jsx("div",{onPointerDown:ee=>P(ee,L.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:G?.6:1},children:jsx(Fl,{bar:O,ws:t,money:s,projColor:o,slotH:Bl})},`b${k}`)}),h.chips.map((L,k)=>jsx(Ll,{chip:L,ws:t,slotH:Bl},`c${k}`)),h.more.map((L,k)=>jsx(Al,{more:L,ws:t,slotH:Bl,onClick:()=>u(L.day,L.items,a.filter(D=>D.startSerial<=L.day&&D.endSerial>=L.day))},`m${k}`))]})]})}function UC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:c}){let[l,i]=useState(false),d=useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=useMemo(()=>{let p=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:f,priorities:x,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:u,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:g("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"]})]}),l&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:p=>{p.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:d.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:d.map(p=>jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsx("h4",{children:p.title}),p.description&&jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,p.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"})]})})]},p.id))})})]})}var hf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ii(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 li(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 yf(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 xf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:c}){let l=useMemo(()=>({...hf,...o}),[o]),[i,d]=useState(new Set),m=useRef(null),u=useMemo(()=>{if(!l.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],C=y.get(w);C?C.push(v):y.set(w,[v]);}),Array.from(y.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((C,P)=>P.timestamp.getTime()-C.timestamp.getTime())}))},[e,l.groupByDay]),{uniqueUsers:p,uniqueTypes:f}=useMemo(()=>{let y=new Set,v=new Set;return e.forEach(w=>{y.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(v)}},[e]),x=y=>{d(v=>{let w=new Set(v);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),C=Math.floor(w/6e4),P=Math.floor(w/36e5),L=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:P<24?`${P}h ago`:L<7?`${L}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&m.current){let y=m.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",c),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",l.compact&&"compact",c),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[li(y)," ",y.replace("_"," ")]},y))]}),p.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),p.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>r({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:m,children:u.map(y=>jsxs("div",{className:"history-timeline-group",children:[l.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((v,w)=>{let C=i.has(v.id),P=s===v.id,L=yf(v.type);return jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",C&&"expanded",P&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:L},children:l.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:li(v.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:L}})]}),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:[l.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:ii(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:l.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(v.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,D])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},k)),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(([k,D])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},k))]})]})]})]},v.id)})})]},y.date?.toISOString()||"all"))})]})}function wf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:c,onSpeedChange:l,className:i}){let d=[.5,1,1.5,2,3],m=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("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:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:m&&li(m.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:m&&ii(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:p=>c(parseInt(p.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((p,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>c(f),title:ii(p)},p.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:d.map(p=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>l(p),children:[p,"x"]},p))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,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(p=>jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,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 Yd(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 Xd(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 kf(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 Cf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function _C(e,t,r,a,n,s=100){let o=e.map(l=>({...l,x:l.x??r/2+Math.random()*100-50,y:l.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(o.map(l=>[l.id,l]));for(let l=0;l<s;l++){let i=1-l/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let f=d.x-p.x,x=d.y-p.y,h=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=x/h*b;});}),t.forEach(d=>{let m=c.get(typeof d.source=="string"?d.source:d.source.id),u=c.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,f=u.y-m.y,x=Math.sqrt(p*p+f*f)||1,h=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*h,m.vy+=f*h,u.vx-=p*h,u.vy-=f*h;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function Tf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:c,className:l}){let i=useRef(null),[d,m]=useState([]),[u,p]=useState(null),[f,x]=useState(null),[h,b]=useState(null),[y,v]=useState(1),[w,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=_C(e,t,r.width,r.height,r,150);m(O);},[e,t,r]);let P=useCallback((O,ee)=>{r.enableDragging&&(ee.stopPropagation(),p(O));},[r.enableDragging]),L=useCallback(O=>{if(!u||!i.current)return;let I=i.current.getBoundingClientRect(),Ae=(O.clientX-I.left-w.x)/y,H=(O.clientY-I.top-w.y)/y;m(ge=>ge.map(N=>N.id===u?{...N,x:Ae,y:H,fx:Ae,fy:H}:N));},[u,y,w]),k=useCallback(()=>{p(null);},[]),D=useCallback((O,ee)=>{ee.stopPropagation(),c?.({type:"node-click",node:O,position:{x:ee.clientX,y:ee.clientY}});},[c]),F=useCallback((O,ee)=>{ee.stopPropagation(),c?.({type:"edge-click",edge:O,position:{x:ee.clientX,y:ee.clientY}});},[c]),E=useCallback(O=>{let ee=d.find(I=>I.id===O);return ee?{x:ee.x,y:ee.y}:{x:0,y:0}},[d]),G=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ee=O.card.priority;return ee==="URGENT"?"#ef4444":ee==="HIGH"?"#f59e0b":ee==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",l),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:g("relationships-graph",l),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"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Yd(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[kf(O)," ",Xd(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:L,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let ee=E(typeof O.source=="string"?O.source:O.source.id),I=E(typeof O.target=="string"?O.target:O.target.id),Ae=Cf(O.type),H=h===O.id,ge=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",H&&"hovered",ge&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:N=>F(O,N),children:[jsx("line",{x1:ee.x,y1:ee.y,x2:I.x,y2:I.y,stroke:Yd(O.type),strokeWidth:ge?r.edgeWidth*2:r.edgeWidth,strokeOpacity:H?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),r.showEdgeLabels&&H&&jsx("text",{x:(ee.x+I.x)/2,y:(ee.y+I.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Xd(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:d.map(O=>{let ee=f===O.id,I=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",ee&&"hovered",I&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Ae=>P(O.id,Ae),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:Ae=>D(O,Ae),children:[jsx("circle",{r:I?r.nodeSize*1.2:r.nodeSize,fill:G(O),stroke:I?"#fbbf24":"#ffffff",strokeWidth:I?3:2,opacity:ee?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.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 Sf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=useState(""),[c,l]=useState(false),[i,d]=useState(null),[m,u]=useState(null),p=useRef(null),f=c||n;useEffect(()=>{e&&p.current&&p.current.focus();},[e]),useEffect(()=>{let y=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let x=()=>{f||(o(""),d(null),u(null),t());},h=async()=>{if(!(!s.trim()||f)){l(true),d(null),u(null);try{let y=await a(s.trim());u(y);}catch(y){d(y instanceof Error?y.message:"Failed to generate plan");}finally{l(false);}}},b=()=>{m&&(r(m),x());};return e?jsxs(or,{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:y=>y.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((y,v)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.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((y,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:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.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:p,value:s,onChange:y=>o(y.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((y,v)=>jsx("button",{onClick:()=>o(y),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:y},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:h,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 Jd={"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 qC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},YC={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 XC(e,t,r){let a=Jd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ci(e){return `$${e.toFixed(4)}`}var Qd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=XC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),c=r.filter(m=>m.success),l=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?l/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let c=this.operations.filter(d=>d.timestamp>=o).length,l=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:l,percentUsed:i,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$o=new Qd;function Pf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState($o.getStats()),[s,o]=useState($o.checkLimit(r));if(useEffect(()=>{if(!e)return;let l=setInterval(()=>{n($o.getStats()),o($o.checkLimit(r));},1e3);return ()=>clearInterval(l)},[e,r]),useEffect(()=>{let l=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),!e)return null;let c=$o.getRecentOperations(5);return jsxs(or,{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:l=>l.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 (",r.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:ci(a.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:a.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:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.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:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.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(a.operationsByFeature).map(([l,i])=>{let d=a.costsByFeature[l]||0,m=a.totalOperations>0?i/a.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:l.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:ci(d)})]})]}),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}%`}})})]},l)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:c.map(l=>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:l.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(l.timestamp).toLocaleTimeString()," \u2022"," ",l.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l.inputTokens+l.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ci(l.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${l.success?"bg-green-400":"bg-red-400"}`})]})]},l.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 Af({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,c]=useState(""),[l,i]=useState(""),[d,m]=useState(""),[u,p]=useState(false),[f,x]=useState(null),[h,b]=useState(null),[y,v]=useState(null),w=useRef(null),C=u||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let F=E=>{E.key==="Escape"&&!C&&P();};if(e)return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[e,C]);let P=()=>{C||(c(""),i(""),m(""),x(null),b(null),v(null),t());},L=async()=>{if(!(!o.trim()||C)){p(true),x(null),b(null),v(null);try{let F=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:l||void 0,endDate:d||void 0});b(F.tasks.tasks),v({from_cache:F.from_cache,tokens_used:F.tokens_used,mock_mode:F.mock_mode,similarity:F.similarity,tokens_saved:F.tokens_saved});}catch(F){x(F instanceof Error?F.message:"Failed to generate tasks");}finally{p(false);}}},k=()=>{h&&(r(h),P());};if(!e)return null;let D=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(or,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:P}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#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:P,disabled:C,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:h?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:[y?.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"}),y?.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 (",D,"% 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:[y?.tokens_used||0," tokens"]}),y?.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:[y.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:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((F,E)=>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:["#",E+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:F.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),F.start," \u2192 ",F.end]}),jsxs("span",{children:[F.duration," days"]}),F.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",F.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${F.priority==="high"?"bg-red-500/20 text-red-400":F.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:F.priority})]})},F.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:F=>c(F.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:C}),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:l,onChange:F=>i(F.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:C})]}),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:d,onChange:F=>m(F.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:C})]})]}),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((F,E)=>jsx("button",{onClick:()=>c(F),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:F},E))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&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:P,disabled:C,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"}),h?jsx("button",{onClick:k,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:L,disabled:!o.trim()||C,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:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Hl({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(h=>{t&&vi(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,v)=>{console.warn(`Retry attempt ${y} 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(h,b,y)=>{a(v=>{let w=v.cards.find(F=>F.id===h);if(!w)return v;let C=w.columnId,P={...w,columnId:b,position:y},L=v.cards.map(F=>F.id===h?P:F),k=v.columns.map(F=>{if(F.id===C)return {...F,cardIds:F.cardIds.filter(E=>E!==h)};if(F.id===b){let E=L.filter(G=>G.columnId===b).sort((G,O)=>G.position-O.position);return {...F,cardIds:E.map(G=>G.id)}}return F}),D={...v,cards:L,columns:k};return n(D),D});},[n]),o=useCallback(async(h,b)=>{a(y=>{let v=y.cards.map(C=>C.id===h?{...C,...b}:C),w={...y,cards:v};return n(w),w});},[n]),c=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b},w=y.columns.map(P=>P.id===h.columnId?{...P,cardIds:[...P.cardIds,b]}:P),C={...y,cards:[...y.cards,v],columns:w};return n(C),C});},[n]),l=useCallback(async h=>{a(b=>{let y=b.cards.find(P=>P.id===h);if(!y)return b;let v=b.cards.filter(P=>P.id!==h),w=b.columns.map(P=>P.id===y.columnId?{...P,cardIds:P.cardIds.filter(L=>L!==h)}:P),C={...b,cards:v,columns:w};return n(C),C});},[n]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,v]};return n(w),w});},[n]),d=useCallback(async(h,b)=>{a(y=>{let v=y.columns.map(C=>C.id===h?{...C,...b}:C),w={...y,columns:v};return n(w),w});},[n]),m=useCallback(async h=>{a(b=>{let y=b.cards.filter(C=>C.columnId!==h),v=b.columns.filter(C=>C.id!==h),w={...b,cards:y,columns:v};return n(w),w});},[n]),u=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),b},[c]),p=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=useCallback(()=>{a(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:c,onCardDelete:l,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:l,deleteColumn:m,clearBoard:f}}}function Rf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Hl({initialBoard:e,onPersist:r}),o=useMemo(()=>({addCard:(l,i,d={})=>{s.addCard({title:i,columnId:l,position:a.cards.filter(m=>m.columnId===l).length,...d});},addColumn:(l,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:l,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var di={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},$f={by:"none",order:"asc"};function Of({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...di,...e}),[s,o]=useState({...$f,...t}),c=useCallback(x=>{n(h=>({...h,...x}));},[]),l=useCallback(x=>{o(h=>({...h,...x}));},[]),i=useCallback(()=>{n(di),o($f);},[]),d=useCallback(()=>{r&&n({...di,assignees:[r]});},[r]),m=useCallback(()=>{n({...di,dateFilter:"overdue"});},[]),u=useCallback(()=>{n({...di,priorities:["HIGH","URGENT"]});},[]),p=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=useCallback(x=>{let h=[...x];if(a.search){let b=a.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),C=`${y}-${v}-${w}`;h=h.filter(P=>{if(!P.endDate&&!P.dueDate)return false;let L=P.endDate||P.dueDate;if(!L)return false;let k;if(typeof L=="string")k=L.split("T")[0]||L;else {let D=L.getUTCFullYear(),F=String(L.getUTCMonth()+1).padStart(2,"0"),E=String(L.getUTCDate()).padStart(2,"0");k=`${D}-${F}-${E}`;}switch(a.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let D=new Date(C+"T00:00:00"),F=new Date(k+"T00:00:00"),E=new Date(D);return E.setDate(E.getDate()+7),F>=D&&F<=E;case "custom":if(a.dateRange){let G=typeof L=="string"?new Date(L):L;return G>=a.dateRange.start&&G<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>a.labels.includes(y)))),a.columns.length>0&&(h=h.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;v=w-C;break;case "priority":let P={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},L=P[b.priority||"LOW"],k=P[y.priority||"LOW"];v=L-k;break;case "dueDate":let D=b.endDate||b.dueDate,F=y.endDate||y.dueDate;if(!D)return 1;if(!F)return -1;let E=typeof D=="string"?new Date(D).getTime():D.getTime(),G=typeof F=="string"?new Date(F).getTime():F.getTime();v=E-G;break;case "title":v=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,ee=y.estimatedTime||0;v=O-ee;break;default:v=0;}return s.order==="asc"?v:-v}),h},[a,s]);return {filters:a,sort:s,setFilters:c,setSort:l,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:f,hasActiveFilters:p}}var Uf,Wf;if(typeof window<"u")try{let e=hi("ai");Uf=e.generateObject,Wf=e.generateText;}catch{}function zf(e={}){let[t,r]=useState(false),[a,n]=useState(null),s=!!(Uf&&Wf&&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');r(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(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),c=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(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(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),l=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(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(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:c,onPredictRisks:l,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function eu(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function Gf(e){let{cards:t}=e,[r,a]=eu(),n=useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,f=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),h=t.find(b=>b.id===r.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,D)=>k.position-D.position),y=b.findIndex(k=>k.id===r.lastSelectedCardId),v=b.findIndex(k=>k.id===m),[w,C]=y<v?[y,v]:[v,y],P=b.slice(w,C+1).map(k=>k.id),L=Array.from(new Set([...r.selectedCardIds,...P]));a({selectedCardIds:L,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),l=useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:c,selectAll:l,toggleCard:i,getSelectedCards:d}}var Vf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function jf(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({...Vf,...r}),[r]),[s,o]=useState([]),c=useCallback((x,h,b,y,v)=>{if(h.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:h,columnId:b,strategy:y,color:v,isExpanded:true,position:s.filter(C=>C.columnId===b).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),l=useCallback(x=>{o(h=>h.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(h=>h.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=useCallback((x,h)=>{o(b=>b.map(y=>y.id===x&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),m=useCallback((x,h)=>{o(b=>b.map(y=>{if(y.id===x){let v=y.cardIds.filter(w=>w!==h);return v.length<n.minCardsPerStack?null:{...y,cardIds:v}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,b)=>h.position-b.position),[s]),p=useCallback(async x=>{let h=t.filter(C=>C.columnId===x);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(P=>{y.has(P)||y.set(P,[]),y.get(P).push(C);});}),y.forEach((C,P)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${P}`,cardIds:C.map(L=>L.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${P}"`,confidence:.85});});let v=new Map;h.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(P=>{v.has(P)||v.set(P,[]),v.get(P).push(C);});}),v.forEach((C,P)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${P.slice(-4)}`,cardIds:C.map(L=>L.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(C=>{C.priority&&(w.has(C.priority)||w.set(C.priority,[]),w.get(C.priority).push(C));}),w.forEach((C,P)=>{if(C.length>=n.minCardsPerStack){let L={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[P.toLowerCase()]||"\u26AA";b.push({stack:{title:`${L} ${P} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:P==="high"||P==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${P} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let C of h){let L=(await a.findSimilar(C,h)).filter(k=>k.similarity>=n.autoStackConfidenceThreshold);if(L.length>=n.minCardsPerStack-1){let k=[C.id,...L.map(F=>F.card.id)],D=L.reduce((F,E)=>F+E.similarity,0)/L.length;b.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${L.length+1} similar tasks`,confidence:D});}}return b.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,P)=>P.confidence-C.confidence).slice(0,5)},[t,n,a]),f=useCallback(x=>{c(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[c]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await p(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:c,deleteStack:l,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:f,config:n}}var _f=createContext(null);function Kf({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(l=>{let{Column:i}=hi("@libxai/core");s.set(l.id,new i(l));}),t?.cards?.forEach(l=>{let{Card:i}=hi("@libxai/core");o.set(l.id,new i(l));});let c=null;if(t?.board){let{Board:l}=hi("@libxai/core");c=new l(t.board);}a.current=new BoardStore({board:c,columns:s,cards:o});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsx(_f.Provider,{value:{store:n},children:e})}function Ul(){let e=useContext(_f);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function pi(){let e=Ul(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let c=useCallback(y=>{e.updateBoard(y);},[e]),l=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,v)=>{e.updateColumn(y,v);},[e]),d=useCallback(y=>{e.deleteColumn(y);},[e]),m=useCallback(y=>e.getColumn(y),[e]),u=useCallback(y=>{e.addCard(y);},[e]),p=useCallback((y,v)=>{e.updateCard(y,v);},[e]),f=useCallback(y=>{e.deleteCard(y);},[e]),x=useCallback((y,v,w)=>{e.moveCard(y,v,w);},[e]),h=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:c,addColumn:l,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:f,moveCard:x,getCard:h,getCardsByColumn:b}}function Yf(e){let{cards:t}=pi();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Xf(e="position",t="asc"){let{cards:r}=pi();return useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},l=n.priority?c[n.priority]:0,i=s.priority?c[s.priority]:0;o=l-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}),[r,e,t])}var Wl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ru.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let c=await Promise.resolve(o.apply(s,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},m5=new Wl;function Qf({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:c=0,getItemKey:l}){let i=useRef(null),d=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:c}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:u,className:n,children:jsx("div",{style:p,children:m.map(f=>{let x=e[f.index];if(!x)return null;let h=l?l(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:a(x,f.index)},h)})})})}function Zf(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 tb({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:c=16,getItemKey:l,horizontal:i=true}){let d=useRef(null),m=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:c}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:d,style:p,className:s,children:jsx("div",{style:f,children:u.map(x=>{let h=e[x.index];if(!h)return null;let b=l?l(h,x.index):x.index,y={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:y,"data-index":x.index,children:n(h,x.index)},b)})})})}function rb(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 ab(e,t=10){return e>t}var nu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ou={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},su={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},iu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},lu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},du={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},uu={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)"},pu={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)"},mu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},gu={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}},fu={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}},zl={spacing:nu,borderRadius:ou,fontSize:su,fontWeight:iu,lineHeight:lu,zIndex:cu,duration:du,easing:uu,shadows:pu,opacity:mu,kanban:gu,gantt:fu};function nb(e,t,r){return e[t]??r}function bu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?bu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function b5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function hu(e="asakaa"){let t=bu(zl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=b5(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
414
|
+
`),className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors flex items-center gap-1.5",t?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),jsx("span",{className:"truncate",children:c})]}):jsxs("span",{className:g("text-sm truncate flex items-center gap-1.5",t?"text-white/60":"text-gray-500"),children:[jsx(Paperclip,{className:"w-3 h-3 flex-shrink-0"}),c]})}function zg({value:e=[],isDark:t,maxVisible:r=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let a=e.slice(0,r),n=e.length-r;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[a.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:g("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 Rk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let r=Math.floor(e/60),a=e%60;return r===0?`${a}m`:a===0?`${r}h`:`${r}h ${a}m`}function Bk(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let r=t.match(/^(\d+):(\d+)$/);if(r&&r[1]&&r[2]){let c=parseInt(r[1],10),l=parseInt(r[2],10);return c*60+l}let a=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(a&&a[1]){let c=parseFloat(a[1]),l=a[2]?parseInt(a[2],10):0;return Math.round(c*60)+l}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 Ia({value:e,onChange:t,isDark:r,locale:a="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:c=false,lens:l="hours",hourlyRate:i=0,financialOverride:d}){let[m,u]=useState(false),[p,f]=useState(""),x=useRef(null),{isFlashing:h,triggerFlash:b}=fs(),y=l==="financial"&&(i>0||d!=null),v=d??(e?e/60*i:0),w=y&&(d!=null?d>0:e)?`$${Math.round(v).toLocaleString("en-US")}`:Rk(e,a);useEffect(()=>{m&&x.current&&(x.current.focus(),x.current.select());},[m]),useEffect(()=>{if(e){let k=Math.floor(e/60),D=e%60;k>0&&D>0?f(`${k}h ${D}m`):k>0?f(`${k}h`):f(`${D}m`);}else f("");},[e,m]);let C=()=>{let k=Bk(p);k!==e&&(t?.(k),o&&b()),u(false);},P=k=>{k.key==="Enter"?C():k.key==="Escape"&&u(false);};if(c)return jsxs("div",{className:"flex items-center gap-1.5",title:a==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",r?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let L=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(L,{className:g("w-3.5 h-3.5 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",r?"text-white/60":"text-gray-500"),children:w})]}):m?jsx("input",{ref:x,type:"text",value:p,onChange:k=>f(k.target.value),onBlur:C,onKeyDown:P,onClick:k=>k.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",r?"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:k=>{k.stopPropagation(),u(true);},className:g("flex items-center justify-center gap-1 text-sm w-full px-1.5 py-1 rounded transition-[background-color] duration-300 overflow-hidden",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?r?"text-white/60":"text-gray-600":r?"text-white/30":"text-gray-400",h&&(r?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(L,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function _g({startDate:e,endDate:t,scheduleVariance:r,isDark:a,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",a?"text-white/30":"text-gray-400"),children:"-"});let o=l=>l.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),c=()=>{if(r==null)return null;let l=n==="es";return r===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:l?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:a?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):r>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",r,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[r,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",a?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:a?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),c()]})}function qg({task:e,isDark:t,locale:r="en",onLogTime:a,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:c="hours",hourlyRate:l=0}){let i=r==="es",d=c==="financial"&&l>0,m=H=>d?`$${Math.round(H*l).toLocaleString("en-US")}`:`${H}h`,[u,p]=useState(false),[f,x]=useState(false),[h,b]=useState(null),y=useRef(null),v=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,P=Math.round(v/60*10)/10,L=Math.round(w/60*10)/10,k=w>0?v/w*100:0,D=k>100?Math.round((v-w)/60*10)/10:0,F=k>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!h)return;let H=ge=>{y.current&&!y.current.contains(ge.target)&&(x(false),b(null));};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[f,h]);let E=H=>{if(H.stopPropagation(),a&&!n&&!s){b("log");return}if(a||n||s){x(ge=>!ge),b(null);return}o&&o(e);},G=H=>{x(false),b(H);},O=async(H,ge)=>{h==="log"&&a&&H?a(e,H,ge):h==="estimate"&&n?n(e,H):h==="quoted"&&s&&s(e,H),b(null);},ee=a||n||s||o,I=[{mode:"log",icon:Clock,label:i?"Registrar tiempo":"Log time",show:!!a},{mode:"estimate",icon:Target,label:i?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:i?"T. Ofertado":"Quoted time",show:!!s}].filter(H=>H.show),Ae=h==="estimate"?w:h==="quoted"?C:void 0;return w===0&&v===0&&C===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:H=>H.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),u&&ee&&jsx("button",{onClick:E,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:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",H.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",H.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:I.map(H=>jsxs("button",{onClick:ge=>{ge.stopPropagation(),G(H.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:ge=>{ge.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ge=>{ge.target.style.background="transparent";},children:[jsx(H.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),H.label]},H.mode))})}),jsx(AnimatePresence,{children:h&&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(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:O,onClose:()=>b(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:H=>H.stopPropagation(),onMouseEnter:()=>p(true),onMouseLeave:()=>p(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 H=v===0,N=(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:H?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:m(P)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",m(L)]}),D>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:N?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:N?"rgba(239,68,68,0.15)":"transparent"},children:["+",m(D)," ",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(k,100)}%`,backgroundColor:F,borderRadius:2,transition:"width 0.3s"}})})]}),ee&&jsx("button",{onClick:E,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:u?1:0,pointerEvents:u?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",H.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:H=>{H.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",H.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:I.map(H=>jsxs("button",{onClick:ge=>{ge.stopPropagation(),G(H.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:ge=>{ge.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:ge=>{ge.target.style.background="transparent";},children:[jsx(H.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),H.label]},H.mode))})}),jsx(AnimatePresence,{children:h&&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(wn,{mode:h,locale:r,isDark:t,currentValue:Ae||void 0,onSave:O,onClose:()=>b(null)})})})})]})}function Gk(e){let t=new Map;function r(a){if(a.assignees)for(let n of a.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(a.subtasks)for(let n of a.subtasks)r(n);}return r(e),Array.from(t.values())}function Vk(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 Yg({assignee:e,size:t=28,isDark:r}){let a=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:g(a,"rounded-full object-cover ring-1 flex-shrink-0",r?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(a,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,r?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function Xg({task:e,isDark:t,locale:r="en"}){let a=r==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let d=Gk(e);if(d.length===0)return null;let m=d.slice(0,3),u=d.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:m.map((p,f)=>jsx(Yg,{assignee:p,size:24,isDark:t},p.name+f))}),u>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:d.slice(3).map(p=>p.name).join(", "),children:["+",u]})]})}if(!s)return jsxs("div",{className:"flex items-center gap-2",children:[jsx("div",{className:g("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:g("text-[11px]",t?"text-white/30":"text-gray-400"),children:a?"Sin asignar":"Unassigned"})]});let c=o?.percentage??0,l=!!o&&c>0,i=l?Vk(c):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Yg,{assignee:s,size:28,isDark:t}),jsx("span",{className:g("text-[13px] truncate",t?"text-white":"text-gray-900"),style:{maxWidth:"100px"},children:s.name})]}),l&&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:[c,"% LOAD"]})]})}var jk={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Qg({blockers:e,isDark:t,locale:r="en"}){return !e||e.length===0?jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide",t?"text-white/20":"text-gray-400"),children:r==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((a,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",jk[a.severity]),children:[a.type," #",a.id]},`${a.type}-${a.id}-${n}`))})}function s1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function i1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],r=0;for(let a=0;a<e.length;a++)r=e.charCodeAt(a)+((r<<5)-r);return t[Math.abs(r)%t.length]??"blue"}function o0({state:e,onClose:t,isDark:r,locale:a,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:c,onColumnHide:l,onColumnSort:i,availableUsers:d=[],onOpenTimeLog:m,onReportBlocker:u,onCopyTaskLink:p,onTaskMove:f,onTaskIndent:x,onTaskOutdent:h}){let b=useRef(null),y=a==="es"?t0.es:t0.en,[v,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let D=b.current;if(!D)return;let F=D.getBoundingClientRect(),E=8,G=e.x,O=e.y;e.y+F.height>window.innerHeight-E&&(O=Math.max(E,e.y-F.height)),e.x+F.width>window.innerWidth-E&&(G=Math.max(E,window.innerWidth-F.width-E)),(G!==e.x||O!==e.y)&&w({left:G,top:O});},[e.x,e.y,e.isOpen]),useEffect(()=>{let D=E=>{b.current&&!b.current.contains(E.target)&&t();},F=E=>{E.key==="Escape"&&t();};return document.addEventListener("mousedown",D),document.addEventListener("keydown",F),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",F);}},[t]),!e.isOpen)return null;let C=()=>{if(!e.task)return [];let D=[];return n&&D.push({id:"edit",label:y.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),D.push({id:"sep1",label:"",icon:null,separator:true}),c&&(D.push({id:"status",label:y.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:y.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{c({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:y.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{c({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:y.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{c({...e.task,status:"completed",progress:100}),t();}}]}),D.push({id:"priority",label:y.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:y.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{c({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:y.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{c({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:y.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{c({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{c({...e.task,priority:"low"}),t();}}]}),d.length>0&&D.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:d.slice(0,5).map(F=>({id:`assign-${F.id}`,label:F.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:F.name.charAt(0).toUpperCase()}),onClick:()=>{let E=e.task.assignees||[],O=E.some(ee=>ee.name===F.name)?E.filter(ee=>ee.name!==F.name):[...E,{name:F.name,initials:s1(F.name),color:F.color||i1(F.name),avatar:F.avatarUrl}];c({...e.task,assignees:O}),t();}}))})),m&&D.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),u&&D.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),p&&D.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),D.push({id:"sep2",label:"",icon:null,separator:true}),s&&D.push({id:"duplicate",label:y.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||x||h)&&(D.push({id:"sep3",label:"",icon:null,separator:true}),f&&(D.push({id:"move-up",label:y.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),D.push({id:"move-down",label:y.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),x&&D.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{x(e.task.id),t();}}),h&&D.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{h(e.task.id),t();}})),o&&D.push({id:"delete",label:y.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),D},P=()=>{if(!e.columnId)return [];let D=[];return i&&(D.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"asc"),t();}}),D.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{i(e.columnId,"desc"),t();}})),l&&e.columnId!=="name"&&(D.push({id:"sep-hide",label:"",icon:null,separator:true}),D.push({id:"hide",label:y.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId),t();}})),D},L=e.type==="task"?C():P(),k={position:"fixed",left:v.left,top:v.top,zIndex:9999};return jsx("div",{ref:b,style:k,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",r?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:L.map(D=>D.separator?jsx("div",{className:g("my-1 h-px",r?"bg-white/[0.05]":"bg-gray-200")},D.id):D.submenu?jsx(l1,{item:D,isDark:r},D.id):jsxs("button",{onClick:D.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",D.danger?"text-red-500 hover:text-red-600":r?"text-white":"text-gray-700"),children:[jsx("span",{className:g(D.danger?"text-red-500":r?"text-white/60":"text-gray-400"),children:D.icon}),D.label]},D.id))})}function l1({item:e,isDark:t}){let[r,a]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),a(true);},onMouseLeave:()=>{n.current=setTimeout(()=>a(false),150);},children:[jsxs("button",{className:g("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:g("w-4 h-4",t?"text-white/30":"text-gray-400")})]}),r&&e.submenu&&jsx("div",{className:g("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(c=>jsxs("button",{onClick:c.onClick,className:g("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:c.icon}),c.label]},c.id))})]})}var t0={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 m0={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"}),multiselect:jsx(Tag,{className:"w-4 h-4"}),person:jsx(Users,{className:"w-4 h-4"}),file:jsx(Paperclip,{className:"w-4 h-4"})},N1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function f0({isOpen:e,onClose:t,columns:r,customFields:a=[],onColumnsChange:n,onCreateCustomField:s,isDark:o,locale:c}){let[l,i]=useState(""),[d,m]=useState(null),[u,p]=useState(null),f=useRef(null),x=c==="es"?g0.es:g0.en;useLayoutEffect(()=>{if(!e||!f.current)return;let L=()=>{if(!f.current)return;let k=f.current.parentElement;if(k){let G=k.getBoundingClientRect();p({top:G.bottom+4,right:window.innerWidth-G.right});}let D=f.current.getBoundingClientRect(),E=window.innerHeight-D.top-20;m(Math.max(300,E));};return requestAnimationFrame(L),window.addEventListener("resize",L),()=>window.removeEventListener("resize",L)},[e]),useEffect(()=>{if(!e)return;let L=setTimeout(()=>{let k=F=>{f.current&&!f.current.contains(F.target)&&t();},D=F=>{F.key==="Escape"&&t();};document.addEventListener("mousedown",k),document.addEventListener("keydown",D),f._cleanup=()=>{document.removeEventListener("mousedown",k),document.removeEventListener("keydown",D);};},100);return ()=>{clearTimeout(L),f._cleanup&&f._cleanup();}},[e,t]);let h=useMemo(()=>{let L=new Set([...N1]);return r.forEach(k=>{k.type&&k.type!=="assignees"&&L.add(k.type);}),Array.from(L)},[r]);if(!e)return null;let b=L=>{let k=x.columns[L];if(k)return k;let D=r.find(F=>F.type===L);return D?.label?D.label:L},y=L=>{if(L==="name")return;let k=r.map(D=>D.id===L?{...D,visible:!D.visible}:D);n(k);},v=(L,k)=>{let D=r.find(E=>E.type===L&&(!k||E.customFieldId===k));if(D){y(D.id);return}let F={id:k||L,type:L,label:k?a.find(E=>E.id===k)?.name||L:b(L),width:120,visible:true,sortable:true,resizable:true,customFieldId:k};n([...r,F]);},w=h.filter(L=>L!=="assignees"&&b(L).toLowerCase().includes(l.toLowerCase())),C=a.filter(L=>L.name.toLowerCase().includes(l.toLowerCase())),P=o?"#00E5FF":"#00E5CC";return jsxs("div",{ref:f,style:{...d?{maxHeight:`${d}px`}:{},...u?{top:u.top,right:u.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:L=>{L.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",L.currentTarget.style.color=o?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:L=>{L.currentTarget.style.backgroundColor="transparent",L.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:l,onChange:L=>i(L.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:L=>{L&&L.style.setProperty("--focus-border",P);},onFocus:L=>{L.currentTarget.style.borderColor=P,L.currentTarget.style.background=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:L=>{L.currentTarget.style.borderColor=o?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",L.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:L=>L.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(L=>{let k=r.find(E=>E.type===L&&!E.customFieldId),D=k?.visible??false,F=L==="name";return jsxs("button",{onClick:()=>{F||(k?y(k.id):v(L));},disabled:F,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:F?.4:1,cursor:F?"not-allowed":"pointer"},onMouseEnter:E=>{F||(E.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:E=>{E.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:D?P:"transparent",border:D?`1.5px solid ${P}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${P}40`:"none"},children:D&&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:D?P:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:m0[L]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:D?500:400,color:D?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(L),children:b(L)})]},L)})})]}),C.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:C.map(L=>{let D=r.find(F=>F.customFieldId===L.id)?.visible??false;return jsxs("button",{onClick:()=>v(L.type,L.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:F=>{F.currentTarget.style.backgroundColor=o?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:F=>{F.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:D?P:"transparent",border:D?`1.5px solid ${P}`:`1.5px solid ${o?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:D?`0 0 6px ${P}40`:"none"},children:D&&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:D?P:o?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:m0[L.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:D?500:400,color:D?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:L.name})]},L.id)})})]})]})]})}var g0={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",multiselect:"Multi-select",person:"Person",file:"File",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 I1=[{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 y0({isOpen:e,onClose:t,onSave:r,isDark:a,locale:n}){let[s,o]=useState(""),[c,l]=useState("text"),[i,d]=useState([""]),m=n==="es"?h0.es:h0.en;useEffect(()=>{e&&(o(""),l("text"),d([""]));},[e]),useEffect(()=>{let h=b=>{b.key==="Escape"&&t();};return e&&document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,t]);let u=()=>{if(!s.trim())return;let h={name:s.trim(),type:c};c==="dropdown"&&(h.options=i.filter(b=>b.trim())),r(h),t();},p=()=>{d([...i,""]);},f=(h,b)=>{let y=[...i];y[h]=b,d(y);},x=h=>{i.length>1&&d(i.filter((b,y)=>y!==h));};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:g("relative w-full max-w-md rounded-xl shadow-2xl border",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:[jsxs("div",{className:g("flex items-center justify-between px-6 py-4 border-b",a?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",a?"text-white":"text-gray-900"),children:m.title}),jsx("button",{onClick:t,className:g("p-1 rounded",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",a?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldName}),jsx("input",{type:"text",value:s,onChange:h=>o(h.target.value),placeholder:m.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:I1.map(h=>jsxs("button",{onClick:()=>l(h.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",c===h.type?"border-[#00E5CC] bg-[#00E5CC]/10":a?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:c===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-400",children:h.icon}),jsx("span",{className:g("text-xs",c===h.type?"text-[#00E5CC]":a?"text-white/60":"text-gray-500"),children:m.types[h.type]})]},h.type))})]}),c==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",a?"text-white":"text-gray-900"),children:m.options}),jsxs("div",{className:"space-y-2",children:[i.map((h,b)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:h,onChange:y=>f(b,y.target.value),placeholder:`${m.option} ${b+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",a?"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:g("p-2 rounded-lg transition-colors",a?"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:p,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",a?"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:g("flex items-center justify-end gap-3 px-6 py-4 border-t",a?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:m.cancel}),jsx("button",{onClick:u,disabled:!s.trim(),className:g("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 h0={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 w0={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 k0({value:e,hideCompleted:t,onChange:r,onHideCompletedChange:a,isDark:n,locale:s}){let[o,c]=useState(false),l=useRef(null),i=useRef(0),d=s==="es"?w0.es:w0.en;useEffect(()=>{if(!o)return;let p=x=>{Date.now()-i.current<100||l.current&&!l.current.contains(x.target)&&c(false);},f=x=>{x.key==="Escape"&&c(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",f);}},[o]);let m=[{value:"all",label:d.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:d.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:d.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:d.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],u=e!=="all"||t;return jsxs("div",{ref:l,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),o||(i.current=Date.now()),c(f=>!f);},className:g("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",u&&(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"}),d.filters,u&&jsx("span",{className:g("w-2 h-2 rounded-full","bg-[#00E5CC]")})]}),o&&jsxs("div",{className:g("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:g("px-4 py-3 border-b",n?"border-[#222]":"border-gray-200"),children:jsx("span",{className:g("text-xs font-medium uppercase tracking-wider",n?"text-white/30":"text-gray-400"),children:d.filterByStatus})}),jsx("div",{className:"py-2",children:m.map(p=>{let f=e===p.value&&!t,x=()=>p.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"}):p.icon;return jsxs("button",{onClick:()=>{r(p.value),a(false),c(false);},className:g("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:g(f?p.color:"text-gray-400","flex-shrink-0"),children:x()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:p.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},p.value)})}),jsx("div",{className:g("my-2 mx-4 h-px",n?"bg-white/[0.05]":"bg-gray-200")}),jsx("div",{className:"py-1",children:jsxs("button",{onClick:()=>{let p=!t;a(p),p&&r("all"),c(false);},className:g("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:g("w-4 h-4 flex-shrink-0",t?"text-[#00E5CC]":n?"text-white/30":"text-gray-400")}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:d.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function C0(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function go(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function T0({data:e,isDark:t,locale:r="en",onClose:a,lens:n="hours",onUnassignedTaskClick:s}){let o=r==="es",c=n==="financial";return jsxs("div",{className:g("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:g("px-5 py-4 border-b flex items-center justify-between",t?"border-[#222]":"border-gray-200"),children:[jsx("h3",{className:g("text-[11px] font-mono uppercase tracking-wider font-bold",t?"text-white/60":"text-gray-600"),children:c?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),a&&jsx("button",{onClick:a,className:g("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"})})})]}),c&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let l=e.totalOffered??0,i=e.totalEstimated??0,d=e.totalExecuted??0,m=l-d,u=l>0?Math.round(m/l*100):0,p=l-i,f=l>0?Math.round(p/l*100):0,x=l>0?Math.min(Math.round(d/l*100),120):0,h=d>l&&l>0,b=h?"#F87171":"#00E5CC";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(l)})]}),(()=>{let y=e.totalEstimatedLabor??0,v=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=v>0||w>0,P=(L,k)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:L}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(k)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:go(i)})]}),C&&jsxs(Fragment,{children:[P(o?"Mano de obra":"Labor",y),v>0&&P(o?"Activos":"Equipment",v),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),d>0&&(()=>{let y=e.totalExecutedLabor??0,v=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=v>0||w>0,P=(L,k)=>jsxs("div",{className:"flex items-center justify-between pl-3",children:[jsx("span",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:L}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:go(k)})]});return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",h?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:go(d)})]}),C&&jsxs(Fragment,{children:[P(o?"Mano de obra":"Labor",y),v>0&&P(o?"Activos":"Equipment",v),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),l>0&&jsx("div",{className:g("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(x,100)}%`,backgroundColor:b}})}),i>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",p>=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:[jsx("div",{className:"text-[9px] uppercase tracking-wider opacity-60 mb-0.5",children:o?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[p>=0?"+":"",go(p),l>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",p>=0?"+":"",f,"%)"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:o?"0 = ejecutas tal cual lo ofertado":"0 = you execute exactly as offered"})]}),jsxs("div",{className:g("mt-1.5 px-3 py-1.5 rounded-lg text-center font-mono text-[12px]",t?"text-white/50":"text-gray-500"),children:[m>=0?`+${go(m)} ${o?"disponible (caja)":"available (cash)"}`:`${go(Math.abs(m))} ${o?"sobregirado":"overdrawn"}`,l>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",u,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let l=e.totalHoursSpentMinutes??0,i=e.totalHoursAllocatedMinutes??0,d=i>0?Math.min(Math.round(l/i*100),100):0,p=(i>0?l/i:0)>1.1?"#F87171":d>=90?"#FFD60A":"#3BF06E";return jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:C0(l)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:C0(i)})]}),i>0&&jsx("div",{className:g("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:`${d}%`,backgroundColor:p}})})]})]})})(),(e.openRFIs!==void 0||e.submittalsApprovalPercent!==void 0)&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"RFIs Abiertos":"Open RFIs"}),jsx("span",{className:g("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:g("text-xs",t?"text-white/60":"text-gray-600"),children:o?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsxs("span",{className:g("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:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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:g("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:g("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:g("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:g("space-y-1.5 overflow-y-auto scrollbar-slim",e.unassignedTasks.length>5?"max-h-[170px]":""),children:e.unassignedTasks.map(l=>jsxs("button",{onClick:()=>s?.(l.id),className:g("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:g("w-1.5 h-1.5 rounded-full flex-shrink-0",(e.unassignedCount??0)>=10?"bg-[#F87171]":"bg-[#FFD60A]")}),jsx("span",{className:"truncate",children:l.name})]},l.id))})]}),e.scheduleVarianceDays!==void 0&&jsxs("div",{className:g("px-5 py-4 border-b",t?"border-[#222]":"border-gray-200"),children:[jsx("h4",{className:g("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 l=e.scheduleVarianceDays??0,i=l>0,d=l<0,m=e.scheduleVarianceLabel||(i?`+${l} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:d?`${l} ${o?"D\xEDas ATR\xC1S":"Days BEHIND"}`:o?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",i&&"bg-[#3BF06E]/15 text-[#3BF06E]",d&&"bg-[#F87171]/15 text-[#F87171]",!i&&!d&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:m})})()]}),e.teams&&e.teams.length>0&&jsxs("div",{className:"px-5 py-4",children:[jsx("h4",{className:g("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((l,i)=>{let d=l.utilizationPercent>=100?"#F87171":l.utilizationPercent>=80?"#FFD60A":l.color||"#3BF06E";return jsxs("div",{children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:l.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[l.utilizationPercent,"%"]})]}),jsx("div",{className:g("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(l.utilizationPercent,100)}%`,backgroundColor:d}})})]},`${l.name}-${i}`)})})]})]})}var X1=[{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 L0(e,t=0,r=[]){let a=[];for(let n of e){let s=[...r,n.id];a.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&a.push(...L0(n.subtasks,t+1,s));}return a}function J1(e){let t=e.subtasks;if(!t?.length)return null;let r=new Date,a=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),l=s.endDate.getTime()-o;if(l<=0)continue;let d=Math.max(0,Math.min(r.getTime()-o,l))/l*100;if(d<=0)continue;let m=(s.progress||0)/d;a+=m,n++;}return n>0?a/n:null}function ws(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,r=0,a=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=ws(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,r+=s.allocated>0?s.allocated:n.effortMinutes??0,a+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,r+=n.effortMinutes??0,a+=n.soldEffortMinutes??0;return {spent:t,allocated:r,quoted:a}}function vs(e){if(e<=0)return "0h";let t=Math.floor(e/60),r=e%60;return r>0?`${t}h ${r}m`:`${t}h`}function Q1({value:e,onChange:t,isDark:r}){let[a,n]=useState(false),[s,o]=useState(String(e||""));return a?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:c=>c.stopPropagation(),onChange:c=>o(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(s);!isNaN(c)&&c>=0&&c<=100?t(c):s===""&&t(0),n(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.key==="Escape"&&(o(String(e||"")),n(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",r?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:c=>{c.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?r?"text-white/80":"text-gray-700":r?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function P0(e){if(e.length===0)return 0;let t=0,r=0,a=0;for(let c of e){let l=c.weight||0;l>0&&(t+=(c.progress||0)*l,r+=l,a+=1);}let n=a/e.length;if(r>=99&&n>=.95)return Math.round(t/r*10)/10;if(e.reduce((c,l)=>c+(l.effort_minutes||0),0)>0){let c=0,l=0;for(let i of e){let d=i.effort_minutes||60;c+=(i.progress||0)*d,l+=d;}return Math.round(c/l*10)/10}let o=e.reduce((c,l)=>c+(l.progress||0),0);return Math.round(o/e.length*10)/10}function Ud(e,t=[]){for(let r of e)r.subtasks&&r.subtasks.length>0?Ud(r.subtasks,t):t.push({progress:r.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes});return t}function A0({tasks:e,config:t={},callbacks:r={},isLoading:a=false,error:n,className:s,style:o,availableUsers:c=[],customFields:l=[],toolbarRightContent:i,onColumnHeaderClick:d,columnsWithFilter:m,filterDotColor:u="#00E5CC"}){let{theme:p="dark",locale:f="en",customTranslations:x,showSearch:h=true,showHierarchy:b=true,tableColumns:y,mostrarIndicadoresFinancieros:v=true,allowColumnCustomization:w=true,allowColumnResize:C=true,enableContextMenu:P=true,showCreateTaskButton:L=false,onCreateTask:k,persistFilter:D=false,financialBlur:F,healthSidebar:E,lens:G="hours",hourlyRate:O=0,rateMap:ee,aggregateParentHours:I=false,showProjectTotals:Ae=false,totalsDollarOverride:H}=t,ge=ml(f,x),N=p==="dark",De=S=>{if(!ee||!S.assignees||S.assignees.length===0)return O;let J=0,me=0;for(let Ce of S.assignees){let We=Ce.id?ee[Ce.id]:void 0;if(We==null||We<=0)continue;let re=typeof Ce.estimatedMinutes=="number"?Ce.estimatedMinutes:0;re>0&&(J+=We*re,me+=re);}if(me>0)return J/me;let ve=S.assignees.map(Ce=>Ce.id?ee[Ce.id]:void 0).filter(Ce=>Ce!=null&&Ce>0);return ve.length===0?O:ve.reduce((Ce,We)=>Ce+We,0)/ve.length},Xe=S=>{let J=0,me=0,ve=0,Ce=We=>{for(let re of We)if(re.subtasks&&re.subtasks.length>0){let we={s:J,a:me,q:ve};if(Ce(re.subtasks),J-we.s+(me-we.a)+(ve-we.q)===0){let at=De(re);J+=(re.timeLoggedMinutes??0)/60*at,me+=(re.effortMinutes??0)/60*at,ve+=(re.soldEffortMinutes??0)/60*at;}}else {let we=De(re);J+=(re.timeLoggedMinutes??0)/60*we,me+=(re.effortMinutes??0)/60*we,ve+=(re.soldEffortMinutes??0)/60*we;}};return S.subtasks&&Ce(S.subtasks),{dollarSpent:J,dollarAllocated:me,dollarQuoted:ve}},He=useCallback(()=>{if(!D||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let S=localStorage.getItem(D);if(S){let J=JSON.parse(S);return {statusFilter:J.statusFilter||"all",hideCompleted:J.hideCompleted||!1}}}catch(S){console.error("Error loading persisted filter:",S);}return {statusFilter:"all",hideCompleted:false}},[D]),Y=useMemo(()=>{function S(J){let me=0,ve=0,Ce=0,We=0,re=0,we=0;for(let ze of J)if(ze.subtasks&&ze.subtasks.length>0){let at=S(ze.subtasks);if(at.spent+at.allocated+at.quoted>0)me+=at.spent,ve+=at.allocated,Ce+=at.quoted,We+=at.dollarSpent,re+=at.dollarAllocated,we+=at.dollarQuoted;else {let bt=ze.timeLoggedMinutes??0,mt=ze.effortMinutes??0,mr=ze.soldEffortMinutes??0;me+=bt,ve+=mt,Ce+=mr;let xr=De(ze);We+=bt/60*xr,re+=mt/60*xr,we+=mr/60*xr;}}else {let at=ze.timeLoggedMinutes??0,tt=ze.effortMinutes??0,bt=ze.soldEffortMinutes??0;me+=at,ve+=tt,Ce+=bt;let mt=De(ze);We+=at/60*mt,re+=tt/60*mt,we+=bt/60*mt;}return {spent:me,allocated:ve,quoted:Ce,dollarSpent:We,dollarAllocated:re,dollarQuoted:we}}return S(e)},[e]),Ee=useMemo(()=>{let S=new Map;function J(me){let ve=0;for(let Ce of me)if(Ce.subtasks&&Ce.subtasks.length>0){let We=J(Ce.subtasks);S.set(Ce.id,We),ve+=We;}else ve+=Ce.weight||0;return ve}return J(e),S},[e]),te=useMemo(()=>!E?.enabled||!E.data?E:{...E,data:{...E.data,totalHoursSpentMinutes:Y.spent,totalHoursAllocatedMinutes:Y.allocated}},[E,Y]),[Be,Se]=useState(true),[Le,$e]=useState(null),[Ye,le]=useState("position"),[Qe,je]=useState("asc"),[Ie,Ct]=useState(""),[it,qe]=useState(()=>He().statusFilter),[Pe,xt]=useState(()=>He().hideCompleted),[St,Re]=useState(y||X1),[ct,A]=useState(false),[X,B]=useState(false),[q,ce]=useState({isOpen:false,x:0,y:0,type:"task"}),[ue,_e]=useState(null),[V,ye]=useState(false),[Fe,Ue]=useState(null),[dt,Ze]=useState(null),[Tt,gt]=useState(null),rr=useRef(0),ar=useRef(false),Er=!!(r.onTaskMove||r.onTaskReparent),[_t,Mr]=useState(null),[Ft,Pr]=useState(null),Kt=S=>S==="assignees"||S==="teamLoad"?"assignees":S==="startDate"?"startDate":S==="endDate"?"endDate":null,qt=useRef([]),ea=useCallback((S,J)=>{Er&&(J.preventDefault(),rr.current=J.clientY,_e(S),ar.current=false,ye(false),gt({x:J.clientX,y:J.clientY}));},[Er]),pa=useCallback(S=>{if(!ue||(Math.abs(S.clientY-rr.current)>5&&!ar.current&&(ar.current=true,ye(true)),gt({x:S.clientX,y:S.clientY}),!ar.current))return;let me=document.querySelectorAll("[data-listview-row]"),ve=null,Ce=null;me.forEach(We=>{let re=We.getBoundingClientRect(),we=We.getAttribute("data-listview-row");if(we&&we!==ue&&S.clientY>=re.top&&S.clientY<=re.bottom){ve=we;let ze=S.clientY-re.top,at=re.height;Ce=ze<at*.25?"above":ze>at*.75?"below":"child";}}),Ue(ve),Ze(Ce);},[ue]),et=useCallback(()=>{if(ar.current&&ue&&Fe&&dt){if(dt==="child"&&r.onTaskReparent)r.onTaskReparent(ue,Fe);else if(dt==="above"||dt==="below"){let S=(ve,Ce,We=null)=>{for(let re of ve){if(re.id===Ce)return We;if(re.subtasks){let we=S(re.subtasks,Ce,re.id);if(we!==void 0)return we}}},J=S(e,ue,null),me=S(e,Fe,null);if(r.onTaskReparent){let ve=(at,tt)=>{if(tt===null)return at;for(let bt of at){if(bt.id===tt)return bt.subtasks||[];if(bt.subtasks){let mt=ve(bt.subtasks,tt);if(mt.length>0||bt.subtasks.some(mr=>mr.id===tt))return mt}}return []},Ce=ve(e,me??null),We=Ce.findIndex(at=>at.id===Fe),re=J===me,we=re?Ce.findIndex(at=>at.id===ue):-1,ze=dt==="below"?We+1:We;re&&we!==-1&&we<We&&(ze-=1),r.onTaskReparent(ue,me??null,Math.max(0,ze));}}}_e(null),Ue(null),Ze(null),gt(null),ar.current=false,ye(false);},[ue,Fe,dt,e,r]),Ke=(S,J)=>J==="assignees"?S.assignees:J==="startDate"?S.startDate:S.endDate,ha=(S,J,me,ve)=>{S.preventDefault(),S.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let Ce=Array.from(document.querySelectorAll("[data-listview-row]")),We=Ce.map(Et=>Et.getAttribute("data-listview-row")||""),re=Math.max(0,We.indexOf(J)),we=Et=>We.slice(re,Et+1);Pr({sourceTaskId:J,column:me,sourceIndex:ve,targetIndex:ve,rangeIds:new Set([J])});let at=(Et=>{let Lt=Et?.parentElement??null;for(;Lt;){let Ta=window.getComputedStyle(Lt).overflowY;if((Ta==="auto"||Ta==="scroll")&&Lt.scrollHeight>Lt.clientHeight)return Lt;Lt=Lt.parentElement;}let Fr=document.scrollingElement;return Fr&&Fr.scrollHeight>Fr.clientHeight?Fr:null})(S.currentTarget),tt=Et=>{let Lt=re,Fr=false;Ce.forEach((Ta,ma)=>{let Yr=Ta.getBoundingClientRect();Et>=Yr.top&&Et<=Yr.bottom&&(Lt=ma,Fr=true);});let kr=Ce[Ce.length-1];if(!Fr&&kr){let Ta=kr.getBoundingClientRect();Et>Ta.bottom&&(Lt=Ce.length-1);}return Lt<re&&(Lt=re),Lt},bt=S.clientY,mt=null,mr=()=>{mt!==null&&(cancelAnimationFrame(mt),mt=null);},xr=()=>{let Et=tt(bt),Lt=new Set(we(Et));Pr(Fr=>Fr&&{...Fr,targetIndex:Et,rangeIds:Lt});},zr=()=>{if(mr(),!at)return;let Et=at,Fr=Et===document.scrollingElement?{top:0,bottom:window.innerHeight}:Et.getBoundingClientRect(),kr=60,Ta=12,ma=bt-Fr.top,Yr=Fr.bottom-bt,yo=Et.scrollHeight-Et.clientHeight;if(Yr<kr&&Et.scrollTop<yo){let Ns=Math.max(1,Math.round(Ta*(1-Math.max(0,Yr)/kr))),Fn=()=>{Et.scrollTop+=Ns,xr(),Et.scrollTop<Et.scrollHeight-Et.clientHeight&&(mt=requestAnimationFrame(Fn));};mt=requestAnimationFrame(Fn);}else if(ma<kr&&Et.scrollTop>0){let Ns=Math.max(1,Math.round(Ta*(1-Math.max(0,ma)/kr))),Fn=()=>{Et.scrollTop-=Ns,xr(),Et.scrollTop>0&&(mt=requestAnimationFrame(Fn));};mt=requestAnimationFrame(Fn);}},$t=Et=>{bt=Et.clientY,xr(),zr();},Wt=Et=>{window.removeEventListener("mousemove",$t),window.removeEventListener("mouseup",Wt),mr(),document.body.style.cursor="",document.body.style.userSelect="",Pr(null);let Lt=tt(Et.clientY),Fr=new Map(qt.current.map(Yr=>[Yr.id,Yr])),kr=Fr.get(J);if(!kr)return;let Ta=Ke(kr,me),ma=[];for(let Yr of we(Lt)){if(Yr===J)continue;let yo=Fr.get(Yr);yo&&(yo.subtasks&&yo.subtasks.length>0||ma.push(Yr));}ma.length>0&&r.onBulkFill?.(ma,me,Ta);};window.addEventListener("mousemove",$t),window.addEventListener("mouseup",Wt);},_r=S=>Ft?Ft.rangeIds.has(S):false;useEffect(()=>{if(ue)return document.addEventListener("mousemove",pa),document.addEventListener("mouseup",et),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",pa),document.removeEventListener("mouseup",et),document.body.style.cursor="",document.body.style.userSelect="";}},[ue,pa,et]);let[pr,Kr]=useState("all"),[sa,se]=useState(false),pe=useRef(null),ft=useRef(null),j=useMemo(()=>{let S=0;function J(me,ve){for(let Ce of me)ve>S&&(S=ve),Ce.subtasks?.length&&J(Ce.subtasks,ve+1);}return J(e,1),S},[e]);useEffect(()=>{if(!sa)return;let S=J=>{pe.current?.contains(J.target)||ft.current?.contains(J.target)||se(false);};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[sa]),useEffect(()=>{if(pr==="all"){let me=function(ve){for(let Ce of ve)Ce.subtasks?.length&&(Ce.isExpanded===false&&r.onTaskToggleExpand?.(Ce.id),me(Ce.subtasks));};me(e);}else {let me=function(ve,Ce){for(let We of ve)if(We.subtasks?.length){let re=Ce<pr,we=We.isExpanded!==false;re!==we&&r.onTaskToggleExpand?.(We.id),me(We.subtasks,Ce+1);}};me(e,1);}},[pr]);let[fe,Q]=useState(null),[$,Z]=useState(0),[xe,T]=useState(0),U=useRef(null),[de,_]=useState(null),[ke,st]=useState(null);useEffect(()=>{y&&Re(S=>{if(S.length===y.length){let J=true;for(let me=0;me<S.length;me++){let ve=S[me],Ce=y[me];if(!ve||!Ce||ve.id!==Ce.id||ve.visible!==Ce.visible||ve.width!==Ce.width||ve.label!==Ce.label){J=false;break}}if(J)return S}return y});},[y]),useEffect(()=>{if(!(!D||typeof window>"u"))try{localStorage.setItem(D,JSON.stringify({statusFilter:it,hideCompleted:Pe}));}catch(S){console.error("Error persisting filter state:",S);}},[D,it,Pe]);let oe=useMemo(()=>{let S=new Set;function J(me){for(let ve of me)ve.subtasks?.length&&(ve.isExpanded!==false&&S.add(ve.id),J(ve.subtasks));}return J(e),S},[e]),rt=useMemo(()=>St.filter(S=>S.visible),[St]),pt=useCallback(S=>{r.onTaskToggleExpand?.(S);},[r]),Ut=useCallback(S=>{Ye===S?je(J=>J==="asc"?"desc":"asc"):(le(S),je("asc")),r.onSortChange?.({column:S,direction:Qe==="asc"?"desc":"asc"});},[Ye,Qe,r]),Qt=useCallback(S=>{Re(S),r.onColumnsChange?.(S);},[r]),ya=useCallback(S=>{let J=St.map(me=>me.id===S?{...me,visible:false}:me);Qt(J);},[St,Qt]),Wr=useCallback((S,J)=>{le(S),je(J);},[]),Ga=useCallback((S,J,me)=>{P&&(S.preventDefault(),ce({isOpen:true,x:S.clientX,y:S.clientY,type:J?"task":"header",task:J,columnId:me}));},[P]),lr=useCallback(()=>{ce(S=>({...S,isOpen:false}));},[]),Ba=useCallback((S,J)=>{if(!C)return;S.preventDefault(),S.stopPropagation();let me=St.find(ve=>ve.id===J);me&&(Q(J),Z(S.clientX),T(me.width));},[St,C]);useEffect(()=>{if(!fe)return;let S=St,J=ve=>{let Ce=ve.clientX-$,We=Math.max(50,xe+Ce);S=S.map(re=>re.id===fe?{...re,width:We}:re),Re(S);},me=()=>{r.onColumnsChange?.(S),Q(null);};return document.addEventListener("mousemove",J),document.addEventListener("mouseup",me),()=>{document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",me);}},[fe,$,xe,r]);let Wo=useCallback((S,J)=>{if(J==="name"){S.preventDefault();return}_(J),S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",J),S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="0.5");},[]),Pn=useCallback(S=>{S.currentTarget instanceof HTMLElement&&(S.currentTarget.style.opacity="1"),_(null),st(null);},[]),_n=useCallback((S,J)=>{S.preventDefault(),J!=="name"&&(S.dataTransfer.dropEffect="move",st(J));},[]),zo=useCallback(()=>{st(null);},[]),gi=useCallback((S,J)=>{if(S.preventDefault(),!de||de===J||J==="name")return;let me=[...St],ve=me.findIndex(re=>re.id===de),Ce=me.findIndex(re=>re.id===J);if(ve===-1||Ce===-1)return;let We=me.splice(ve,1);We[0]&&(me.splice(Ce,0,We[0]),Qt(me),_(null),st(null));},[de,St,Qt]),qr=useCallback(async S=>{if(r.onCreateCustomField){let J={...S,id:`cf_${Date.now()}`,projectId:""};await r.onCreateCustomField(J);}B(false);},[r]),ho=useCallback(S=>S.progress===100||S.status==="completed"?"completed":S.progress&&S.progress>0||S.status==="in-progress"?"in-progress":"todo",[]),xa=useMemo(()=>{let S=L0(e);if(Ie.trim()){let J=Ie.toLowerCase();S=S.filter(me=>me.name.toLowerCase().includes(J));}if(it!=="all"){let J=new Set(S.filter(me=>ho(me)===it).flatMap(me=>me.parentPath));S=S.filter(me=>J.has(me.id));}if(Pe){let J=new Set(S.filter(me=>ho(me)!=="completed").flatMap(me=>me.parentPath));S=S.filter(me=>J.has(me.id));}return S.sort((J,me)=>{let ve,Ce;switch(Ye){case "name":ve=J.name.toLowerCase(),Ce=me.name.toLowerCase();break;case "startDate":ve=J.startDate?.getTime()||0,Ce=me.startDate?.getTime()||0;break;case "endDate":ve=J.endDate?.getTime()||0,Ce=me.endDate?.getTime()||0;break;case "progress":ve=J.progress||0,Ce=me.progress||0;break;case "status":ve=J.status||"todo",Ce=me.status||"todo";break;case "priority":let We={urgent:0,high:1,medium:2,low:3,none:4};ve=We[J.priority]??4,Ce=We[me.priority]??4;break;case "position":return 0;default:return 0}return ve<Ce?Qe==="asc"?-1:1:ve>Ce?Qe==="asc"?1:-1:0}),S},[e,Ie,it,Pe,Ye,Qe,ho]);qt.current=xa;let en=useCallback((S,J)=>{let me=We=>{r.onTaskUpdate?.({...S,...We});},ve=We=>We?S.customFields?.find(we=>we.fieldId===We)?.value:void 0,Ce=(We,re)=>{if(!We)return;let ze=[...S.customFields||[]],at=ze.findIndex(tt=>tt.fieldId===We);at>=0?ze[at]={fieldId:We,value:re}:ze.push({fieldId:We,value:re}),me({customFields:ze});};switch(J.type){case "name":return null;case "status":return jsx(fg,{value:S.status||(S.progress===100?"completed":S.progress&&S.progress>0?"in-progress":"todo"),onChange:re=>{me({status:re,progress:re==="completed"?100:re==="in-progress"?50:0});},isDark:N,locale:f,translations:ge.status});case "priority":return jsx(hg,{value:S.priority,onChange:re=>me({priority:re}),isDark:N,locale:f});case "assignees":{let re=S.hasChildren,we=S.assignees||[];if(re&&S.subtasks?.length){let ze=new Map,at=tt=>{(tt||[]).forEach(bt=>{(bt.assignees||[]).forEach(mt=>{ze.has(mt.name)||ze.set(mt.name,mt);}),bt.subtasks?.length&&at(bt.subtasks);});};at(S.subtasks),we=Array.from(ze.values());}else re&&(we=[]);return jsx(bl,{value:we,availableUsers:c,onChange:ze=>me({assignees:ze}),isDark:N,locale:f,disabled:re})}case "startDate":return jsx(yl,{value:S.startDate,onChange:re=>me({startDate:re}),isDark:N,locale:f,dateField:"start",startDate:S.startDate,endDate:S.endDate});case "endDate":return jsx(yl,{value:S.endDate,onChange:re=>me({endDate:re}),isDark:N,locale:f,dateField:"end",startDate:S.startDate,endDate:S.endDate});case "progress":{let re=!!(S.subtasks&&S.subtasks.length>0),we=re?P0(Ud(S.subtasks||[])):S.progress||0;return jsx(Dg,{value:we,onChange:re?void 0:ze=>{let at=ze===100?"completed":ze>0?"in-progress":"todo";me({progress:ze,status:at});},isDark:N,disabled:re})}case "tags":return jsx(zg,{value:S.tags||[],isDark:N});case "text":return jsx(Mg,{value:ve(J.customFieldId)||"",onChange:re=>Ce(J.customFieldId,re),isDark:N});case "number":return jsx(Lg,{value:ve(J.customFieldId)||0,onChange:re=>Ce(J.customFieldId,re),isDark:N});case "date":let We=ve(J.customFieldId);return jsx(yl,{value:We?new Date(We):void 0,onChange:re=>Ce(J.customFieldId,re),isDark:N,locale:f});case "dropdown":return jsx(Ag,{value:ve(J.customFieldId)||"",options:J.options||[],onChange:re=>Ce(J.customFieldId,re),isDark:N});case "checkbox":return jsx(Rg,{value:ve(J.customFieldId)||false,onChange:re=>Ce(J.customFieldId,re),isDark:N});case "multiselect":return jsx(Bg,{value:ve(J.customFieldId)||[],options:J.options||[],onChange:re=>Ce(J.customFieldId,re),isDark:N,maxSelectable:J.maxSelectable});case "person":{let re=ve(J.customFieldId)||[];return jsx(bl,{value:re.map(we=>({name:we.name,avatar:we.avatar,initials:we.initials||(we.name||"?").slice(0,2).toUpperCase(),color:we.color||"#00E5CC"})),availableUsers:c,onChange:we=>Ce(J.customFieldId,we),isDark:N,locale:f})}case "file":return jsx(Hg,{value:ve(J.customFieldId),isDark:N,onOpen:re=>{re.url&&window.open(re.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let re=S.status==="completed"||S.progress===100;return jsx(Ia,{value:S.estimatedTime,onChange:we=>me({estimatedTime:we}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)})}case "quotedTime":{let re=S.status==="completed"||S.progress===100,we=F?.enabled&&(!F.columns||F.columns.includes("quotedTime"));return jsx(Ia,{value:S.quotedTime,onChange:ze=>me({quotedTime:ze}),isDark:N,locale:f,disabled:re,isBlurred:we,lens:G,hourlyRate:De(S)})}case "elapsedTime":{let re=S.status==="completed"||S.progress===100,we=S.executedDollarsCanonical;return jsx(Ia,{value:S.elapsedTime,onChange:ze=>me({elapsedTime:ze}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S),financialOverride:we})}case "effortMinutes":{if(I&&S.subtasks&&S.subtasks.length>0){let{allocated:tt}=ws(S);if(G==="financial"){let bt=Xe(S),mt=Math.round(bt.dollarAllocated),mr=Math.round(bt.dollarQuoted),xr=mr-mt;return jsxs("div",{className:"flex flex-col",children:[mt>0?jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",mt.toLocaleString("es-CO")]}):null,xr!==0&&mt>0&&mr>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",xr>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[xr>0?"+":"",Math.abs(xr)>=1e3?`$${(xr/1e3).toFixed(1)}K`:`$${xr}`]})]})}return jsx(Ia,{value:tt>0?tt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:O})}let re=S.status==="completed"||S.progress===100,we=S.effortMinutes||0,ze=S.soldEffortMinutes||0,at=De(S);if(G==="financial"&&at&&we>0&&ze>0){let tt=Math.round(we/60*at),mt=Math.round(ze/60*at)-tt;return jsxs("div",{className:"flex flex-col",children:[jsx(Ia,{value:we,onChange:mr=>me({effortMinutes:mr}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)}),mt!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",mt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[mt>0?"+":"",Math.abs(mt)>=1e3?`$${(mt/1e3).toFixed(1)}K`:`$${mt}`]})]})}return jsx(Ia,{value:we,onChange:tt=>me({effortMinutes:tt}),isDark:N,locale:f,disabled:re,lens:G,hourlyRate:De(S)})}case "timeLoggedMinutes":{let re=S.executedDollarsCanonical;if(I&&S.subtasks&&S.subtasks.length>0){let{spent:ze}=ws(S);return jsx(Ia,{value:ze>0?ze:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S),financialOverride:re})}let we=S.status==="completed"||S.progress===100;return jsx(Ia,{value:S.timeLoggedMinutes,onChange:r.onLogTime?ze=>{r.onLogTime?.(S,ze);}:void 0,isDark:N,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:we,lens:G,hourlyRate:De(S),financialOverride:re})}case "soldEffortMinutes":{if(I&&S.subtasks&&S.subtasks.length>0){let{quoted:ze}=ws(S),at=F?.enabled&&(!F.columns||F.columns.includes("soldEffortMinutes"));return jsx(Ia,{value:ze>0?ze:void 0,isDark:N,locale:f,disabled:true,isBlurred:at,lens:G,hourlyRate:De(S)})}let re=S.status==="completed"||S.progress===100,we=F?.enabled&&(!F.columns||F.columns.includes("soldEffortMinutes"));return jsx(Ia,{value:S.soldEffortMinutes,onChange:ze=>me({soldEffortMinutes:ze}),isDark:N,locale:f,disabled:re,isBlurred:we,lens:G,hourlyRate:De(S)})}case "scheduleVariance":{let re=S.effortMinutes||0,we=S.soldEffortMinutes||0,ze=S.timeLoggedMinutes||0,at=re>0||we>0||ze>0;return jsx(_g,{startDate:S.startDate,endDate:S.endDate,scheduleVariance:S.scheduleVariance,isDark:N,locale:f,hasTimeAllocated:at})}case "hoursBar":{if(I&&S.hasChildren){let{spent:re,allocated:we,quoted:ze}=ws(S),at=re>we&&we>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",N?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",at?"text-[#FF453A]":N?"text-white/80":"text-gray-800"),children:vs(re)}),we>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:N?"text-white/60":"text-gray-600",children:vs(we)})]}),ze>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:N?"text-amber-400/70":"text-amber-600",children:vs(ze)})]})]})}return jsx(qg,{task:S,isDark:N,locale:f,onLogTime:r.onLogTime,onEstimateUpdate:r.onEstimateUpdate,onSoldEffortUpdate:r.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:r.onOpenTimeLog,lens:G,hourlyRate:De(S)})}case "teamLoad":return S.hasChildren||S.subtasks&&S.subtasks.length>0?jsx(Xg,{task:S,isDark:N,locale:f}):jsx(bl,{value:S.assignees||[],availableUsers:c,onChange:we=>{r.onTaskUpdate?.({...S,assignees:we});},isDark:N,locale:f});case "blockers":return jsx(Qg,{blockers:S.blockers,isDark:N,locale:f});case "weight":{let re=Ee.get(S.id);if(re!==void 0)return jsx("span",{className:g("text-xs font-mono",re>0?N?"text-white/50":"text-gray-400":N?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:re>0?`${Number(re.toFixed(2))}%`:"\u2014"});let we=S.weight||0;return jsx(Q1,{value:we,onChange:ze=>me({weight:ze}),isDark:N})}default:return jsx("span",{className:g("text-sm",N?"text-white/60":"text-gray-500"),children:"-"})}},[r,N,f,c,ge,I,Ee]),tn=useCallback(S=>{let me={name:ge.columns.name,status:ge.columns.status,priority:ge.columns.priority,assignees:ge.columns.assignees,startDate:ge.columns.startDate,endDate:ge.columns.endDate,progress:ge.columns.progress,tags:ge.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:ge.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:ge.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:ge.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:ge.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:ge.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:ge.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:ge.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:ge.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:ge.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:ge.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:ge.columns.weight||(f==="es"?"Peso":"Weight")}[S.type]||S.label;return typeof me=="string"?me:String(me||S.type)},[ge,f]),Kn=useMemo(()=>{let me=rt.reduce((Ce,We)=>Ce+We.width,0)+(w?48:0),ve={};for(let Ce of rt)ve[Ce.id]=`${Ce.width/me*100}%`;return ve},[rt,w]);return a?jsx("div",{className:g("flex-1 flex items-center justify-center",N?"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:g("text-sm",N?"text-white/60":"text-gray-600"),children:[ge.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",N?"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:g("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:typeof n=="string"?n:n.message})]})]})}):e.length===0?jsx("div",{className:g("flex-1 flex items-center justify-center",N?"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:g("text-lg font-semibold mb-2",N?"text-white":"text-gray-900"),children:ge.empty.noTasks}),jsx("p",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:ge.empty.addFirstTask})]})}):jsxs("div",{ref:U,className:g(N?"bg-[#0D0D0D]":"bg-white",fe&&"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:g("flex-shrink-0 px-6 py-4 border-b",N?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:"flex items-center gap-4",children:[jsxs("div",{className:g("text-sm",N?"text-white/60":"text-gray-600"),children:[xa.length," ",ge.pagination.tasks]}),h&&jsxs("div",{className:"relative flex-1 max-w-md",children:[jsx(Search,{className:g("absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4",N?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Ie,onChange:S=>Ct(S.target.value),placeholder:ge.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",N?"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&&j>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:pe,onClick:()=>se(!sa),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",N?sa?"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]":sa?"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"}),pr==="all"?f==="es"?"Todos":"All":`L${pr}`]}),sa&&jsx("div",{ref:ft,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",N?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(j,5)},(S,J)=>({value:J+1,label:`L${J+1}`}))].map(S=>jsxs("button",{onClick:()=>{Kr(S.value),se(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",N?pr===S.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":pr===S.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:S.label}),pr===S.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(S.value)))})]}),jsx(k0,{value:it,hideCompleted:Pe,onChange:qe,onHideCompletedChange:xt,isDark:N,locale:f}),te?.enabled&&te.data&&!Be&&jsx("button",{onClick:()=>Se(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",N?"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,L&&k&&jsxs(motion.button,{onClick:k,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:ge.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:g("flex-shrink-0 flex items-center border-b text-[10px] font-bold uppercase tracking-wider sticky top-0 z-10",N?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[Er&&jsx("div",{className:"w-5 flex-shrink-0"}),rt.map(S=>{let J=S.id!=="name",me=ke===S.id&&de!==S.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",N?"text-white/60":"text-gray-500",J&&"cursor-grab",S.type!=="name"&&"justify-center",de===S.id&&"opacity-50",me&&(N?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Kn[S.id],minWidth:S.minWidth},draggable:J,onDragStart:J?ve=>Wo(ve,S.id):void 0,onDragEnd:J?Pn:void 0,onDragOver:J?ve=>_n(ve,S.id):void 0,onDragLeave:J?zo:void 0,onDrop:J?ve=>gi(ve,S.id):void 0,onContextMenu:ve=>Ga(ve,void 0,S.id),children:[J&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",N?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),d?jsxs("button",{draggable:false,onClick:ve=>{let Ce=ve.currentTarget.getBoundingClientRect();d(S.id,Ce);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[tn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),Ye===S.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):S.sortable?jsxs("button",{draggable:false,onClick:()=>Ut(S.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[tn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",Ye===S.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[tn(S),m?.includes(S.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:u,display:"inline-block",flexShrink:0}})]}),C&&S.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-1 cursor-col-resize group","hover:bg-[#00E5CC]",fe===S.id&&"bg-[#00E5CC]"),onMouseDown:ve=>Ba(ve,S.id)})]},S.id)}),w&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:S=>{S.stopPropagation(),A(J=>!J);},className:g("p-0.5 rounded transition-colors",N?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",ct&&(N?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(f0,{isOpen:ct,onClose:()=>A(false),columns:St,customFields:l,onColumnsChange:Qt,onCreateCustomField:()=>{A(false),B(true);},isDark:N,locale:f})]})]}),jsx(AnimatePresence,{mode:"popLayout",children:xa.map((S,J)=>{let me=oe.has(S.id),ve=Math.min(J*.01,.2),Ce=S.hasChildren&&S.level===0,We=S.subtasks?.length||0;if(Ce){let{spent:bt,allocated:mt,quoted:mr}=ws(S),xr=J1(S);return jsxs(motion.div,{"data-task-id":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:g("flex items-center border-y cursor-pointer transition-colors duration-500",N?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",Le===S.id&&(N?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>r.onTaskClick?.(S),children:[Er&&jsx("div",{className:"w-5 flex-shrink-0"}),rt.map(zr=>jsx("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",zr.type!=="name"&&"justify-center"),style:{width:Kn[zr.id],minWidth:zr.minWidth},children:zr.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:$t=>{$t.stopPropagation(),pt(S.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",N?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsx(ChevronDown,{className:g("w-4 h-4",N?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",N?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:$t=>{$t.stopPropagation(),pt(S.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:me?jsx(FolderOpen,{className:"w-4 h-4",style:{color:N?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:N?"#FFD60A":"#B45309"}})}),S.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:N?"#FFD60A":"#B45309"},children:S.wbsCode}),jsxs("div",{className:"flex flex-col min-w-0",children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",N?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:S.name}),jsxs("span",{className:g("text-[10px] font-mono",N?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),xr!==null&&v&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",xr>=1?"text-[#32D74B] bg-[#32D74B]/10":xr>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",xr.toFixed(2)]})]})]}):zr.type==="timeLoggedMinutes"?G==="financial"?(()=>{let $t=S.executedDollarsCanonical,Wt=$t!=null?Math.round($t):Math.round(Xe(S).dollarSpent);return Wt>0?jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("en-US")]}):null})():jsx(Ia,{value:bt>0?bt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):zr.type==="soldEffortMinutes"?G==="financial"?(()=>{let $t=Xe(S),Wt=Math.round($t.dollarQuoted);return Wt>0?jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("en-US")]}):null})():jsx(Ia,{value:mr>0?mr:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):zr.type==="effortMinutes"?G==="financial"?(()=>{let $t=Xe(S),Wt=Math.round($t.dollarAllocated),Et=Math.round($t.dollarQuoted),Lt=Et-Wt;return jsxs("div",{className:"flex flex-col",children:[Wt>0?jsxs("span",{className:g("text-sm font-mono",N?"text-white/60":"text-gray-500"),children:["$",Wt.toLocaleString("es-CO")]}):null,Lt!==0&&Wt>0&&Et>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lt>0?"+":"",Math.abs(Lt)>=1e3?`$${(Lt/1e3).toFixed(1)}K`:`$${Lt}`]})]})})():jsx(Ia,{value:mt>0?mt:void 0,isDark:N,locale:f,disabled:true,lens:G,hourlyRate:De(S)}):en(S,zr)},zr.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)}let re=ue===S.id,we=Fe===S.id,ze=we&&dt==="above",at=we&&dt==="below",tt=we&&dt==="child";return jsxs(motion.div,{"data-task-id":S.id,"data-listview-row":S.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ve},className:g("flex items-center border-b transition-colors relative group",N?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",Le===S.id&&(N?"!bg-[#FFD60A]/15":"!bg-yellow-100")),style:{opacity:re?.4:1,backgroundColor:tt?N?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:tt?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>r.onTaskClick?.(S),onDoubleClick:()=>r.onTaskDoubleClick?.(S),onContextMenu:bt=>Ga(bt,S),onMouseEnter:()=>Mr(S.id),onMouseLeave:()=>Mr(bt=>bt===S.id?null:bt),children:[ze&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),at&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Er&&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:bt=>ea(S.id,bt),style:{color:N?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),rt.map(bt=>{let mt=!!(S.subtasks&&S.subtasks.length>0),mr=Kt(bt.type),zr=!!mr&&!mt&&_t===S.id&&!Ft,$t=!!Ft&&!!mr&&Ft.column===mr&&_r(S.id);return jsxs("div",{className:g("flex items-center px-4 py-3 min-h-[56px]",bt.type!=="name"&&"justify-center"),style:{width:Kn[bt.id],minWidth:bt.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:[bt.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[b&&S.level>0&&jsx("div",{style:{width:`${S.level*24}px`},className:"flex-shrink-0"}),b&&S.hasChildren&&jsx("button",{onClick:Wt=>{Wt.stopPropagation(),pt(S.id);},className:g("p-0.5 rounded flex-shrink-0",N?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:me?jsx(ChevronDown,{className:g("w-4 h-4",N?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",N?"text-white/60":"text-gray-400")})}),b&&!S.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[(S.wbsCode||S.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[S.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",N?"text-[#00E5CC]":"text-[#00C4AE]"),children:S.wbsCode}),S.taskCode&&jsx("span",{className:g("text-[10px] font-mono",N?"text-white/40":"text-gray-400"),children:S.taskCode})]}),jsx("span",{className:g("truncate",S.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",S.progress===100?N?"line-through text-white/50":"line-through text-gray-400":S.hasChildren?N?"text-white":"text-gray-900":N?"text-[#D1D5DB]":"text-gray-600"),children:S.name}),S.tags?.[0]&&jsx("span",{className:"text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",style:{backgroundColor:`${S.tags[0].color}20`,color:S.tags[0].color},children:S.tags[0].name})]})]}):en(S,bt),zr&&mr&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Wt=>ha(Wt,S.id,mr,J),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}})]},bt.id)}),w&&jsx("div",{className:"w-12 flex-shrink-0"})]},S.id)})}),Ae&&xa.length>0&&(()=>{let{spent:S,allocated:J,quoted:me}=Y,ve=J-S,Ce=ve<0,We=Ce?`+${vs(Math.abs(ve))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${vs(ve)} ${f==="es"?"AHORRADO":"SAVED"}`,re=G==="financial"&&O>0,we=H?.breakdown,ze=!!we&&((we.equipment??0)>0||(we.travel??0)>0),at=we?.laborSpent!=null?we.laborSpent:H?.spent!=null?H.spent:Y.dollarSpent,tt=we?.laborAllocated!=null?we.laborAllocated:H?.allocated!=null?H.allocated:Y.dollarAllocated,bt=H?.quoted!=null?H.quoted:Y.dollarQuoted,mt=($t,Wt)=>{if(re){let Et=Wt??$t/60*O;return `$${Math.round(Et).toLocaleString("es-CO")}`}return vs($t)},mr=re?Math.abs(tt-at):0,xr=re?`+$${mr.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${Ce?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,zr=re&&ze?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",N?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:N?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[Er&&jsx("div",{className:"w-5 flex-shrink-0"}),rt.map($t=>jsx("div",{className:g("flex items-center px-4 py-3",$t.type!=="name"&&"justify-center"),style:{width:Kn[$t.id],minWidth:$t.minWidth},children:$t.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),zr&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",N?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),zr]})]}):$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:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(S,re?at:void 0)}),jsx("span",{className:g("text-[11px]",N?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",N?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(J,re?tt:void 0)})]}),J>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ce?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:re?xr:We})]}):$t.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:me>0?mt(me,re?bt:void 0):"\u2013"}):$t.type==="effortMinutes"?(()=>{if(re&&me>0&&J>0){let Wt=Math.round(bt),Et=Math.round(tt),Lt=Wt-Et,Fr=Wt>0?Math.round(Lt/Wt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:mt(J,tt)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Lt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Lt>=0?"+":"",Math.abs(Lt)>=1e3?`$${(Lt/1e3).toFixed(1)}K`:`$${Lt}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Fr,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:J>0?mt(J,re?tt:void 0):"\u2013"})})():$t.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",N?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:S>0?mt(S,re?at:void 0):"\u2013"}):$t.type==="progress"?(()=>{let Wt=P0(Ud(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",N?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Wt,"%"]})})():$t.type==="weight"?(()=>{let Wt=e||[],Et=[],Lt=ma=>{for(let Yr of ma)Et.push(Yr),Yr.subtasks?.length&&Lt(Yr.subtasks);};Lt(Wt);let kr=Et.filter(ma=>!ma.subtasks?.length||ma.subtasks.length===0).reduce((ma,Yr)=>ma+(Yr.weight||0),0),Ta=Math.abs(kr-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Ta?N?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(kr.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",N?"text-white/30":"text-gray-300"),children:"\u2013"})},$t.id)),w&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),xa.length===0&&Ie&&jsx("div",{className:"flex items-center justify-center py-12",children:jsxs("div",{className:"text-center",children:[jsx(List,{className:g("w-12 h-12 mx-auto mb-4",N?"text-white/30":"text-gray-400")}),jsx("p",{className:g(N?"text-white/60":"text-gray-600"),children:ge.empty.noResults})]})})]})}),te?.enabled&&te.data&&Be&&jsx(T0,{data:te.data,isDark:N,locale:f,onClose:()=>Se(false),lens:t?.lens,onUnassignedTaskClick:S=>{let J=document.querySelector(`[data-task-id="${S}"]`);J&&(J.scrollIntoView({behavior:"smooth",block:"center"}),$e(S),setTimeout(()=>$e(null),2e3));}})]}),jsx(o0,{state:q,onClose:lr,isDark:N,locale:f,onTaskEdit:r.onTaskEdit,onTaskDuplicate:r.onTaskDuplicate,onTaskDelete:r.onTaskDelete,onTaskUpdate:r.onTaskUpdate,onColumnHide:ya,onColumnSort:Wr,availableUsers:c,onOpenTimeLog:r.onOpenTimeLog,onReportBlocker:r.onReportBlocker,onCopyTaskLink:r.onCopyTaskLink,onTaskMove:r.onTaskMove,onTaskIndent:r.onTaskIndent,onTaskOutdent:r.onTaskOutdent}),V&&Tt&&ue&&createPortal(jsx("div",{style:{position:"fixed",left:Tt.x+12,top:Tt.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let J=Te.flattenTasks(e).find(me=>me.id===ue);return J?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:N?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${N?"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:N?"#e6edf3":"#111827"},children:J.name})]}):null})()}),document.body),jsx(y0,{isOpen:X,onClose:()=>B(false),onSave:qr,isDark:N,locale:f})]})}var I0=[{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}],R0=[{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"}],B0=[{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 Wd={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"},zd={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"},Gd={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"},Sl={dark:Wd,light:zd,neutral:Gd};function $0(e){return Sl[e]||Sl.dark}function El(e,t,r,a,n=5){let s=[],o=[],c=e.filter(p=>p.endSerial>=r&&p.startSerial<=a).sort((p,f)=>p.startSerial-f.startSerial||f.endSerial-p.endSerial);for(let p of c){let f=Math.max(p.startSerial,r),x=Math.min(p.endSerial,a),h=0;for(;(s[h]||[]).some(([b,y])=>!(x<b||f>y));)h++;(s[h]=s[h]||[]).push([f,x]),o.push({t:p,s:f,e:x,lane:h,contL:p.startSerial<r,contR:p.endSerial>a});}let l={};for(let p=r;p<=a;p++)l[p]=new Set;o.forEach(p=>{for(let f=p.s;f<=p.e;f++)l[f].add(p.lane);});let i=[],d=[],m={};t.filter(p=>p.serial>=r&&p.serial<=a).forEach(p=>{(m[p.serial]=m[p.serial]||[]).push(p);}),Object.keys(m).forEach(p=>{let f=+p,x=m[f],h=[];for(let b=0;b<n;b++)l[f].has(b)||h.push(b);if(x.length<=h.length)x.forEach((b,y)=>i.push({it:b,day:f,lane:h[y]}));else {let b=Math.max(h.length-1,0);x.slice(0,b).forEach((y,v)=>i.push({it:y,day:f,lane:h[v]})),d.push({day:f,lane:h[b]!=null?h[b]:n-1,count:x.length-b,items:x.slice(b)});}});let u=s.length;return i.forEach(p=>{u=Math.max(u,p.lane+1);}),d.forEach(p=>{u=Math.max(u,p.lane+1);}),{bars:o,chips:i,more:d,laneCount:Math.max(u,1)}}var Z1=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],eC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function O0(e){return e==="es"?Z1:eC}function H0(e){return (e.getDay()+6)%7}function U0(e,t){let r=new Date(e,t,1),a=H0(r),n=new Date(e,t,1-a),s=[];for(let m=0;m<6;m++)s.push({ws:m*7+1,we:m*7+7});let o=m=>{let u=new Date(n);return u.setDate(n.getDate()+(m-1)),u},c=m=>{let u=m.getTime()-n.getTime();return Math.floor(u/864e5)+1},l=c(r),i=new Date(e,t+1,0),d=c(i);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:c,monthStartSerial:l,monthEndSerial:d}}function oi(e,t){return H0(e.serialToDate(t))>=5}function tC(e){let t=[],r=(a,n,s)=>{for(let o of a){let c=n||o.id,l=s||o.name;t.push({t:o,phaseId:c,phaseName:l}),o.subtasks?.length&&r(o.subtasks,c,l);}};return r(e,"",""),t}function W0(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function z0(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Ml(e){let{tasks:t,grid:r,projectColor:a,hourlyRate:n,projectId:s}=e,o=tC(t),c=42,l=[];for(let{t:d,phaseId:m,phaseName:u}of o){let p=W0(d.startDate),f=W0(d.endDate);if(!p||!f)continue;let x=r.dateToSerial(p),h=r.dateToSerial(f);if(h<1||x>c)continue;let b=d.effortMinutes??0,y=Math.round(b/60*10)/10,v=d.costAtCompletion,w=v!=null?z0(v):z0(y*n),C=d.assignees?.[0],P=C?.initials||(C?.name?nC(C.name):void 0),L=d.displayId||d.wbsCode||"",k=aC(L||d.id)?"":L||d.id;l.push({uid:d.id,id:k,name:d.name,projectId:s,color:d.color,startSerial:Math.max(x,1),endSerial:Math.min(h,c),hrs:y,cost:w,critical:!!d.isCriticalPath,who:P,realStart:p,realEnd:f,phaseId:m,phaseName:u});}let i=[];return {calTasks:l,dayItems:i,isEmpty:l.length===0&&i.length===0}}var rC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function aC(e){return rC.test(e)||/^task-\d+/.test(e)}function nC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}var oC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],sC=["January","February","March","April","May","June","July","August","September","October","November","December"];function G0(e,t,r){return `${(r==="es"?oC:sC)[t]} ${e}`}var Vd=26,iC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Pl({locale:e}){let t=O0(e);return jsx("div",{className:"cal-dow",children:t.map((r,a)=>jsx("div",{className:a>=5?"wknd":"",children:r},r))})}function Fl({bar:e,ws:t,money:r,projColor:a,slotH:n=Vd}){let{t:s}=e,o=e.s-t,c=e.e-e.s+1,l="cal-bar"+(s.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":""),i=r==="$"?s.cost:`${s.hrs}h`,d={"--proj":e.color??a,left:`calc(${o}/7*100% + 3px)`,width:`calc(${c}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:l,style:d,children:[s.critical&&c>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"nom",children:s.name}),c>=3?jsx("span",{className:"val",children:i}):null]})}function Ll({chip:e,ws:t,slotH:r=Vd}){let a=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${a}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*r}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:iC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Al({more:e,ws:t,slotH:r=Vd,onClick:a}){let s={left:`calc(${e.day-t}/7*100% + 3px)`,top:`${e.lane*r}px`};return jsxs("div",{className:"cal-more",style:s,role:a?"button":void 0,tabIndex:a?0:void 0,onClick:a?()=>a(e):void 0,children:["+",e.count," m\xE1s"]})}function V0({projects:e}){return jsxs("div",{className:"cal-legend",children:[e.map(t=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:t.color}}),t.id?`${t.id} `:"",t.name]},t.id||t.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," Ausencia"]})]})}var uC=[{id:"mes",lbl:"Mes",key:"M"},{id:"semana",lbl:"Semana",key:"W"},{id:"lookahead",lbl:"Lookahead",key:"2"},{id:"agenda",lbl:"Agenda",key:"A"}];function j0({view:e,onViewChange:t,money:r,onMoneyChange:a,mostrarConmutadorDeDinero:n,projectLabel:s}){return jsxs("div",{className:"cal-topbar",children:[jsxs("div",{className:"cal-projsel",children:[s,jsx("span",{className:"caret",children:"\u25BE"})]}),jsx("div",{className:"cal-spacer"}),jsx("div",{className:"cal-seg",children:uC.map(o=>jsxs("button",{type:"button",className:e===o.id?"on":"",onClick:()=>t(o.id),children:[o.lbl,jsx("span",{className:"key",children:o.key})]},o.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:r==="$"?"":"on",onClick:()=>a("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:r==="$"?"on":"",onClick:()=>a("$"),children:"$"})]})]})}function _0({monthLabel:e,onPrev:t,onNext:r,onToday:a,layersOpen:n,onToggleLayers:s,layersOff:o,phases:c,phaseFilter:l="all",onPhaseChange:i,locale:d="es",children:m}){let u=o?o.length:0,[p,f]=useState(false),x=useRef(null),h=d==="es";useEffect(()=>{if(!p)return;let y=v=>{x.current&&!x.current.contains(v.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[p]);let b=l==="all"?h?"Todas":"All":c?.find(y=>y.id===l)?.name??(h?"Todas":"All");return jsxs("div",{className:"cal-toolbar",children:[jsxs("div",{className:"cal-nav-arrows",children:[jsx("button",{type:"button",onClick:t,"aria-label":"Periodo anterior",children:"\u2039"}),jsx("button",{type:"button",onClick:r,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:a,children:h?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),c&&c.length>0&&i?jsxs("div",{className:"relative",ref:x,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:l!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:h?"Fase":"Phase"})," ",b," \u25BE"]}),p?jsxs("div",{className:"cal-pop",style:{position:"absolute",top:"36px",left:0,zIndex:40,width:240,maxHeight:320,overflowY:"auto"},children:[jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{i("all"),f(false);},children:jsx("span",{className:"nm",children:h?"Todas las fases":"All phases"})}),c.map(y=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:l===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{i(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,m,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",h?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-u,"/6"]})]})})]})}var pC=[{id:"tareas",nm:"Tareas",sub:"Barras del Gantt",sw:"var(--p26011)"},{id:"cpm",nm:"Ruta cr\xEDtica",sub:"CPM \xB7 borde cian",sw:"var(--cyan)"},{id:"hitos",nm:"Milestones",sub:"Rombo cian",sw:"var(--cyan)"},{id:"ext",nm:"Eventos externos",sub:"Google / Outlook \xB7 lectura",sw:"var(--subtle)"},{id:"festivos",nm:"Festivos",sub:"Calendario Colombia",sw:"var(--subtle)"},{id:"aus",nm:"Ausencias del equipo",sub:"Vacaciones \xB7 permisos",sw:"var(--orange)"}];function K0({off:e,onToggle:t}){let r=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:pC.map(a=>{let n=r.includes(a.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(a.id),children:[jsx("span",{className:"sw",style:{background:a.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:a.nm}),jsx("div",{className:"sub",children:a.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},a.id)})})}var fC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},bC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function Y0({dayLabel:e,items:t,tasks:r=[],itemValue:a,onClose:n,style:s}){let o=useRef(null);useEffect(()=>{function d(u){o.current&&!o.current.contains(u.target)&&n();}function m(u){u.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let c=r.length+t.length,i=a||(d=>{switch(d.type){case "hito":return "Hito";case "desembolso":return "Desemb.";case "deadline":return "Vence";case "aus":return "Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:o,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${c} elementos`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",c," ",c===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[r.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"sw",style:{background:d.swatch}}),d.taskId?jsx("span",{className:"tk",children:d.taskId}):null,jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),d.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:"8px",letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:"3px",padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,jsx("span",{className:"v",children:d.value})]},`t${m}`)),t.map((d,m)=>jsxs("div",{className:"cal-pop-item",children:[jsx("span",{className:"ico",style:{color:bC[d.type]},children:fC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:i(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var q0={es:{title:"Sin tareas programadas este mes",upcoming:"Pr\xF3ximos hitos",body:"Las tareas con fecha en este mes aparecer\xE1n aqu\xED.",crear:"Crear una tarea"},en:{title:"No tasks scheduled this month",upcoming:"Upcoming milestones",body:"Tasks with dates in this month will show up here.",crear:"Create a task"}};function X0({monthLabel:e,upcomingMilestones:t=[],locale:r="es",onCreateTask:a}){let n=q0[r]||q0.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:n.title}),jsxs("p",{children:[n.body,jsx("br",{}),jsx("b",{children:e})]}),a?jsx("button",{type:"button",className:"cal-empty-crear",onClick:a,children:n.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:n.upcoming}),t.map((s,o)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(s.type==="deadline"?"rd":"cy"),children:s.type==="deadline"?"\u2691":"\u25C6"}),s.label,jsx("span",{className:"d",children:s.date})]},o))]}):null]})}function Q0(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function xC(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():(t[0][0]+t[t.length-1][0]).toUpperCase()}var J0=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function vC(e){return J0[e%J0.length]}function wC(e){return e>1?"over":e>=.9?"warn":"ok"}var jd="\xA0";function Ro(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function Z0(e,t,r){let a=new Map,n=new Set;for(let c of t)c.isWeekend||c.isHoliday||n.add(Q0(c.date));if(n.size===0)return a;let s=new Map;e.forEach((c,l)=>{s.set(c.userId,{color:vC(l),initials:xC(c.name)});});let o=new Map;for(let c of e)for(let l of c.dailyEstimated){if(!l.date||!n.has(l.date))continue;o.has(l.date)||o.set(l.date,new Map);let i=o.get(l.date);i.set(c.userId,(i.get(c.userId)??0)+(l.hours||0));}for(let c of n){let l=o.get(c)??new Map,i=e.map(m=>{let u=s.get(m.userId);return {name:m.name,initials:u.initials,color:u.color,hours:Math.round((l.get(m.userId)??0)*100)/100,capacity:r}}),d=i.reduce((m,u)=>m+u.hours,0);a.set(c,{assigned:Math.round(d*100)/100,capacity:r*e.length,perPerson:i});}return a}function ef({days:e,capByDay:t,selectedKey:r,onSelectDay:a}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=Q0(n.date),o=n.isWeekend||n.isHoliday,c=o?void 0:t.get(s),l=!!c&&c.capacity>0,i=l?c.assigned/c.capacity:0,m="cal-cap-cell "+(o?"off":wC(i))+(r===s?" sel":""),u=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:m,role:l&&a?"button":void 0,tabIndex:l&&a?0:void 0,title:o?void 0:u,onClick:p=>{!l||!a||a(s,u,p.currentTarget);},onKeyDown:p=>{!l||!a||(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a(s,u,p.currentTarget));},children:[jsx("div",{className:"nums",children:o||!l?jsx("span",{children:o?"\u2014":`0h${jd}/${jd}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[Ro(c.assigned),"h"]}),jsxs("span",{children:["/",jd,Ro(c.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:l?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(i*100,100)+"%"}}):null})]},n.serial)})})}function tf({dayLabel:e,perPerson:t,onClose:r,style:a}){let n=useRef(null);useEffect(()=>{let i=m=>{m.key==="Escape"&&r();},d=m=>{n.current&&!n.current.contains(m.target)&&r();};return document.addEventListener("keydown",i),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",i),document.removeEventListener("mousedown",d);}},[r]);let s=t.reduce((i,d)=>i+d.hours,0),o=t.reduce((i,d)=>i+d.capacity,0),c=o>0&&s>o,l=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...a},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:c?{color:"var(--red)"}:void 0,children:[Ro(s),"h asignadas / ",Ro(o),"h"]}),c?jsx("div",{className:"rng",children:jsxs("b",{children:["+",Ro(l),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(i=>{let d=i.capacity>0&&i.hours>i.capacity,m=i.capacity>0?i.capacity:1;return jsxs("div",{className:d?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:i.color},children:i.initials}),jsx("span",{className:"nm",title:i.name,children:i.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(i.hours/m*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[Ro(i.hours),"h / ",Ro(i.capacity),"h"]})]},i.name)})})]})}var _d=28,CC=182;function af({grid:e,weeks:t,tasks:r,items:a,money:n,projColor:s,todaySerial:o,locale:c,capRows:l,teamSize:i,onTaskOpen:d,onMore:m,onCapDay:u}){let p=c==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,x)=>jsxs("div",{style:{display:"contents"},children:[jsx(TC,{grid:e,ws:f.ws,we:f.we,tasks:r,items:a,money:n,projColor:s,todaySerial:o,onTaskOpen:d,onMore:m}),l&&l[x]?jsx(ef,{days:l[x].days,capByDay:l[x].capByDay,onSelectDay:u}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[p?"Capacidad del equipo":"Team capacity",i!=null?` \xB7 ${i} ${p?i===1?"persona":"personas":i===1?"person":"people"}`:""]}),jsx("span",{children:p?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function TC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,onTaskOpen:l,onMore:i}){let d=useMemo(()=>El(a,n,t,r),[a,n,t,r]),m=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),u=[];for(let f=t;f<=r;f++)u.push(f);let p={height:`${CC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:p,children:[jsx("div",{className:"cal-week-bg",children:u.map(f=>{let x=e.serialToDate(f),h=f>=e.monthStartSerial&&f<=e.monthEndSerial,b="cal-day";return oi(e,f)&&(b+=" wknd"),h||(b+=" out"),f===c&&(b+=" today"),m.has(f)&&(b+=" deadline-day"),jsx("div",{className:b,children:jsx("span",{className:"cal-day-num",children:x.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[d.bars.map((f,x)=>jsx("div",{onClick:()=>l?.(f.t.uid),style:{cursor:l?"pointer":"default",display:"contents"},children:jsx(Fl,{bar:f,ws:t,money:s,projColor:o,slotH:_d})},`b${x}`)),d.chips.map((f,x)=>jsx(Ll,{chip:f,ws:t,slotH:_d},`c${x}`)),d.more.map((f,x)=>jsx(Al,{more:f,ws:t,slotH:_d,onClick:()=>i(f.day,f.items,a.filter(h=>h.startSerial<=f.day&&h.endSerial>=f.day))},`m${x}`))]})]})}var NC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function DC(e){return NC.test(e)||/^task-\d+/.test(e)}function SC(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function nf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function EC(e){let t=[],r=a=>{for(let n of a)t.push(n),n.subtasks?.length&&r(n.subtasks);};return r(e),t}function of(e,t){let r=EC(e),a=[];for(let n of r){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,c=n.costAtCompletion,l=c!=null?nf(c):nf(o*t),i=n.assignees?.[0],d=i?.initials||(i?.name?SC(i.name):void 0),m=n.displayId||n.wbsCode||"",u=DC(m||n.id)?"":m||n.id;a.push({taskId:n.id,id:u,name:n.name,hrs:o,cost:l,who:d,projColor:n.color});}return a}function sf({items:e,onItemClick:t,onCollapse:r,money:a,projColor:n}){return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsx("span",{className:"t",children:"\u26A1 Backlog \xB7 Sin fecha"}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:r,title:"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:"Arrastra al calendario"}),jsx("span",{children:e.length})]}),e.length===0?jsx("div",{style:{padding:"24px 16px",fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.08em",color:"var(--subtle)",textAlign:"center"},children:"Sin tareas en backlog"}):e.map(s=>{let o=a==="$"?s.cost:`${s.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(s.taskId),onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),t(s.taskId));},children:[jsxs("div",{className:"row1",children:[s.id?jsx("span",{className:"tk",children:s.id}):null,jsx("span",{className:"pdot",style:{background:s.projColor||n}})]}),jsx("div",{className:"nom",children:s.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[s.hrs,"h"]})," est"]}),jsx("span",{children:o}),s.who?jsx("span",{className:"cal-ava",children:s.who}):null]})]},s.taskId)})]})}function lf({onExpand:e}){return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),e());},title:"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsx("span",{className:"vtxt",children:"Backlog \xB7 Estado"})]})}function Cs(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function cf({taskName:e,taskId:t,sim:r,busy:a,locale:n,onConfirm:s,onCancel:o,style:c}){let l=useRef(null),i=n==="es";useEffect(()=>{let f=x=>{x.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let d=r.wasCritical,m=r.projectEndDeltaDays,u=m>0?`+${m} ${i?m===1?"d\xEDa":"d\xEDas":m===1?"day":"days"} \xB7 ${Cs(r.oldProjectEnd,n)} \u2192 ${Cs(r.newProjectEnd,n)}`:`+0 ${i?"d\xEDas":"days"}${r.slackDays>0?` \xB7 ${i?"holgura":"slack"} ${r.slackDays}d`:""}`,p=m>0?i?`Confirmar +${m} ${m===1?"d\xEDa":"d\xEDas"}`:`Confirm +${m} ${m===1?"day":"days"}`:i?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:l,className:"cal-pop",style:{width:"324px",zIndex:60,...c},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:i?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[Cs(r.oldStart,n)," \u2013 ",Cs(r.oldEnd,n)," \u2192 ",jsxs("b",{children:[Cs(r.newStart,n)," \u2013 ",Cs(r.newEnd,n)]})]})]}),d?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",i?"Esta tarea est\xE1 en ruta cr\xEDtica":"This task is on the critical path"]}):null,jsxs("div",{className:"cal-impact",children:[jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:r.movedSuccessors.length===0?i?"Ninguna":"None":`${r.movedSuccessors.length}${r.movedSuccessors.length<=2?" \xB7 "+r.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Fin de proyecto":"Project end"}),jsx("span",{className:m>0?"v bad":"v good",children:u})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:i?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:r.stillCritical?i?"Sigue en CPM":"Stays critical":r.wasCritical?i?"Sale de CPM":"Leaves critical":i?`No entra \xB7 holgura ${r.slackDays}d`:`Not critical \xB7 slack ${r.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:a,children:i?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:d||m>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:a,children:a?i?"Guardando\u2026":"Saving\u2026":p})]})]})}var LC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function df({grid:e,tasks:t,items:r,money:a,projColor:n,todaySerial:s,locale:o,onTaskOpen:c}){let l=o==="es",i=useMemo(()=>{let m=new Map,u=p=>(m.has(p)||m.set(p,{serial:p,date:e.serialToDate(p),tasks:[],items:[]}),m.get(p));for(let p of t)p.startSerial>=1&&p.startSerial<=42&&u(p.startSerial).tasks.push(p);for(let p of r)p.serial>=1&&p.serial<=42&&u(p.serial).items.push(p);return [...m.values()].filter(p=>p.tasks.length||p.items.length).sort((p,f)=>p.serial-f.serial)},[t,r,e]);if(i.length===0)return jsxs("div",{className:"cal-empty",style:{position:"static",padding:"60px 24px"},children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:l?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:l?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let d=m=>m.toLocaleDateString(l?"es-CO":"en-US",{weekday:"long",day:"numeric",month:"short"});return jsx("div",{className:"cal-agenda",style:{overflowY:"auto",flex:1,minHeight:0,padding:"8px 0",maxHeight:"calc(100vh - 150px)"},children:i.map(m=>jsxs("div",{className:"cal-agenda-day",children:[jsxs("div",{className:"cal-agenda-date",style:{fontFamily:"var(--mono)",fontSize:"10px",letterSpacing:"0.1em",textTransform:"uppercase",color:m.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[d(m.date),m.serial===s?` \xB7 ${l?"HOY":"TODAY"}`:""]}),m.tasks.map(u=>jsxs("button",{type:"button",onClick:()=>c?.(u.uid),className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",width:"100%",textAlign:"left",padding:"8px 20px",background:"transparent",border:"none",cursor:"pointer",color:"var(--txt)",fontSize:"12.5px"},children:[jsx("span",{style:{width:8,height:8,borderRadius:2,background:u.color??n,flex:"none"}}),u.critical?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:8,letterSpacing:"0.1em",color:"#031",background:"var(--cyan)",borderRadius:3,padding:"1.5px 3.5px",fontWeight:700},children:"CPM"}):null,u.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:u.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:a==="$"?u.cost:`${u.hrs}h`})]},u.uid)),m.items.map((u,p)=>jsxs("div",{className:"cal-agenda-item",style:{display:"flex",alignItems:"center",gap:"10px",padding:"8px 20px",fontSize:"12.5px",color:"var(--txt2)"},children:[jsx("span",{style:{width:8,textAlign:"center",flex:"none"},children:LC[u.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u.label})]},`it${p}`))]},m.serial))})}function AC(e){let t=[],r=a=>a.forEach(n=>{t.push(n),n.subtasks?.length&&r(n.subtasks);});return r(e),t}function Il(e){let t=e.dependencies;return Array.isArray(t)?t.map(r=>typeof r=="string"?r:r?.id).filter(r=>!!r):[]}function Kd(e){let t=e.startDate?new Date(e.startDate):null,r=e.endDate?new Date(e.endDate):null;return !t||!r?1:Math.max(1,Math.round((r.getTime()-t.getTime())/864e5))}function uf(e,t){let r=new Map(e.map(i=>[i.id,i])),a=new Map;for(let i of e)for(let d of Il(i))a.has(d)||a.set(d,[]),a.get(d).push(i.id);let n=new Map,s=new Map,o=new Set,c=i=>{if(s.has(i))return s.get(i);if(o.has(i))return s.get(i)??0;o.add(i);let d=r.get(i);if(!d)return o.delete(i),0;let m=Il(d).filter(f=>r.has(f)),u=t.has(i)?t.get(i):d.startDate?new Date(d.startDate).getTime():0;for(let f of m){let x=c(f);x>u&&(u=x);}let p=Kd(d)*864e5;return n.set(i,u),s.set(i,u+p),o.delete(i),s.get(i)};for(let i of e)c(i.id);let l=0;return s.forEach(i=>{i>l&&(l=i);}),{finish:s,start:n,projectEnd:l}}function pf(e,t,r){let a=new Map(e.map(l=>[l.id,l])),n=new Map;for(let l of e)for(let i of Il(l))n.has(i)||n.set(i,[]),n.get(i).push(l.id);let s=new Map,o=[...e].sort((l,i)=>(t.get(i.id)??0)-(t.get(l.id)??0));for(let l of o){let i=n.get(l.id)??[];if(i.length===0)s.set(l.id,r);else {let d=1/0;for(let m of i){let u=s.get(m),p=a.get(m);u!=null&&p&&(d=Math.min(d,u-Kd(p)*864e5));}s.set(l.id,d===1/0?r:d);}}let c=new Set;for(let l of e){let i=(s.get(l.id)??0)-(t.get(l.id)??0);Math.abs(i)<864e5/2&&Il(l).length+(n.get(l.id)?.length??0)>0&&c.add(l.id);}return c}function Rl(e,t,r,a){let n=AC(e),s=n.find(b=>b.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),c=new Date(s.endDate),l=uf(n,new Map),i=pf(n,l.finish,l.projectEnd),d=n.map(b=>b.id===t?{...b,startDate:r,endDate:a}:b),m=uf(d,new Map([[t,r.getTime()]])),u=pf(d,m.finish,m.projectEnd),p=new Map(d.map(b=>[b.id,b])),f=[];for(let b of n){if(b.id===t)continue;let y=l.start.get(b.id),v=m.start.get(b.id);if(y!=null&&v!=null&&Math.abs(v-y)>=864e5/2){let w=Kd(p.get(b.id))*864e5;f.push({id:b.id,name:b.name,newStart:new Date(v),newEnd:new Date(v+w)});}}let x=Math.round((m.projectEnd-l.projectEnd)/864e5),h=i.has(t)?0:Math.max(0,Math.round((l.projectEnd-(l.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:c,newStart:r,newEnd:a,movedSuccessors:f,projectEndDeltaDays:x,oldProjectEnd:new Date(l.projectEnd),newProjectEnd:new Date(m.projectEnd),wasCritical:i.has(t),stillCritical:u.has(t),slackDays:h}}function mf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var BC=132,Bl=26,$C="#5B7FD4";function gf({tasks:e,projectName:t,projectId:r,projectColor:a,locale:n,themeMode:s,hourlyRate:o,money:c,onMoneyChange:l,onTaskOpen:i,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:u,canReschedule:p,onReschedule:f,members:x=[],holidayDates:h=[],timesheetSettings:b,onVisibleRangeChange:y}){let[v,w]=useState("mes"),[C,P]=useState(()=>{let V=new Date,ye={y:V.getFullYear(),m:V.getMonth()},Fe=(e??[]).map(Ze=>Ze.startDate?new Date(Ze.startDate):null).filter(Ze=>!!Ze&&!isNaN(Ze.getTime()));if(Fe.length===0||(e??[]).some(Ze=>{let Tt=Ze.startDate?new Date(Ze.startDate):null,gt=Ze.endDate?new Date(Ze.endDate):Tt;if(!Tt||isNaN(Tt.getTime()))return false;let rr=new Date(ye.y,ye.m,1),ar=new Date(ye.y,ye.m+1,0,23,59,59);return Tt<=ar&&(gt??Tt)>=rr}))return ye;let dt=Fe.reduce((Ze,Tt)=>Ze<Tt?Ze:Tt);return {y:dt.getFullYear(),m:dt.getMonth()}}),[L,k]=useState(false),[D,F]=useState([]),[E,G]=useState("all"),[O,ee]=useState(null),[I,Ae]=useState(null),[H,ge]=useState(false),[N,De]=useState(null),[Xe,He]=useState(false),Y=useMemo(()=>U0(C.y,C.m),[C.y,C.m]),Ee=a||$C,te=useMemo(()=>{let V=new Set;for(let ye of h){let Fe=new Date(`${ye}T12:00:00`),Ue=Y.dateToSerial(Fe);Ue>=1&&Ue<=42&&V.add(Ue);}return V},[h,Y]);useEffect(()=>{y?.({start:mf(Y.serialToDate(1)),end:mf(Y.serialToDate(42))});},[C.y,C.m]);let Be=x.length,Se=useMemo(()=>{let V=b?.hoursPerDay;if(!V)return 8;let ye=[V.monday,V.tuesday,V.wednesday,V.thursday,V.friday].map(Fe=>Fe||0).filter(Fe=>Fe>0);return ye.length?Math.round(ye.reduce((Fe,Ue)=>Fe+Ue,0)/ye.length*10)/10:8},[b]),Le=useMemo(()=>Ml({tasks:e,grid:Y,projectColor:()=>Ee,hourlyRate:o,projectId:r}),[e,Y,Ee,o,r]),$e=useMemo(()=>{if(d===false)return [];let V=new Map;for(let ye of Le.calTasks)ye.phaseId&&ye.phaseName&&V.set(ye.phaseId,ye.phaseName);return [...V.entries()].map(([ye,Fe])=>({id:ye,name:Fe})).sort((ye,Fe)=>ye.name.localeCompare(Fe.name))},[Le.calTasks,d]),Ye=!D.includes("tareas"),le=!D.includes("cpm"),Qe=useMemo(()=>{let V=Ye?Le.calTasks:[];return E!=="all"&&(V=V.filter(ye=>ye.phaseId===E)),le||(V=V.map(ye=>ye.critical?{...ye,critical:false}:ye)),V},[Le.calTasks,Ye,le,E]),je=useMemo(()=>{let V=new Set;return D.includes("hitos")&&(V.add("hito"),V.add("desembolso")),D.includes("ext")&&V.add("ext"),D.includes("aus")&&V.add("aus"),Le.dayItems.filter(ye=>!V.has(ye.type))},[Le.dayItems,D]),Ie=!D.includes("festivos"),Ct=new Date,it=Y.dateToSerial(new Date(Ct.getFullYear(),Ct.getMonth(),Ct.getDate())),qe=V=>F(ye=>ye.includes(V)?ye.filter(Fe=>Fe!==V):[...ye,V]),Pe=()=>P(V=>{let ye=new Date(V.y,V.m-1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),xt=()=>P(V=>{let ye=new Date(V.y,V.m+1,1);return {y:ye.getFullYear(),m:ye.getMonth()}}),St=()=>{let V=new Date;P({y:V.getFullYear(),m:V.getMonth()});},Re=(V,ye,Fe)=>{if(!p||ye===0)return;let Ue=Le.calTasks.find(rr=>rr.uid===V);if(!Ue)return;let dt=ye*864e5,Ze=new Date(Ue.realStart.getTime()+dt),Tt=new Date(Ue.realEnd.getTime()+dt),gt=Rl(e,V,Ze,Tt);gt&&De({uid:V,taskId:Ue.id,taskName:Ue.name,sim:gt,anchor:Fe});},ct=async()=>{if(!N||!f)return;He(true);let V=[{id:N.uid,startDate:N.sim.newStart,endDate:N.sim.newEnd},...N.sim.movedSuccessors.map(Fe=>({id:Fe.id,startDate:Fe.newStart,endDate:Fe.newEnd}))],ye=await f(V);He(false),ye&&De(null);},A=G0(C.y,C.m,n),X=[{id:"",name:t,color:Ee}],B=useMemo(()=>of(e,o),[e,o]),q=useMemo(()=>{if(v==="lookahead"){let V=Y.weeks.find(Fe=>it>=Fe.ws&&it<=Fe.we)??Y.weeks[0],ye=Y.weeks.indexOf(V);return Y.weeks.slice(ye,ye+2)}return v==="semana"?[Y.weeks.find(ye=>it>=ye.ws&&it<=ye.we)??Y.weeks[0]]:[]},[v,Y.weeks,it]),ce=useMemo(()=>{let V={};return q.forEach((ye,Fe)=>{let Ue=[];for(let Ze=ye.ws;Ze<=ye.we;Ze++)Ue.push({serial:Ze,date:Y.serialToDate(Ze),isWeekend:oi(Y,Ze),isHoliday:te.has(Ze)});let dt=Z0(x,Ue,Se);V[Fe]={days:Ue,capByDay:dt};}),V},[q,Y,te,x,Se]),ue=v==="semana"||v==="lookahead",_e=v==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[jsx(j0,{view:v,onViewChange:w,money:c==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:V=>l(V==="$"?"$":"Hrs"),projectLabel:t,locale:n}),jsx(_0,{monthLabel:A,onPrev:Pe,onNext:xt,onToday:St,layersOpen:L,onToggleLayers:()=>k(V=>!V),layersOff:D,phases:$e,phaseFilter:E,onPhaseChange:G,locale:n,children:L?jsx(K0,{off:D,onToggle:qe}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:_e?"hidden":void 0},children:[_e?jsx(df,{grid:Y,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,locale:n,onTaskOpen:i}):ue?jsxs(Fragment,{children:[jsx(Pl,{locale:n}),jsx(af,{grid:Y,weeks:q,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,locale:n,capRows:ce,teamSize:Be,onTaskOpen:i,onMore:(V,ye,Fe)=>ee({day:V,items:ye,tasks:Fe}),onCapDay:(V,ye,Fe)=>{for(let Ue of Object.keys(ce)){let dt=ce[+Ue].capByDay.get(V);if(dt){Ae({dayLabel:ye,perPerson:dt.perPerson,anchor:Fe.getBoundingClientRect()});break}}}})]}):Le.isEmpty?jsxs(Fragment,{children:[jsx(Pl,{locale:n}),jsx("div",{className:"cal-weeks",children:Y.weeks.map(V=>jsx(ff,{grid:Y,ws:V.ws,we:V.we,todaySerial:it,showFestivos:Ie,holidaySerials:te,locale:n,deadlineDays:new Set},V.ws))}),jsx(X0,{monthLabel:A,locale:n,onCreateTask:u})]}):jsxs(Fragment,{children:[jsx(Pl,{locale:n}),jsx("div",{className:"cal-weeks",children:Y.weeks.map(V=>jsx(OC,{grid:Y,ws:V.ws,we:V.we,tasks:Qe,items:je,money:c,projColor:Ee,todaySerial:it,showFestivos:Ie,holidaySerials:te,locale:n,onTaskOpen:i,onMore:(ye,Fe,Ue)=>ee({day:ye,items:Fe,tasks:Ue}),canReschedule:p,onDragReschedule:Re,pendingGhost:N?{uid:N.uid,days:Math.round((N.sim.newStart.getTime()-N.sim.oldStart.getTime())/864e5)}:null},V.ws))})]}),O?jsx(Y0,{dayLabel:`${Y.serialToDate(O.day).getDate()}`,items:O.items,tasks:O.tasks.map(V=>({swatch:Ee,taskId:V.id,label:V.name,critical:V.critical,value:c==="$"?V.cost:`${V.hrs}h`})),onClose:()=>ee(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40}}):null,I?jsx(tf,{dayLabel:I.dayLabel,perPerson:I.perPerson,onClose:()=>Ae(null),style:{position:"fixed",top:`${I.anchor.top-8}px`,left:`${I.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,N?jsx(cf,{taskName:N.taskName,taskId:N.sim.taskId,sim:N.sim,busy:Xe,locale:n,onConfirm:ct,onCancel:()=>De(null),style:{position:"fixed",top:`${N.anchor.top+12}px`,left:`${Math.min(N.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),H?jsx(sf,{items:B,money:c,projColor:Ee,onItemClick:V=>i?.(V),onCollapse:()=>ge(false)}):jsx(lf,{onExpand:()=>ge(true)})]}),jsx(V0,{projects:X})]})}function ff({grid:e,ws:t,we:r,todaySerial:a,showFestivos:n,holidaySerials:s,deadlineDays:o}){let c=[];for(let l=t;l<=r;l++)c.push(l);return jsx("div",{className:"cal-week-bg",children:c.map(l=>{let i=e.serialToDate(l),d=l>=e.monthStartSerial&&l<=e.monthEndSerial,m=n&&s.has(l),u="cal-day";return oi(e,l)&&(u+=" wknd"),m&&(u+=" festivo"),d||(u+=" out"),l===a&&(u+=" today"),o.has(l)&&(u+=" deadline-day"),jsxs("div",{className:u,children:[jsx("span",{className:"cal-day-num",children:i.getDate()}),m?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},l)})})}function OC({grid:e,ws:t,we:r,tasks:a,items:n,money:s,projColor:o,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,onTaskOpen:m,onMore:u,canReschedule:p,onDragReschedule:f,pendingGhost:x}){let h=useMemo(()=>El(a,n,t,r),[a,n,t,r]),b=useMemo(()=>new Set(n.filter(L=>L.type==="deadline").map(L=>L.serial)),[n]),y=Math.max(BC,h.laneCount*Bl+36),v=useRef(null),[w,C]=useState(null),P=(L,k)=>{if(!p||!f){m?.(k);return}L.preventDefault();let D=v.current;if(!D)return;let F=D.getBoundingClientRect().width/7,E=L.clientX,G=0,O=I=>{let Ae=Math.round((I.clientX-E)/F);G=Ae,C({id:k,days:Ae});},ee=I=>{if(window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",ee),C(null),G===0){m?.(k);return}let Ae=new DOMRect(I.clientX,I.clientY,0,0);f(k,G,Ae);};window.addEventListener("pointermove",O),window.addEventListener("pointerup",ee);};return jsxs("div",{ref:v,className:"cal-week",style:{minHeight:`${y}px`},children:[jsx(ff,{grid:e,ws:t,we:r,todaySerial:c,showFestivos:l,holidaySerials:i,locale:d,deadlineDays:b}),jsxs("div",{className:"cal-items",children:[h.bars.map((L,k)=>{let D=w?.id===L.t.uid?w.days:null,F=x?.uid===L.t.uid?x.days:null,E=D??F??0,G=D==null&&F!=null,O=E!==0?{...L,s:L.s+E,e:L.e+E}:L;return jsx("div",{onPointerDown:ee=>P(ee,L.t.uid),style:{cursor:p?"grab":m?"pointer":"default",display:"contents",opacity:G?.6:1},children:jsx(Fl,{bar:O,ws:t,money:s,projColor:o,slotH:Bl})},`b${k}`)}),h.chips.map((L,k)=>jsx(Ll,{chip:L,ws:t,slotH:Bl},`c${k}`)),h.more.map((L,k)=>jsx(Al,{more:L,ws:t,slotH:Bl,onClick:()=>u(L.day,L.items,a.filter(D=>D.startSerial<=L.day&&D.endSerial>=L.day))},`m${k}`))]})]})}function UC({stack:e,cards:t,renderCard:r,onCardClick:a,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:c}){let[l,i]=useState(false),d=useMemo(()=>t.filter(p=>e.cardIds.includes(p.id)),[t,e.cardIds]),m=useMemo(()=>{let p=d.length,f=new Set(d.flatMap(b=>b.assignedUserIds||[])).size,x=d.map(b=>b.priority).filter(Boolean),h=new Set(d.flatMap(b=>b.labels||[])).size;return {totalCards:p,uniqueAssignees:f,priorities:x,labels:h}},[d]),u=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",c),onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:u,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:g("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"]})]}),l&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:p=>{p.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:d.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:d.map(p=>jsxs("div",{className:"card-stack-card-wrapper",children:[r?jsx("div",{onClick:()=>a?.(p),children:r(p)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>a?.(p),children:[jsx("h4",{children:p.title}),p.description&&jsxs("p",{children:[p.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,p.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"})]})})]},p.id))})})]})}var hf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function ii(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 li(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 yf(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 xf({events:e,filter:t,onFilterChange:r,onClearFilter:a,onEventClick:n,selectedEventId:s,config:o,className:c}){let l=useMemo(()=>({...hf,...o}),[o]),[i,d]=useState(new Set),m=useRef(null),u=useMemo(()=>{if(!l.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(v=>{let w=v.timestamp.toISOString().split("T")[0],C=y.get(w);C?C.push(v):y.set(w,[v]);}),Array.from(y.entries()).sort((v,w)=>w[0].localeCompare(v[0])).map(([v,w])=>({date:new Date(v),events:w.sort((C,P)=>P.timestamp.getTime()-C.timestamp.getTime())}))},[e,l.groupByDay]),{uniqueUsers:p,uniqueTypes:f}=useMemo(()=>{let y=new Set,v=new Set;return e.forEach(w=>{y.add(w.userId),v.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(v)}},[e]),x=y=>{d(v=>{let w=new Set(v);return w.has(y)?w.delete(y):w.add(y),w});},h=y=>{let w=new Date().getTime()-y.getTime(),C=Math.floor(w/6e4),P=Math.floor(w/36e5),L=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:P<24?`${P}h ago`:L<7?`${L}d ago`:y.toLocaleDateString()},b=useMemo(()=>{let y=0;return t.types&&t.types.length>0&&y++,t.users&&t.users.length>0&&y++,t.dateRange&&y++,t.searchTerm&&y++,y},[t]);return useEffect(()=>{if(s&&m.current){let y=m.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",c),children:[jsx("div",{className:"history-timeline-empty-icon",children:"\u{1F4DC}"}),jsx("p",{className:"history-timeline-empty-text",children:"No history events yet"}),jsx("p",{className:"history-timeline-empty-subtext",children:"Changes to this card will appear here"})]}):jsxs("div",{className:g("history-timeline",l.compact&&"compact",c),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,types:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[li(y)," ",y.replace("_"," ")]},y))]}),p.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let v=y.target.value;r({...t,users:v?[v]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),p.map(y=>jsx("option",{value:y,children:y},y))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:y=>r({...t,searchTerm:y.target.value})})]}),b>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:a,children:["Clear filters (",b,")"]})]}),jsx("div",{className:"history-timeline-container",ref:m,children:u.map(y=>jsxs("div",{className:"history-timeline-group",children:[l.groupByDay&&y.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:y.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[y.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:y.events.map((v,w)=>{let C=i.has(v.id),P=s===v.id,L=yf(v.type);return jsxs("div",{"data-event-id":v.id,className:g("history-timeline-event",C&&"expanded",P&&"selected"),onClick:()=>n?.(v),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:L},children:l.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:li(v.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:L}})]}),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:[l.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:ii(v)})]})]}),jsx("div",{className:"history-timeline-event-time",children:l.useRelativeTime?h(v.timestamp):v.timestamp.toLocaleString()})]}),Object.keys(v.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:k=>{k.stopPropagation(),x(v.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(v.changes).map(([k,D])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[k,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(D.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(D.to)})]})]},k)),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(([k,D])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[k,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},k))]})]})]})]},v.id)})})]},y.date?.toISOString()||"all"))})]})}function wf({replayState:e,events:t,onStartReplay:r,onStopReplay:a,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:c,onSpeedChange:l,className:i}){let d=[.5,1,1.5,2,3],m=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),u=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("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:g("history-replay",i),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:m&&li(m.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:m&&ii(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:p=>c(parseInt(p.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${u}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((p,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>c(f),title:ii(p)},p.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:d.map(p=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===p&&"active"),onClick:()=>l(p),children:[p,"x"]},p))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:a,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(p=>jsx("span",{className:"history-replay-card-preview-label-tag",children:p},p))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",i),children:[jsxs("button",{className:"history-replay-start-button",onClick:r,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 Yd(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 Xd(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 kf(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 Cf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function _C(e,t,r,a,n,s=100){let o=e.map(l=>({...l,x:l.x??r/2+Math.random()*100-50,y:l.y??a/2+Math.random()*100-50,vx:0,vy:0})),c=new Map(o.map(l=>[l.id,l]));for(let l=0;l<s;l++){let i=1-l/s;o.forEach(d=>{let m=r/2,u=a/2;d.vx+=(m-d.x)*n.centerForce*i,d.vy+=(u-d.y)*n.centerForce*i,o.forEach(p=>{if(d.id===p.id)return;let f=d.x-p.x,x=d.y-p.y,h=Math.sqrt(f*f+x*x)||1,b=n.chargeStrength*i/(h*h);d.vx+=f/h*b,d.vy+=x/h*b;});}),t.forEach(d=>{let m=c.get(typeof d.source=="string"?d.source:d.source.id),u=c.get(typeof d.target=="string"?d.target:d.target.id);if(!m||!u)return;let p=u.x-m.x,f=u.y-m.y,x=Math.sqrt(p*p+f*f)||1,h=(x-n.linkDistance)/x*n.forceStrength*i;m.vx+=p*h,m.vy+=f*h,u.vx-=p*h,u.vy-=f*h;}),o.forEach(d=>{d.fx!==null&&d.fx!==void 0?(d.x=d.fx,d.vx=0):d.x+=d.vx,d.fy!==null&&d.fy!==void 0?(d.y=d.fy,d.vy=0):d.y+=d.vy,d.x=Math.max(n.nodeSize,Math.min(r-n.nodeSize,d.x)),d.y=Math.max(n.nodeSize,Math.min(a-n.nodeSize,d.y)),d.vx*=.9,d.vy*=.9;});}return o}function Tf({nodes:e,edges:t,config:r,filter:a,onFilterChange:n,criticalPath:s,stats:o,onInteraction:c,className:l}){let i=useRef(null),[d,m]=useState([]),[u,p]=useState(null),[f,x]=useState(null),[h,b]=useState(null),[y,v]=useState(1),[w,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let O=_C(e,t,r.width,r.height,r,150);m(O);},[e,t,r]);let P=useCallback((O,ee)=>{r.enableDragging&&(ee.stopPropagation(),p(O));},[r.enableDragging]),L=useCallback(O=>{if(!u||!i.current)return;let I=i.current.getBoundingClientRect(),Ae=(O.clientX-I.left-w.x)/y,H=(O.clientY-I.top-w.y)/y;m(ge=>ge.map(N=>N.id===u?{...N,x:Ae,y:H,fx:Ae,fy:H}:N));},[u,y,w]),k=useCallback(()=>{p(null);},[]),D=useCallback((O,ee)=>{ee.stopPropagation(),c?.({type:"node-click",node:O,position:{x:ee.clientX,y:ee.clientY}});},[c]),F=useCallback((O,ee)=>{ee.stopPropagation(),c?.({type:"edge-click",edge:O,position:{x:ee.clientX,y:ee.clientY}});},[c]),E=useCallback(O=>{let ee=d.find(I=>I.id===O);return ee?{x:ee.x,y:ee.y}:{x:0,y:0}},[d]),G=useCallback(O=>{if(O.onCriticalPath)return "#ef4444";switch(r.colorScheme){case "status":return O.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let ee=O.card.priority;return ee==="URGENT"?"#ef4444":ee==="HIGH"?"#f59e0b":ee==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return O.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[r.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",l),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:g("relationships-graph",l),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"})]})]}),r.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.min(O+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>v(O=>Math.max(O-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{v(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(O=>O.type))).map(O=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:Yd(O)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[kf(O)," ",Xd(O)]})]},O))}),jsxs("svg",{ref:i,className:"relationships-graph-canvas",width:r.width,height:r.height,onMouseMove:L,onMouseUp:k,onMouseLeave:k,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(O=>{let ee=E(typeof O.source=="string"?O.source:O.source.id),I=E(typeof O.target=="string"?O.target:O.target.id),Ae=Cf(O.type),H=h===O.id,ge=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",H&&"hovered",ge&&"critical"),onMouseEnter:()=>b(O.id),onMouseLeave:()=>b(null),onClick:N=>F(O,N),children:[jsx("line",{x1:ee.x,y1:ee.y,x2:I.x,y2:I.y,stroke:Yd(O.type),strokeWidth:ge?r.edgeWidth*2:r.edgeWidth,strokeOpacity:H?1:.6,markerEnd:Ae?"url(#arrowhead)":void 0}),r.showEdgeLabels&&H&&jsx("text",{x:(ee.x+I.x)/2,y:(ee.y+I.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Xd(O.type)})]},O.id)})}),jsx("g",{className:"relationships-graph-nodes",children:d.map(O=>{let ee=f===O.id,I=O.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",ee&&"hovered",I&&"critical"),transform:`translate(${O.x}, ${O.y})`,onMouseDown:Ae=>P(O.id,Ae),onMouseEnter:()=>x(O.id),onMouseLeave:()=>x(null),onClick:Ae=>D(O,Ae),children:[jsx("circle",{r:I?r.nodeSize*1.2:r.nodeSize,fill:G(O),stroke:I?"#fbbf24":"#ffffff",strokeWidth:I?3:2,opacity:ee?1:.9}),r.showLabels&&jsx("text",{y:r.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:O.card.title.length>20?O.card.title.substring(0,20)+"...":O.card.title})]},O.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 Sf({isOpen:e,onClose:t,onPlanGenerated:r,onGeneratePlan:a,isLoading:n}){let[s,o]=useState(""),[c,l]=useState(false),[i,d]=useState(null),[m,u]=useState(null),p=useRef(null),f=c||n;useEffect(()=>{e&&p.current&&p.current.focus();},[e]),useEffect(()=>{let y=v=>{v.key==="Escape"&&!f&&x();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let x=()=>{f||(o(""),d(null),u(null),t());},h=async()=>{if(!(!s.trim()||f)){l(true),d(null),u(null);try{let y=await a(s.trim());u(y);}catch(y){d(y instanceof Error?y.message:"Failed to generate plan");}finally{l(false);}}},b=()=>{m&&(r(m),x());};return e?jsxs(or,{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:y=>y.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((y,v)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:y.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((y,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:y.title}),y.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:y.description})]}),y.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${y.priority==="URGENT"?"bg-red-500/20 text-red-400":y.priority==="HIGH"?"bg-orange-500/20 text-orange-400":y.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:y.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:p,value:s,onChange:y=>o(y.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((y,v)=>jsx("button",{onClick:()=>o(y),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:y},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:h,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 Jd={"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 qC={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},YC={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 XC(e,t,r){let a=Jd[e];if(!a)throw new Error(`Unknown model: ${e}`);let n=t/1e3*a.costPer1kInput,s=r/1e3*a.costPer1kOutput;return n+s}function ci(e){return `$${e.toFixed(4)}`}var Qd=class{constructor(){this.operations=[];this.listeners=[];}record(t){let r=XC(t.model,t.inputTokens,t.outputTokens),a={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:r};return this.operations.push(a),this.listeners.forEach(n=>n(a)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),a}getStats(t){let r=this.operations;t&&(r=r.filter(m=>m.timestamp>=t.start&&m.timestamp<=t.end));let a=r.length,n=r.reduce((m,u)=>m+u.cost,0),s=r.reduce((m,u)=>m+u.inputTokens,0),o=r.reduce((m,u)=>m+u.outputTokens,0),c=r.filter(m=>m.success),l=r.reduce((m,u)=>m+u.duration,0),i={},d={};return r.forEach(m=>{i[m.feature]=(i[m.feature]||0)+1,d[m.feature]=(d[m.feature]||0)+m.cost;}),{totalOperations:a,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:i,costsByFeature:d,averageDuration:a>0?l/a:0,successRate:a>0?c.length/a:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,r="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][r],s=new Date,o=new Date;r==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let c=this.operations.filter(d=>d.timestamp>=o).length,l=Math.max(0,n-c),i=c/n*100;return {used:c,limit:n,remaining:l,percentUsed:i,isExceeded:c>=n}}subscribe(t){return this.listeners.push(t),()=>{let r=this.listeners.indexOf(t);r>-1&&this.listeners.splice(r,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},$o=new Qd;function Pf({isOpen:e,onClose:t,planTier:r="hobby"}){let[a,n]=useState($o.getStats()),[s,o]=useState($o.checkLimit(r));if(useEffect(()=>{if(!e)return;let l=setInterval(()=>{n($o.getStats()),o($o.checkLimit(r));},1e3);return ()=>clearInterval(l)},[e,r]),useEffect(()=>{let l=i=>{i.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[e,t]),!e)return null;let c=$o.getRecentOperations(5);return jsxs(or,{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:l=>l.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 (",r.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:ci(a.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:a.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:(a.totalInputTokens+a.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[a.totalInputTokens.toLocaleString()," in /"," ",a.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:[(a.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",a.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(a.operationsByFeature).map(([l,i])=>{let d=a.costsByFeature[l]||0,m=a.totalOperations>0?i/a.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:l.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:ci(d)})]})]}),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}%`}})})]},l)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),c.length===0?jsx("p",{className:"text-sm text-white/50 text-center py-8",children:"No operations yet. Start using AI features!"}):jsx("div",{className:"space-y-2",children:c.map(l=>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:l.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(l.timestamp).toLocaleTimeString()," \u2022"," ",l.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l.inputTokens+l.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ci(l.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${l.success?"bg-green-400":"bg-red-400"}`})]})]},l.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 Af({isOpen:e,onClose:t,onTasksGenerated:r,onGenerateTasks:a,isLoading:n,projectName:s}){let[o,c]=useState(""),[l,i]=useState(""),[d,m]=useState(""),[u,p]=useState(false),[f,x]=useState(null),[h,b]=useState(null),[y,v]=useState(null),w=useRef(null),C=u||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let F=E=>{E.key==="Escape"&&!C&&P();};if(e)return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[e,C]);let P=()=>{C||(c(""),i(""),m(""),x(null),b(null),v(null),t());},L=async()=>{if(!(!o.trim()||C)){p(true),x(null),b(null),v(null);try{let F=await a({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:l||void 0,endDate:d||void 0});b(F.tasks.tasks),v({from_cache:F.from_cache,tokens_used:F.tokens_used,mock_mode:F.mock_mode,similarity:F.similarity,tokens_saved:F.tokens_saved});}catch(F){x(F instanceof Error?F.message:"Failed to generate tasks");}finally{p(false);}}},k=()=>{h&&(r(h),P());};if(!e)return null;let D=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(or,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:P}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#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:P,disabled:C,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:h?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:[y?.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"}),y?.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 (",D,"% 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:[y?.tokens_used||0," tokens"]}),y?.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:[y.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:[h.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:h.map((F,E)=>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:["#",E+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:F.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),F.start," \u2192 ",F.end]}),jsxs("span",{children:[F.duration," days"]}),F.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",F.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${F.priority==="high"?"bg-red-500/20 text-red-400":F.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:F.priority})]})},F.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:w,value:o,onChange:F=>c(F.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:C}),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:l,onChange:F=>i(F.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:C})]}),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:d,onChange:F=>m(F.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:C})]})]}),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((F,E)=>jsx("button",{onClick:()=>c(F),disabled:C,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:F},E))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:C&&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:P,disabled:C,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"}),h?jsx("button",{onClick:k,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:L,disabled:!o.trim()||C,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:C?"Generating...":"Generate Tasks"})]})]})]})})]})}function Hl({initialBoard:e,onPersist:t}){let[r,a]=useState(e),n=useCallback(h=>{t&&vi(()=>Promise.resolve(t(h)),{maxAttempts:3,initialDelay:1e3,onRetry:(b,y,v)=>{console.warn(`Retry attempt ${y} 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(h,b,y)=>{a(v=>{let w=v.cards.find(F=>F.id===h);if(!w)return v;let C=w.columnId,P={...w,columnId:b,position:y},L=v.cards.map(F=>F.id===h?P:F),k=v.columns.map(F=>{if(F.id===C)return {...F,cardIds:F.cardIds.filter(E=>E!==h)};if(F.id===b){let E=L.filter(G=>G.columnId===b).sort((G,O)=>G.position-O.position);return {...F,cardIds:E.map(G=>G.id)}}return F}),D={...v,cards:L,columns:k};return n(D),D});},[n]),o=useCallback(async(h,b)=>{a(y=>{let v=y.cards.map(C=>C.id===h?{...C,...b}:C),w={...y,cards:v};return n(w),w});},[n]),c=useCallback(async h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b},w=y.columns.map(P=>P.id===h.columnId?{...P,cardIds:[...P.cardIds,b]}:P),C={...y,cards:[...y.cards,v],columns:w};return n(C),C});},[n]),l=useCallback(async h=>{a(b=>{let y=b.cards.find(P=>P.id===h);if(!y)return b;let v=b.cards.filter(P=>P.id!==h),w=b.columns.map(P=>P.id===y.columnId?{...P,cardIds:P.cardIds.filter(L=>L!==h)}:P),C={...b,cards:v,columns:w};return n(C),C});},[n]),i=useCallback(async h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;a(y=>{let v={...h,id:b,cardIds:[]},w={...y,columns:[...y.columns,v]};return n(w),w});},[n]),d=useCallback(async(h,b)=>{a(y=>{let v=y.columns.map(C=>C.id===h?{...C,...b}:C),w={...y,columns:v};return n(w),w});},[n]),m=useCallback(async h=>{a(b=>{let y=b.cards.filter(C=>C.columnId!==h),v=b.columns.filter(C=>C.id!==h),w={...b,cards:y,columns:v};return n(w),w});},[n]),u=useCallback(h=>{let b=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return c(h),b},[c]),p=useCallback(h=>{let b=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(h),b},[i]),f=useCallback(()=>{a(h=>{let b={...h,cards:[],columns:[]};return n(b),b});},[n]);return {board:r,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:c,onCardDelete:l,onColumnCreate:i,onColumnUpdate:d,onColumnDelete:m},setBoard:a,helpers:{addCard:u,addColumn:p,deleteCard:l,deleteColumn:m,clearBoard:f}}}function Rf({initialData:e,availableUsers:t=[],onSave:r}){let{board:a,callbacks:n,helpers:s}=Hl({initialBoard:e,onPersist:r}),o=useMemo(()=>({addCard:(l,i,d={})=>{s.addCard({title:i,columnId:l,position:a.cards.filter(m=>m.columnId===l).length,...d});},addColumn:(l,i)=>{let d=a.columns.length>0?Math.max(...a.columns.map(m=>m.position)):0;s.addColumn({title:l,position:i??d+1e3});},reset:s.clearBoard}),[a.cards,a.columns,s]);return {props:useMemo(()=>({board:a,callbacks:n,availableUsers:t}),[a,n,t]),board:a,callbacks:n,utils:o}}var di={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},$f={by:"none",order:"asc"};function Of({initialFilters:e={},initialSort:t={},currentUserId:r}={}){let[a,n]=useState({...di,...e}),[s,o]=useState({...$f,...t}),c=useCallback(x=>{n(h=>({...h,...x}));},[]),l=useCallback(x=>{o(h=>({...h,...x}));},[]),i=useCallback(()=>{n(di),o($f);},[]),d=useCallback(()=>{r&&n({...di,assignees:[r]});},[r]),m=useCallback(()=>{n({...di,dateFilter:"overdue"});},[]),u=useCallback(()=>{n({...di,priorities:["HIGH","URGENT"]});},[]),p=useMemo(()=>a.dateFilter!=="all"||a.priorities.length>0||a.assignees.length>0||a.labels.length>0||a.columns.length>0||a.search!==""||s.by!=="none",[a,s]),f=useCallback(x=>{let h=[...x];if(a.search){let b=a.search.toLowerCase();h=h.filter(y=>y.title.toLowerCase().includes(b)||y.description?.toLowerCase().includes(b));}if(a.dateFilter!=="all"){let b=new Date,y=b.getFullYear(),v=String(b.getMonth()+1).padStart(2,"0"),w=String(b.getDate()).padStart(2,"0"),C=`${y}-${v}-${w}`;h=h.filter(P=>{if(!P.endDate&&!P.dueDate)return false;let L=P.endDate||P.dueDate;if(!L)return false;let k;if(typeof L=="string")k=L.split("T")[0]||L;else {let D=L.getUTCFullYear(),F=String(L.getUTCMonth()+1).padStart(2,"0"),E=String(L.getUTCDate()).padStart(2,"0");k=`${D}-${F}-${E}`;}switch(a.dateFilter){case "overdue":return k<C;case "today":return k===C;case "this-week":let D=new Date(C+"T00:00:00"),F=new Date(k+"T00:00:00"),E=new Date(D);return E.setDate(E.getDate()+7),F>=D&&F<=E;case "custom":if(a.dateRange){let G=typeof L=="string"?new Date(L):L;return G>=a.dateRange.start&&G<=a.dateRange.end}return true;default:return true}});}return a.priorities.length>0&&(h=h.filter(b=>b.priority&&a.priorities.includes(b.priority))),a.assignees.length>0&&(h=h.filter(b=>(b.assignedUserIds||(b.assigneeId?[b.assigneeId]:[])).some(v=>a.assignees.includes(v)))),a.labels.length>0&&(h=h.filter(b=>b.labels&&b.labels.some(y=>a.labels.includes(y)))),a.columns.length>0&&(h=h.filter(b=>a.columns.includes(b.columnId))),s.by!=="none"&&h.sort((b,y)=>{let v=0;switch(s.by){case "created":let w=b.createdAt?new Date(b.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;v=w-C;break;case "priority":let P={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},L=P[b.priority||"LOW"],k=P[y.priority||"LOW"];v=L-k;break;case "dueDate":let D=b.endDate||b.dueDate,F=y.endDate||y.dueDate;if(!D)return 1;if(!F)return -1;let E=typeof D=="string"?new Date(D).getTime():D.getTime(),G=typeof F=="string"?new Date(F).getTime():F.getTime();v=E-G;break;case "title":v=b.title.localeCompare(y.title);break;case "estimate":let O=b.estimatedTime||0,ee=y.estimatedTime||0;v=O-ee;break;default:v=0;}return s.order==="asc"?v:-v}),h},[a,s]);return {filters:a,sort:s,setFilters:c,setSort:l,resetFilters:i,filterMyTasks:d,filterOverdue:m,filterHighPriority:u,applyFilters:f,hasActiveFilters:p}}var Uf,Wf;if(typeof window<"u")try{let e=hi("ai");Uf=e.generateObject,Wf=e.generateText;}catch{}function zf(e={}){let[t,r]=useState(false),[a,n]=useState(null),s=!!(Uf&&Wf&&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');r(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(u){let p=u instanceof Error?u:new Error("Failed to generate plan");throw n(p),p}finally{r(false);}},[s]),c=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(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(u){let p=u instanceof Error?u:new Error("Failed to suggest assignee");throw n(p),p}finally{r(false);}},[s]),l=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(u){let p=u instanceof Error?u:new Error("Failed to predict risks");throw n(p),p}finally{r(false);}},[s]),i=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(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(u){let p=u instanceof Error?u:new Error("Failed to generate subtasks");throw n(p),p}finally{r(false);}},[s]),d=useCallback(async m=>{if(!s)throw new Error("AI features not available");r(true),n(null);try{return console.log("Estimating effort for:",m.title),{hours:8,confidence:.75}}catch(u){let p=u instanceof Error?u:new Error("Failed to estimate effort");throw n(p),p}finally{r(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:c,onPredictRisks:l,onGenerateSubtasks:i,onEstimateEffort:d,isAvailable:s,isLoading:t,error:a}}function eu(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let r=useCallback(a=>{selectionStore.setState(a);},[]);return [e,r]}function Gf(e){let{cards:t}=e,[r,a]=eu(),n=useCallback(m=>r.selectedCardIds.includes(m),[r.selectedCardIds]),s=useCallback((m,u)=>{if(!u){a({selectedCardIds:[m],lastSelectedCardId:m});return}let p=u.ctrlKey||u.metaKey,f=u.shiftKey;if(p)r.selectedCardIds.includes(m)?a({selectedCardIds:r.selectedCardIds.filter(x=>x!==m),lastSelectedCardId:r.lastSelectedCardId}):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});else if(f&&r.lastSelectedCardId){let x=t.find(b=>b.id===m),h=t.find(b=>b.id===r.lastSelectedCardId);if(x&&h&&x.columnId===h.columnId){let b=t.filter(k=>k.columnId===x.columnId).sort((k,D)=>k.position-D.position),y=b.findIndex(k=>k.id===r.lastSelectedCardId),v=b.findIndex(k=>k.id===m),[w,C]=y<v?[y,v]:[v,y],P=b.slice(w,C+1).map(k=>k.id),L=Array.from(new Set([...r.selectedCardIds,...P]));a({selectedCardIds:L,lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});}else a({selectedCardIds:[m],lastSelectedCardId:m});},[t,r,a]),o=useCallback(m=>{a({selectedCardIds:r.selectedCardIds.filter(u=>u!==m),lastSelectedCardId:r.lastSelectedCardId});},[r,a]),c=useCallback(()=>{a({selectedCardIds:[],lastSelectedCardId:null});},[a]),l=useCallback(()=>{a({selectedCardIds:t.map(m=>m.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,a]),i=useCallback(m=>{r.selectedCardIds.includes(m)?o(m):a({selectedCardIds:[...r.selectedCardIds,m],lastSelectedCardId:m});},[r,o,a]),d=useCallback(()=>t.filter(m=>r.selectedCardIds.includes(m.id)),[t,r.selectedCardIds]);return {selectedCardIds:r.selectedCardIds,lastSelectedCardId:r.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:c,selectAll:l,toggleCard:i,getSelectedCards:d}}var Vf={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function jf(e){let{cards:t,config:r,aiService:a}=e,n=useMemo(()=>({...Vf,...r}),[r]),[s,o]=useState([]),c=useCallback((x,h,b,y,v)=>{if(h.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:h,columnId:b,strategy:y,color:v,isExpanded:true,position:s.filter(C=>C.columnId===b).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),l=useCallback(x=>{o(h=>h.filter(b=>b.id!==x));},[]),i=useCallback(x=>{o(h=>h.map(b=>b.id===x?{...b,isExpanded:!b.isExpanded}:b));},[]),d=useCallback((x,h)=>{o(b=>b.map(y=>y.id===x&&!y.cardIds.includes(h)?{...y,cardIds:[...y.cardIds,h]}:y));},[]),m=useCallback((x,h)=>{o(b=>b.map(y=>{if(y.id===x){let v=y.cardIds.filter(w=>w!==h);return v.length<n.minCardsPerStack?null:{...y,cardIds:v}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),u=useCallback(x=>s.filter(h=>h.columnId===x).sort((h,b)=>h.position-b.position),[s]),p=useCallback(async x=>{let h=t.filter(C=>C.columnId===x);if(h.length<n.minCardsPerStack*2)return [];let b=[],y=new Map;h.forEach(C=>{C.labels&&C.labels.length>0&&C.labels.forEach(P=>{y.has(P)||y.set(P,[]),y.get(P).push(C);});}),y.forEach((C,P)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F4CC} ${P}`,cardIds:C.map(L=>L.id),columnId:x,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${P}"`,confidence:.85});});let v=new Map;h.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(P=>{v.has(P)||v.set(P,[]),v.get(P).push(C);});}),v.forEach((C,P)=>{C.length>=n.minCardsPerStack&&b.push({stack:{title:`\u{1F464} Assigned to user-${P.slice(-4)}`,cardIds:C.map(L=>L.id),columnId:x,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(h.forEach(C=>{C.priority&&(w.has(C.priority)||w.set(C.priority,[]),w.get(C.priority).push(C));}),w.forEach((C,P)=>{if(C.length>=n.minCardsPerStack){let L={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[P.toLowerCase()]||"\u26AA";b.push({stack:{title:`${L} ${P} Priority`,cardIds:C.map(k=>k.id),columnId:x,strategy:"priority",color:P==="high"||P==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${P} priority`,confidence:.75});}}),a&&n.enableAutoStacking)for(let C of h){let L=(await a.findSimilar(C,h)).filter(k=>k.similarity>=n.autoStackConfidenceThreshold);if(L.length>=n.minCardsPerStack-1){let k=[C.id,...L.map(F=>F.card.id)],D=L.reduce((F,E)=>F+E.similarity,0)/L.length;b.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:k,columnId:x,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${L.length+1} similar tasks`,confidence:D});}}return b.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,P)=>P.confidence-C.confidence).slice(0,5)},[t,n,a]),f=useCallback(x=>{c(x.stack.title,x.stack.cardIds,x.stack.columnId,x.stack.strategy,x.stack.color);},[c]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(h=>h.columnId)).forEach(async h=>{let b=await p(h),y=b[0];b.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:c,deleteStack:l,toggleStack:i,addToStack:d,removeFromStack:m,getStacksForColumn:u,getSuggestions:p,applySuggestion:f,config:n}}var _f=createContext(null);function Kf({children:e,initialData:t,onStateChange:r}){let a=useRef();if(!a.current){let s=new Map,o=new Map;t?.columns?.forEach(l=>{let{Column:i}=hi("@libxai/core");s.set(l.id,new i(l));}),t?.cards?.forEach(l=>{let{Card:i}=hi("@libxai/core");o.set(l.id,new i(l));});let c=null;if(t?.board){let{Board:l}=hi("@libxai/core");c=new l(t.board);}a.current=new BoardStore({board:c,columns:s,cards:o});}let n=a.current;return useEffect(()=>{if(r)return n.subscribeAll(s=>{r(n.getState());})},[n,r]),jsx(_f.Provider,{value:{store:n},children:e})}function Ul(){let e=useContext(_f);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function pi(){let e=Ul(),[t,r]=useState(e.getBoard()),[a,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{r(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let c=useCallback(y=>{e.updateBoard(y);},[e]),l=useCallback(y=>{e.addColumn(y);},[e]),i=useCallback((y,v)=>{e.updateColumn(y,v);},[e]),d=useCallback(y=>{e.deleteColumn(y);},[e]),m=useCallback(y=>e.getColumn(y),[e]),u=useCallback(y=>{e.addCard(y);},[e]),p=useCallback((y,v)=>{e.updateCard(y,v);},[e]),f=useCallback(y=>{e.deleteCard(y);},[e]),x=useCallback((y,v,w)=>{e.moveCard(y,v,w);},[e]),h=useCallback(y=>e.getCard(y),[e]),b=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:a,cards:s,updateBoard:c,addColumn:l,updateColumn:i,deleteColumn:d,getColumn:m,addCard:u,updateCard:p,deleteCard:f,moveCard:x,getCard:h,getCardsByColumn:b}}function Yf(e){let{cards:t}=pi();return useMemo(()=>e?t.filter(r=>{if(e.searchQuery){let a=e.searchQuery.toLowerCase(),n=r.title.toLowerCase().includes(a),s=r.description?.toLowerCase().includes(a);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!r.priority||!e.priorities.includes(r.priority))||e.statuses&&e.statuses.length>0&&(!r.status||!e.statuses.includes(r.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>r.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>r.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(r.columnId)||e.isOverdue!==void 0&&e.isOverdue!==r.isOverdue())}):t,[t,e])}function Xf(e="position",t="asc"){let{cards:r}=pi();return useMemo(()=>[...r].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let c={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},l=n.priority?c[n.priority]:0,i=s.priority?c[s.priority]:0;o=l-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}),[r,e,t])}var Wl=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=Ru.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let r of t.dependencies)if(!this.plugins.has(r))throw new Error(`Plugin ${t.id} depends on ${r} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(r=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,r,{plugin:t.id});});}unregister(t){let r=this.plugins.get(t);if(!r){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}r.onDestroy&&Promise.resolve(r.onDestroy()).catch(a=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,a);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${r.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,r){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);r?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,r){return this.config.get(t)?.[r]}setConfig(t,r,a){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[r]=a,this.pluginLogger.debug(`Plugin config set: ${t}.${r}`,{value:a});}async executeHook(t,r,a){let n=a;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let c=await Promise.resolve(o.apply(s,r));c!==void 0&&(n=c,r[0]=c);}catch(c){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,c,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,r){let a=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&a.push(Promise.resolve(s.apply(n,r)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(a);}},m5=new Wl;function Qf({items:e,height:t,estimateSize:r,renderItem:a,className:n="",overscan:s=5,horizontal:o=false,gap:c=0,getItemKey:l}){let i=useRef(null),d=useVirtualizer({count:e.length,getScrollElement:()=>i.current,estimateSize:()=>r,overscan:s,horizontal:o,gap:c}),m=d.getVirtualItems(),u={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},p=o?{width:`${d.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${d.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:i,style:u,className:n,children:jsx("div",{style:p,children:m.map(f=>{let x=e[f.index];if(!x)return null;let h=l?l(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:a(x,f.index)},h)})})})}function Zf(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 tb({items:e,height:t,width:r="100%",estimateColumnWidth:a,renderColumn:n,className:s="",overscan:o=3,gap:c=16,getItemKey:l,horizontal:i=true}){let d=useRef(null),m=useVirtualizer({horizontal:i,count:e.length,getScrollElement:()=>d.current,estimateSize:()=>a,overscan:o,gap:c}),u=m.getVirtualItems(),p={height:typeof t=="number"?`${t}px`:t,width:typeof r=="number"?`${r}px`:r,overflow:"auto",position:"relative"},f={width:`${m.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:d,style:p,className:s,children:jsx("div",{style:f,children:u.map(x=>{let h=e[x.index];if(!h)return null;let b=l?l(h,x.index):x.index,y={position:"absolute",top:0,left:x.start,width:x.size,height:"100%"};return jsx("div",{style:y,"data-index":x.index,children:n(h,x.index)},b)})})})}function rb(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 ab(e,t=10){return e>t}var nu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},ou={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},su={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},iu={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},lu={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},cu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},du={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},uu={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)"},pu={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)"},mu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},gu={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}},fu={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}},zl={spacing:nu,borderRadius:ou,fontSize:su,fontWeight:iu,lineHeight:lu,zIndex:cu,duration:du,easing:uu,shadows:pu,opacity:mu,kanban:gu,gantt:fu};function nb(e,t,r){return e[t]??r}function bu(e,t="",r={}){for(let[a,n]of Object.entries(e)){let s=t?`${t}-${a}`:a;typeof n=="object"&&n!==null&&!Array.isArray(n)?bu(n,s,r):(typeof n=="string"||typeof n=="number")&&(r[s]=n);}return r}function b5(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function hu(e="asakaa"){let t=bu(zl),r=[];for(let[a,n]of Object.entries(t)){let s=`--${e}-${a}`,o=b5(n);r.push(` ${s}: ${o};`);}return `:root {
|
|
415
415
|
${r.join(`
|
|
416
416
|
`)}
|
|
417
417
|
}`}function mi(e,t="asakaa"){let r=[],a=bu(e);for(let[n,s]of Object.entries(a)){let o=`--${t}-color-${n}`;r.push(` ${o}: ${s};`);}return `:root {
|