@libxai/board 1.9.45 → 1.9.47
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 +34 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +236 -18
- package/dist/index.d.ts +236 -18
- package/dist/index.js +34 -34
- package/dist/index.js.map +1 -1
- package/dist/styles.css +106 -27
- package/package.json +142 -142
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import
|
|
2
|
-
`)}async function
|
|
3
|
-
`)?`"${e.replace(/"/g,'""')}"`:e}async function
|
|
4
|
-
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=lp(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let i=lp(t[o]||"");if(i.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((m,f)=>{l[m]=i[f]||"";});let p=l.Column||"Unnamed";n.has(p)||n.set(p,{id:`col-${n.size+1}`,title:p,position:n.size+1,cardIds:[]});let u=n.get(p),d={id:l["Card ID"]||`card-${o}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:u.id,position:u.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(d),u.cardIds.push(d.id);}catch(i){s.push(`Line ${o+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function lp(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function cp(e,t){switch(t){case "json":return Zb(e);case "csv":return eh(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function dp(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var kc=createContext(null);function up(){return useContext(kc)}var pp=createContext(null);function mp({children:e,themeName:t}){return jsx(pp.Provider,{value:{themeName:t},children:e})}function Wi(){return useContext(pp)}function ga({children:e,container:t}){let[a,r]=useState(false),n=up(),s=Wi();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:i,themeName:c}=n,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var yp={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},lh="#BDC3C7",ch=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function Mo({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,b=160,h=220,y=4,x=m.right-b;x<10&&(x=m.left),x+b>v-10&&(x=v-b-10);let w=f-m.bottom,C=m.top,P;w>=h+y?P=m.bottom+y:C>=h+y?P=m.top-h-y:P=w>=C?m.bottom+y:Math.max(10,m.top-h-y),o({top:P,left:x}),n(true);};useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]),useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[r]);let p=m=>{t(m),n(false);},u=e?yp[e]:null,d=u?.color||lh;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?n(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:u?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(ga,{children:jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(yp).map(([m,f])=>jsxs("button",{onClick:()=>p(m),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:f.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsx(ch,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>p(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var dh=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function Vs({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),d=(Wi()?.themeName||"dark")==="dark",m=()=>{if(!l.current)return;let x=l.current.getBoundingClientRect(),w=window.innerHeight,C=window.innerWidth,P=320,O=380,T=4,D=x.left;D+P>C-10&&(D=C-P-10),D<10&&(D=10);let M=w-x.bottom,N=x.top,z;M>=O+T?z=x.bottom+T:N>=O+T?z=x.top-O-T:z=M>=N?x.bottom+T:Math.max(10,x.top-O-T),i({top:z,left:D}),s(true);};useEffect(()=>{let x=w=>{c.current&&!c.current.contains(w.target)&&!l.current?.contains(w.target)&&s(false);};if(n)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{let x=w=>{w.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);let f=x=>{let w=new Date,C=D=>{let M=D.getFullYear(),N=String(D.getMonth()+1).padStart(2,"0"),z=String(D.getDate()).padStart(2,"0");return `${M}-${N}-${z}`},P=C(w),O=new Date(w);O.setDate(O.getDate()+x);let T=C(O);a(P,T),s(false);},v=()=>{if(!e||!t)return "Set date";let x=O=>{if(O instanceof Date)return O;if(typeof O!="string"||!O.match(/^\d{4}-\d{2}-\d{2}$/))return null;let T=O.split("-").map(Number);if(T.length!==3||T.some(z=>isNaN(z)))return null;let D=T[0],M=T[1],N=T[2];return D===void 0||M===void 0||N===void 0?null:new Date(D,M-1,N)},w=x(e),C=x(t);if(!w||!C||isNaN(w.getTime())||isNaN(C.getTime()))return "Set date";let P=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${P[w.getMonth()]} ${w.getDate()} \u2013 ${P[C.getMonth()]} ${C.getDate()}`},b=e&&t,y=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,w=new Date;return w.setHours(0,0,0,0),x<w})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>n?s(false):m(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${y?"asakaa-date-overdue":"asakaa-date"}`,title:b?`${v()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:v()})]}),n&&jsx(ga,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:d?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:dh.map(x=>jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:w=>{w.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",w.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Fo({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3}){let[s,o]=useState(false),[i,c]=useState(""),[l,p]=useState({top:0,left:0}),u=useRef(null),d=useRef(null),m=()=>{if(!d.current)return;let y=d.current.getBoundingClientRect(),x=window.innerHeight,w=window.innerWidth,C=300,P=380,O=4,T=y.right-C;T<10&&(T=y.left),T+C>w-10&&(T=w-C-10);let D=x-y.bottom,M=y.top,N;D>=P+O?N=y.bottom+O:M>=P+O?N=y.top-P-O:N=D>=M?y.bottom+O:Math.max(10,y.top-P-O),p({top:N,left:T}),o(true);};useEffect(()=>{let y=x=>{u.current&&!u.current.contains(x.target)&&!d.current?.contains(x.target)&&(o(false),c(""));};if(s)return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[s]),useEffect(()=>{let y=x=>{x.key==="Escape"&&(o(false),c(""));};if(s)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[s]);let f=y=>{let x=e.some(w=>w.id===y.id);a(x?e.filter(w=>w.id!==y.id):[...e,y]);},v=t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())),b=e.slice(0,n),h=e.length-n;return jsxs("div",{className:`relative ${r||""}`,children:[jsx("button",{ref:d,onClick:()=>s?o(false):m(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[b.map(y=>jsx("div",{className:"asakaa-avatar",title:y.name,children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"asakaa-avatar-img"}):y.initials},y.id)),h>0&&jsxs("div",{className:"asakaa-avatar",children:["+",h]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),s&&jsx(ga,{children:jsxs("div",{ref:u,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${l.top}px`,left:`${l.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:i,onChange:y=>c(y.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:v.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):v.map(y=>{let x=e.some(w=>w.id===y.id);return jsxs("button",{onClick:()=>f(y),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:w=>{w.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:w=>{w.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:y.color,color:"#fff"},children:y.avatar?jsx("img",{src:y.avatar,alt:y.name,className:"w-full h-full rounded-full object-cover"}):y.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:y.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:x?"#00E5CC":"transparent"},children:x?"\u2713":""})]},y.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),o(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function zi(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(p=>{if(typeof p=="string")return p;let u=p;return u.taskId||u.targetId||""}).filter(Boolean);r.set(c.id,l);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,i=c=>{if(!s.has(c)){s.add(c),o.add(c);let l=r.get(c)||[];for(let p of l){if(!s.has(p)&&i(p))return true;if(o.has(p))return true}}return o.delete(c),false};return i(a)}function _s({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[i,c]=useState(false),[l,p]=useState(""),[u,d]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[v,b]=useState(null),h=useRef(null),y=useRef(null),x=()=>{if(!y.current)return;let T=y.current.getBoundingClientRect(),D=window.innerHeight,M=window.innerWidth,N=300,z=u?380:120,$=4,Y=T.right-N;Y<10&&(Y=T.left),Y+N>M-10&&(Y=M-N-10);let A=D-T.bottom,Se=T.top,W;A>=z+$?W=T.bottom+$:Se>=z+$?W=T.top-z-$:W=A>=Se?T.bottom+$:Math.max(10,T.top-z-$),f({top:W,left:Y}),c(true);};useEffect(()=>{if(!i||!y.current)return;let T=y.current.getBoundingClientRect(),D=window.innerHeight,M=window.innerWidth,N=300,z=u?380:120,$=4,Y=T.right-N;Y<10&&(Y=T.left),Y+N>M-10&&(Y=M-N-10);let A=D-T.bottom,Se=T.top,W;A>=z+$?W=T.bottom+$:Se>=z+$?W=T.top-z-$:W=A>=Se?T.bottom+$:Math.max(10,T.top-z-$),f({top:W,left:Y});},[u,i]),useEffect(()=>{let T=D=>{h.current&&!h.current.contains(D.target)&&!y.current?.contains(D.target)&&(c(false),p(""));};if(i)return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[i]),useEffect(()=>{let T=D=>{D.key==="Escape"&&(c(false),p(""));};if(i)return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[i]);let w=T=>{let D=t.includes(T),M=a.find(N=>N.id===T);if(b(null),D){let N=t.filter(z=>z!==T);r(N),N.length===0&&d(false);}else {if(s&&zi(a,T,e)){let z=`Cannot add "${M?.title||T}" as dependency - would create circular reference`;b(z),o?.(T,M?.title||T),setTimeout(()=>b(null),3e3);return}r([...t,T]),d(true);}},C=()=>{let T=!u;d(T),T||r([]);},P=a.filter(T=>T.id!==e).filter(T=>T.title.toLowerCase().includes(l.toLowerCase())||T.id.toLowerCase().includes(l.toLowerCase())),O=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:y,onClick:()=>i?c(false):x(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:O,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:O},children:t.length})]}),i&&jsx(ga,{children:jsxs("div",{ref:h,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[v&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:v})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:C,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:u?"#00E5CC":"transparent",borderColor:u?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:u&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),u&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:l,onChange:T=>p(T.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:P.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):P.map(T=>{let D=t.includes(T.id);return jsxs("button",{onClick:()=>w(T.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:M=>{M.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:M=>{M.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:D?"#00E5CC":"transparent",borderColor:D?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:D&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:T.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:T.id})]})]},T.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var zn=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:p,setNodeRef:u,transform:d,transition:m,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:$i.Transform.toString(d),transition:m};if(t)return jsx("div",{ref:u,style:v,...l,...p,onClick:()=>a?.(e),children:t(e)});let b=i.filter(w=>e.assignedUserIds?.includes(w.id)),h=e.progress===100,y=(e.attachments||[]).filter(w=>w.type.startsWith("image/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:u,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...p,onClick:w=>{w.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:w=>{w.currentTarget.style.display="none";}})}),y.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:y.length===1&&y[0]?jsx("img",{src:y[0].url,alt:y[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:w=>{w.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:y.slice(0,4).map((w,C)=>jsxs("div",{className:"relative",children:[jsx("img",{src:w.url,alt:w.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:P=>{P.currentTarget.style.display="none";}}),C===3&&y.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",y.length-4]})})]},w.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:h?"line-through":"none",opacity:h?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:w=>w.stopPropagation(),className:"priority-selector",children:jsx(Mo,{priority:e.priority,onChange:w=>o?.(e.id,{priority:w})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"date-picker",children:jsx(Vs,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(w,C)=>o?.(e.id,{startDate:w,endDate:C})})}),i.length>0&&jsx("div",{onClick:w=>w.stopPropagation(),className:"user-selector",children:jsx(Fo,{assignedUsers:b,availableUsers:i,onChange:w=>o?.(e.id,{assignedUserIds:w.map(C=>C.id)})})}),jsx("div",{onClick:w=>w.stopPropagation(),className:"dependencies-selector",children:jsx(_s,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(w=>typeof w=="string"?w:w.taskId):[],availableTasks:c,onChange:w=>o?.(e.id,{dependencies:w})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(w=>jsx("span",{className:"asakaa-label",children:w},w))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));zn.displayName="Card";var Gi={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Ep=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Mp({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=[...Object.entries(Gi).map(([b,h])=>({id:b,label:h.label,color:h.color,icon:h.icon})),...r.filter(b=>!Object.keys(Gi).includes(b.id)).map(b=>({id:b.id,label:b.title,color:b.color||"#8B5CF6",icon:"circle-dot"}))],u=()=>{let b=Gi[e];if(b)return {...b,id:e};let h=r.find(y=>y.id===e);return h?{id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}:{...Gi.todo,id:"todo"}},d=()=>{if(!l.current)return;let b=l.current.getBoundingClientRect(),h=window.innerHeight,y=window.innerWidth,x=180,w=280,C=4,P=b.right-x;P<10&&(P=b.left),P+x>y-10&&(P=y-x-10);let O=h-b.bottom,T=b.top,D;O>=w+C?D=b.bottom+C:T>=w+C?D=b.top-w-C:D=O>=T?b.bottom+C:Math.max(10,b.top-w-C),i({top:D,left:P}),s(true);};useEffect(()=>{let b=h=>{c.current&&!c.current.contains(h.target)&&!l.current?.contains(h.target)&&s(false);};if(n)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[n]),useEffect(()=>{let b=h=>{h.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[n]);let m=b=>{t(b),s(false);},f=u(),v=f.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>n?s(false):d(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${v}10`,boxShadow:`0 0 0 2px ${v}30 inset`},title:f.label,children:jsx(Ep,{icon:f.icon,color:v})}),n&&jsx(ga,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:p.map(b=>jsxs("button",{onClick:()=>m(b.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:b.color,background:"transparent"},onMouseEnter:h=>{h.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:h=>{h.currentTarget.style.background="transparent";},children:[jsx(Ep,{icon:b.icon,color:b.color}),jsx("span",{className:"font-semibold",children:b.label}),e===b.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},b.id))})]})})]})}var Pp={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function Fp({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=Pp[s]||Pp.en,[i,c]=useState(false),[l,p]=useState(false),[u,d]=useState(e),[m,f]=useState({top:0,left:0}),v=useRef(null),b=useRef(null),h=useRef(null);useEffect(()=>{if(i&&b.current){let C=b.current.getBoundingClientRect();f({top:C.bottom+window.scrollY+8,left:C.left+window.scrollX});}},[i]),useEffect(()=>{let C=P=>{v.current&&!v.current.contains(P.target)&&!b.current?.contains(P.target)&&(c(false),p(false));};if(i)return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[i]),useEffect(()=>{let C=P=>{P.key==="Escape"&&(c(false),p(false),d(e));};if(i)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[i,e]),useEffect(()=>{l&&h.current&&(h.current.focus(),h.current.select());},[l]);let y=()=>{p(true),d(e);},x=()=>{let C=u.trim();C&&C!==e&&t(C),p(false),c(false),d(e);},w=C=>{C.key==="Enter"?x():C.key==="Escape"&&(p(false),d(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:b,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/10",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsx(ga,{children:jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.left}px`,background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold text-white/80 uppercase tracking-wider block mb-2",children:o.renameColumn}),jsx("input",{ref:h,type:"text",value:u,onChange:C=>d(C.target.value),onKeyDown:w,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/50 outline-none focus:border-[#00E5CC]/50 transition-all",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:y,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-white/90 hover:bg-white/10 transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:o.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px bg-white/10 mx-2 my-1"}),jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-red-400 hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var is=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:p,cardHeight:u=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:b=false,className:h,renderMetrics:y,locale:x})=>{let{setNodeRef:w,isOver:C}=useDroppable({id:e.id,data:{type:"column",column:e}}),P=useRef(null),O=p??ap(t.length),T=useVirtualizer({count:t.length,getScrollElement:()=>P.current,estimateSize:()=>u,enabled:O}),D=t.filter(Y=>!Y.metadata?.isContainer).length;if(a)return jsx("div",{ref:w,className:h,children:a(e,t)});let N=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let Y=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:Y}:Y>=80?{state:"warning",percentage:Y}:Y>=60?{state:"approaching",percentage:Y}:{state:"ok",percentage:Y}})(),z=N.state==="exceeded",$=()=>"asakaa-column-count";return jsxs("div",{ref:w,className:g("asakaa-column",C&&"ring-2 ring-asakaa-accent-blue",z&&"ring-2 ring-asakaa-accent-red",h),children:[n?n(e,D):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g($()),children:[D,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&N.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${N.percentage.toFixed(0)}% capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[N.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),N.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),N.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),N.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||v)&&jsx(Fp,{columnTitle:e.title,onRename:Y=>f?.(e.id,Y),onDelete:v?()=>v(e.id):void 0,isDeletable:b,locale:x}),m&&jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),y&&y(e,t),!d&&jsx("div",{ref:P,className:"asakaa-column-cards",style:{maxHeight:O?"600px":void 0},children:jsx(SortableContext,{items:t.map(Y=>Y.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):O?jsx("div",{style:{height:`${T.getTotalSize()}px`,position:"relative"},children:T.getVirtualItems().map(Y=>{let A=t[Y.index];return A?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${Y.start}px)`},children:jsx(zn,{card:A,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l})},A.id):null})}):t.map(Y=>jsx(zn,{card:Y,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l},Y.id))})})]})});is.displayName="Column";function Sc({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),i=useRef(null);useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let p=s.trim();p&&p!==e?t(p):o(e),n(false);},l=p=>{p.key==="Enter"?c():p.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:i,type:"text",value:s,onChange:p=>o(p.target.value),onBlur:c,onKeyDown:l,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:g("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function Ph(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function $p(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),p=c.split(/\s+/);return !!(l===s||c===s||p.some(u=>u===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function Fh(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Lh(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var Ah=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function Op({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:p=true,enableAttachments:u=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let b=i==="dark",[h,y]=useState(false),[x,w]=useState([]),[C,P]=useState(0),[O,T]=useState(null),[D,M]=useState(false),N=useRef(null),z=useRef(null),$=useRef(null),Y=useRef(null),A=useCallback((oe,Be)=>{let le=Ph(oe,Be);if(T(le),le){let He=r.filter($e=>$e.name.toLowerCase().includes(le.query)||$e.email&&$e.email.toLowerCase().includes(le.query)).slice(0,5);w(He),y(He.length>0),P(0);}else y(false),w([]);},[r]),Se=oe=>{let Be=oe.target.value;if(t(Be),A(Be,oe.target.selectionStart||0),N.current){N.current.style.height="24px";let le=N.current.scrollHeight,He=280,$e=Math.min(le,He);N.current.style.height=`${$e}px`,N.current.style.overflowY=le>He?"auto":"hidden";}},W=()=>{N.current&&A(e,N.current.selectionStart||0);},Ce=useCallback(oe=>{if(!O||!N.current)return;let Be=e.slice(0,O.start),le=e.slice(O.end),He=`@${oe.name.replace(/\s+/g,"")} `,$e=Be+He+le;t($e),y(false),T(null),setTimeout(()=>{if(N.current){let Pe=O.start+He.length;N.current.selectionStart=Pe,N.current.selectionEnd=Pe,N.current.focus();}},0);},[O,e,t]),R=oe=>{if(h&&x.length>0)switch(oe.key){case "ArrowDown":oe.preventDefault(),P(Be=>Be<x.length-1?Be+1:0);break;case "ArrowUp":oe.preventDefault(),P(Be=>Be>0?Be-1:x.length-1);break;case "Enter":{oe.preventDefault();let Be=x[C];Be&&Ce(Be);break}case "Tab":{oe.preventDefault();let Be=x[C];Be&&Ce(Be);break}case "Escape":oe.preventDefault(),y(false);break}else oe.key==="Enter"&&!oe.shiftKey&&(oe.preventDefault(),a());};useEffect(()=>{let oe=Be=>{z.current&&!z.current.contains(Be.target)&&N.current&&!N.current.contains(Be.target)&&y(false),Y.current&&!Y.current.contains(Be.target)&&M(false);};return document.addEventListener("mousedown",oe),()=>document.removeEventListener("mousedown",oe)},[]);let we=useCallback(oe=>{if(!N.current)return;let Be=N.current.selectionStart||e.length,le=e.slice(0,Be)+oe+e.slice(Be);t(le),M(false),setTimeout(()=>{if(N.current){let He=Be+oe.length;N.current.selectionStart=He,N.current.selectionEnd=He,N.current.focus();}},0);},[e,t]),G=useCallback(oe=>{if(!m||!oe.target.files)return;let Be=Array.from(oe.target.files),le=v*1024*1024,He=Be.filter($e=>$e.size>le?(console.warn(`File ${$e.name} exceeds max size of ${v}MB`),false):true);He.length>0&&m(He),oe.target.value="";},[m,v]),Ve=useCallback(oe=>oe.type.startsWith("image/")?Image:oe.type.includes("pdf")||oe.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(h&&z.current){let oe=z.current.children[C];oe&&oe.scrollIntoView({block:"nearest"});}},[C,h]),jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:d.map(oe=>{let Be=Ve(oe.file),le=oe.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",b?"bg-white/10":"bg-gray-100"),children:[le&&oe.preview?jsx("img",{src:oe.preview,alt:oe.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(Be,{className:g("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",b?"text-white":"text-gray-900"),children:oe.file.name}),jsx("p",{className:g("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:Lh(oe.file.size)})]}),f&&jsx("button",{onClick:()=>f(oe.id),className:g("p-0.5 rounded-full transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},oe.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[p&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>M(!D),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:D&&jsx(motion.div,{ref:Y,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:Ah.map(oe=>jsx("button",{type:"button",onClick:()=>we(oe),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",b?"hover:bg-white/10":"hover:bg-gray-100"),children:oe},oe))})})})]}),u&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>$.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:$,type:"file",multiple:true,onChange:G,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:N,value:e,onChange:Se,onSelect:W,onKeyDown:R,placeholder:n||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",b?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&d.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||d.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":b?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:h&&x.length>0&&jsx(motion.div,{ref:z,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map((oe,Be)=>jsxs("button",{type:"button",onClick:()=>Ce(oe),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",Be===C?b?"bg-white/10":"bg-gray-100":b?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:oe.color||"#8B5CF6"},children:Fh(oe.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",b?"text-white":"text-gray-900"),children:oe.name}),oe.email&&jsx("p",{className:g("text-xs truncate",b?"text-[#6B7280]":"text-gray-500"),children:oe.email})]})]},oe.id))})})]})]})]})}function Hp({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((i,c)=>i.type==="mention"?jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:i.value},c):jsx("span",{children:i.value},c))})}var qi=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function ls({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[i,c]=useState(false),[l,p]=useState(""),[u,d]=useState(false),[m,f]=useState(qi[10]||"#00E5CC"),[v,b]=useState({top:0,left:0}),h=useRef(null),y=useRef(null),x=useRef(null),w=useRef(null),C=t.filter(N=>N.name.toLowerCase().includes(l.toLowerCase())),P=t.some(N=>N.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&y.current){let N=y.current.getBoundingClientRect();b({top:N.bottom+6,left:N.left});}},[i]),useEffect(()=>{let N=z=>{let $=z.target,Y=h.current?.contains($),A=x.current?.contains($);!Y&&!A&&(c(false),p(""),d(false));};if(i)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[i]),useEffect(()=>{i&&w.current&&w.current.focus();},[i]);let O=N=>{let z=e.some($=>$.id===N.id);a(z?e.filter($=>$.id!==N.id):[...e,N]);},T=async()=>{if(!(!r||!l.trim())){d(true);try{let N=await r(l.trim(),m);N&&(a([...e,N]),p(""),f(qi[Math.floor(Math.random()*qi.length)]||"#00E5CC"));}finally{d(false);}}},D=(N,z)=>{z.stopPropagation(),a(e.filter($=>$.id!==N));},M={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:h,className:"relative",children:[jsxs("button",{ref:y,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:M,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(N=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${N.color}20`,color:N.color},children:N.name},N.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:v.top,left:v.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:w,type:"text",value:l,onChange:N=>p(N.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:N=>{N.key==="Enter"&&l.trim()&&!P&&r&&T();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(N=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${N.color}20`,color:N.color},onClick:z=>D(N.id,z),children:[N.name,jsx(X,{className:"w-3 h-3"})]},N.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:C.length>0?C.map(N=>{let z=e.some($=>$.id===N.id);return jsxs("button",{type:"button",onClick:()=>O(N),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:z?`${N.color}15`:"transparent",color:n.textPrimary},onMouseEnter:$=>{z||($.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:$=>{z||($.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:N.color}}),jsx("span",{className:"flex-1 text-left",children:N.name}),z&&jsx(Check,{className:"w-4 h-4",style:{color:N.color}})]},N.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!P&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:qi.map(N=>jsx("button",{type:"button",onClick:()=>f(N),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:N,outline:m===N?`2px solid ${N}`:"none",outlineOffset:"2px"}},N))}),jsxs("button",{type:"button",onClick:T,disabled:u,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:u?.7:1},children:[u?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function Mc({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function Wp({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Mc,{tag:s,size:a},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var Ao=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#00E5CC",light:"#00E5CC"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function zp(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function zh(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function Gh({className:e}){return jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Pc({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=zh(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=zp(e.loggedMinutes),l=e.estimateMinutes?zp(e.estimateMinutes):null,p=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsx(Gh,{className:i[t]}),jsx("span",{children:p})]})}function Vh(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Xi(e){let t=Vh(e);return t!==null?String(t):e}function Vp(e){let a=Xi(e).trim().toLowerCase();if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Ji(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Kh(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function qh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Yh({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function jp({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Xh({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Fc({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:p,className:u}){let[d,m]=useState(""),[f,v]=useState(t.estimateMinutes?Ji(t.estimateMinutes):""),[b,h]=useState(""),[y,x]=useState(false),[w,C]=useState(false),P=useRef(null);useEffect(()=>{P.current?.focus();},[]);let O=async()=>{let M=Vp(d);if(!(M<=0||!s)){x(true);try{await s({durationMinutes:M,note:b.trim()||void 0,source:"manual"}),m(""),h("");}finally{x(false);}}},T=async()=>{if(!o)return;let M=f.trim()?Vp(f):null;await o(M),C(false);},D=M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),O()),M.key==="Escape"&&p?.();};return jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",u),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:p,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(jp,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:Kh(n)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Yh,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(jp,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(qh,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Xh,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:P,type:"text",value:d,onChange:M=>m(M.target.value),onKeyDown:D,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:O,disabled:y||!d.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:b,onChange:M=>h(M.target.value),onKeyDown:D,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Ji(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),w?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:M=>v(M.target.value),onKeyDown:M=>{M.key==="Enter"&&T(),M.key==="Escape"&&C(false);},onBlur:T,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>C(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Ji(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(M=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:M.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Ji(M.durationMinutes)})]},M.id))})]})]})}function ty(e){let a=Xi(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function ay(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function Pn({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[i,c]=useState(ay(r)),[l,p]=useState(""),[u,d]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=ty(i);await n(x&&x>0?x:null,l||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},b=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},h={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},y=t==="es";return jsxs("div",{className:g("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:x=>x.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:h[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:i,onChange:x=>c(x.target.value),onKeyDown:b,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:x=>p(x.target.value),onKeyDown:b,placeholder:y?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:u||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:u?y?"Guardando...":"Saving...":y?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:v,disabled:u,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:y?"Quitar":"Clear"})]})]})}function ry(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function ny(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Ac({summary:e,showLabel:t=false,size:a="md",className:r}){let n=ry(e.health),s=ny(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:g("flex items-center gap-2",r),children:[jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:g("flex items-center gap-2",r),children:[jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function cs(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function sy(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function iy(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function ly(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function cy({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",n),children:[r?"+":"",cs(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:g("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:g("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:g("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",c),children:cs(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",c),children:cs(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function dy({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:g("border-b",s,r&&g("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:g("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?cs(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:cs(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:g("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[n,cs(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:g("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",iy(e.status,a),sy(e.status,a)),children:ly(e.status,t)})})]})}function Ic({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",i=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",l=o?"border-white/[0.08]":"border-gray-200",p=o?"text-white/[0.92]":"text-gray-900",u=o?"text-white/[0.60]":"text-gray-500",d=o?"bg-[#050505]/50":"bg-gray-50",m=useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:g("p-8 text-center",u,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:g("p-8 text-center",u,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:g("space-y-6 p-6",i,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:g("text-2xl font-bold",p),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:g("text-sm mt-1",u),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(cy,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:d,children:jsxs("tr",{children:[jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:"%"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",u),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:g("divide-y",l),children:m.map(f=>jsx(dy,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:g("text-xs text-center",u),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function ds(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Ty(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function tm(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function Ny(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function Io({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:p=[],onUploadAttachments:u,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:b,mentionableUsers:h=[],onUploadCommentAttachments:y,enableTimeTracking:x=false,timeTrackingSummary:w,timeEntries:C=[],isTimerRunning:P=false,timerElapsedSeconds:O=0,onTimeLog:T,onEstimateUpdate:D,onSoldEffortUpdate:M,onTimerStart:N,onTimerStop:z,onTimerDiscard:$,blurFinancials:Y=false}){let A=s==="dark",Se={textTertiary:A?"#6B7280":"#9CA3AF",textSecondary:A?"#9CA3AF":"#6B7280",textPrimary:A?"#FFFFFF":"#111827",borderLight:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:A?"#1A1D25":"#FFFFFF",bgSecondary:A?"#0A0A0A":"#F9FAFB",hoverBg:A?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},W=e&&"title"in e&&!("name"in e),Ce=e,[R,we]=useState(e?tm(e,i):null),[G,Ve]=useState(false),[oe,Be]=useState(false),[le,He]=useState(false),[$e,Pe]=useState(null),[je,tt]=useState(new Date),[ee,Ae]=useState(false),[ot,Ie]=useState(false),[zt,st]=useState(""),[bt,Ee]=useState(false),[Dt,ht]=useState(false),[_e,dt]=useState(false),[L,J]=useState(false),[xe,I]=useState(""),j=useRef(null),ke=useRef(null),[Ue,ue]=useState(""),at=useRef(null),[yt,Ye]=useState(""),[vt,Xt]=useState(false),[wt,Ut]=useState([]),[Ht,he]=useState(""),[Fe,Qe]=useState(false),rt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let S=tm(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:S?.id,taskName:S?.name,soldEffortMinutes:S?.soldEffortMinutes,quotedMinutes:S?.quotedMinutes,effortMinutes:S?.effortMinutes,timeLoggedMinutes:S?.timeLoggedMinutes}),we(S),I(S.description||""),ue(S.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!xe)return;let S=setTimeout(()=>{let H=ke.current;H&&(H.style.height="auto",H.style.height=`${Math.max(100,H.scrollHeight)}px`);},50);return ()=>clearTimeout(S)},[t,xe]),useEffect(()=>()=>{j.current&&clearTimeout(j.current),at.current&&clearTimeout(at.current);},[]),useEffect(()=>{t&&rt.current&&f.length>0&&setTimeout(()=>{rt.current&&(rt.current.scrollTop=rt.current.scrollHeight);},100);},[t,f.length]);let Tt=useCallback(S=>{we(S),W&&n&&Ce?n(Ny(S,Ce)):r&&r(S);},[W,Ce,n,r]),Ft=useCallback(()=>{Ve(false),Be(false),He(false),Pe(null),Ie(false),st(""),Ee(false);},[]),kt=useCallback((S,H)=>{if(!R)return;let Z={...R,[S]:H};Tt(Z);},[R,Tt]),Da=useCallback(()=>{let S=ke.current;S&&(S.style.height="auto",S.style.height=`${Math.max(100,S.scrollHeight)}px`);},[]),aa=useCallback(S=>{I(S),setTimeout(Da,0),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>{if(R){let H={...R,description:S};Tt(H);}},800);},[R,Tt,Da]),cr=useCallback(S=>{ue(S),at.current&&clearTimeout(at.current),at.current=setTimeout(()=>{if(R&&S.trim()){let H={...R,name:S.trim()};Tt(H);}},800);},[R,Tt]),Xe=useCallback(S=>{let H=S.map(Z=>{let Te={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:Z};return Z.type.startsWith("image/")&&(Te.preview=URL.createObjectURL(Z)),Te});Ut(Z=>[...Z,...H]);},[]),et=useCallback(S=>{Ut(H=>{let Z=H.find(Te=>Te.id===S);return Z?.preview&&URL.revokeObjectURL(Z.preview),H.filter(Te=>Te.id!==S)});},[]),Sa=useCallback(async()=>{if(!(!R||!yt.trim()&&wt.length===0||!v)){Xt(true);try{let S=$p(yt,h),H=[];if(wt.length>0&&y){let Z=wt.map(Te=>Te.file);H=await y(Z);}await v(R.id,yt.trim(),S.length>0?S:void 0,H.length>0?H:void 0),Ye(""),wt.forEach(Z=>{Z.preview&&URL.revokeObjectURL(Z.preview);}),Ut([]);}finally{Xt(false);}}},[R,yt,wt,v,h,y]),Ia=useCallback(()=>{if(!R||!Ht.trim())return;let S=R.subtasks||[],H={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:Ht.trim(),progress:0,startDate:new Date,endDate:new Date,position:S.length},Z=[...S,H],Te={...R,subtasks:Z};Tt(Te),he(""),Qe(false);},[R,Ht,Tt]),dr=useCallback(S=>{if(!R?.subtasks)return;let H=R.subtasks.map(Te=>Te.id===S?{...Te,progress:Te.progress===100?0:100}:Te),Z={...R,subtasks:H};Tt(Z);},[R,Tt]),xr=useCallback(S=>{if(!R?.subtasks)return;let H=R.subtasks.filter(Te=>Te.id!==S),Z={...R,subtasks:H};Tt(Z);},[R,Tt]),Ra=useCallback(S=>{let H=typeof S=="string"?new Date(S):S,Te=new Date().getTime()-H.getTime(),gt=Math.floor(Te/6e4),fe=Math.floor(Te/36e5),Ne=Math.floor(Te/864e5);return gt<1?o==="es"?"Ahora":"Just now":gt<60?o==="es"?`Hace ${gt} min`:`${gt}m ago`:fe<24?o==="es"?`Hace ${fe}h`:`${fe}h ago`:Ne<7?o==="es"?`Hace ${Ne}d`:`${Ne}d ago`:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),Ja=useCallback(S=>{if(!R)return;let H=R.progress||0;S==="completed"?H=100:S==="in-progress"&&H===0?H=10:S==="todo"&&(H=0);let Z={...R,status:S,progress:H};Tt(Z),Ve(false);},[R,Tt]),se=useCallback((S,H)=>{if(!R)return;let Z={...R,startDate:S,endDate:H};Tt(Z);},[R,Tt]),me=useCallback(()=>{let S=je.getFullYear(),H=je.getMonth(),Z=new Date(S,H,1),gt=new Date(S,H+1,0).getDate(),fe=Z.getDay(),Ne=[],ye=new Date(S,H,0).getDate();for(let Et=fe-1;Et>=0;Et--)Ne.push({date:new Date(S,H-1,ye-Et),isCurrentMonth:false});for(let Et=1;Et<=gt;Et++)Ne.push({date:new Date(S,H,Et),isCurrentMonth:true});let lt=42-Ne.length;for(let Et=1;Et<=lt;Et++)Ne.push({date:new Date(S,H+1,Et),isCurrentMonth:false});return Ne},[je]),q=useCallback(async S=>{if(S.preventDefault(),S.stopPropagation(),dt(false),!R||!u)return;let H=Array.from(S.dataTransfer.files);if(H.length!==0){J(true);try{await u(R.id,H);}finally{J(false);}}},[R,u]),pe=useCallback(async S=>{if(!R||!u||!S.target.files)return;let H=Array.from(S.target.files);if(H.length!==0){J(true);try{await u(R.id,H);}finally{J(false);}S.target.value="";}},[R,u]),ce=useCallback(S=>{S.preventDefault(),S.stopPropagation(),dt(true);},[]),B=useCallback(S=>{S.preventDefault(),S.stopPropagation(),dt(false);},[]),re=useCallback(S=>S<1024?`${S} B`:S<1024*1024?`${(S/1024).toFixed(1)} KB`:`${(S/(1024*1024)).toFixed(1)} MB`,[]),be=useCallback(S=>S.startsWith("image/")?Image:S.includes("pdf")||S.includes("document")?FileText:File,[]);return !t||!R?null:jsx(AnimatePresence,{children:t&&R&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",A?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",A?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:g("text-xs font-mono",A?"text-[#6B7280]":"text-gray-400"),children:R.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let S=R.progress===100?0:100,Z={...R,progress:S,status:S===100?"completed":"todo"};Tt(Z);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",R.progress===100?"bg-green-500 border-green-500":A?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:R.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:Ue,onChange:S=>cr(S.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",R.progress===100?"line-through text-[#6B7280]":A?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Ft(),Ve(!G);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",R.progress===100||R.status==="completed"?"bg-green-500/20 text-green-400":R.progress&&R.progress>0||R.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.progress===100||R.status==="completed"?o==="es"?"COMPLETADO":"DONE":R.progress&&R.progress>0||R.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:G&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ve(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(S=>jsxs("button",{onClick:()=>Ja(S.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",R.status===S.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:A?"text-white":"text-gray-900",children:S.label})]},S.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Ft(),He(!le);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[R.assignees&&R.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[R.assignees.slice(0,3).map((S,H)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:S.color||"#8B5CF6"},title:S.name,children:S.initials||S.name.slice(0,2).toUpperCase()},H)),R.assignees.length>3&&jsxs("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",R.assignees.length-3]})]}):jsx("span",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:le&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>He(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(S=>{let H=R.assignees?.some(Z=>Z.name===S.name);return jsxs("button",{onClick:()=>{let Z=R.assignees||[],Te;H?Te=Z.filter(gt=>gt.name!==S.name):Te=[...Z,S],kt("assignees",Te);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",H&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:S.color||"#8B5CF6"},children:S.initials||S.name.slice(0,2).toUpperCase()}),jsx("span",{className:g("flex-1",A?"text-white":"text-gray-900"),children:S.name}),H&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},S.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Pe($e?null:"start"),tt(R.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[R.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:g("mx-1",A?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),R.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:$e&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Pe(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:S=>S.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",A?"border-white/10":"border-gray-200"),children:[(()=>{let S=new Date,H=new Date(S);H.setDate(S.getDate()+1);let Z=new Date(S);Z.setDate(S.getDate()+((6-S.getDay()+7)%7||7));let Te=new Date(S);Te.setDate(S.getDate()+((1-S.getDay()+7)%7||7));let gt=new Date(S);gt.setDate(S.getDate()+(6-S.getDay()+7)%7+7);let fe=new Date(S);fe.setDate(S.getDate()+14);let Ne=new Date(S);return Ne.setDate(S.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:S,display:S.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:H,display:H.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:Z,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Te,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:gt,display:gt.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:fe,display:fe.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:Ne,display:Ne.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((lt,Et)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if($e==="start"){let Qt=R.endDate&<.date>R.endDate?lt.date:R.endDate;se(lt.date,Qt),Pe("end");}else {let Qt=R.startDate&<.date<R.startDate?lt.date:R.startDate;se(Qt,lt.date),Pe(null);}},children:[jsx("span",{children:lt.label}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:lt.display})]},Et))})(),jsx("div",{className:g("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{se(void 0,void 0),Pe(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",A?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:$e==="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",A?"text-white":"text-gray-900"),children:je.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>tt(new Date),className:g("p-1 rounded text-sm transition-colors",A?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>tt(new Date(je.getFullYear(),je.getMonth()-1)),className:g("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>tt(new Date(je.getFullYear(),je.getMonth()+1)),className:g("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(S=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",A?"text-[#6B7280]":"text-gray-400"),children:S},S))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:me().map((S,H)=>{let Z=S.date.toDateString()===new Date().toDateString(),Te=R.startDate?.toDateString()===S.date.toDateString(),gt=R.endDate?.toDateString()===S.date.toDateString(),fe=Te||gt,Ne=R.startDate&&R.endDate&&S.date>=R.startDate&&S.date<=R.endDate;return jsx("button",{onClick:()=>{let ye=new Date(S.date);if($e==="start"){let lt=R.endDate&&ye>R.endDate?ye:R.endDate;se(ye,lt),Pe("end");}else {let lt=R.startDate&&ye<R.startDate?ye:R.startDate;se(lt,ye),Pe(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!S.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),S.isCurrentMonth&&(A?"text-white":"text-gray-900"),Z&&"ring-2 ring-[#00E5CC]",Te&&"bg-[#00E5CC] text-white",gt&&!Te&&"bg-[#7C3AED] text-white",Ne&&!fe&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!fe&&(A?"hover:bg-white/10":"hover:bg-gray-100")),children:S.date.getDate()},H)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Ft(),Be(!oe);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",R.priority==="high"||R.priority==="urgent"?"bg-red-500/20 text-red-400":R.priority==="medium"?"bg-yellow-500/20 text-yellow-400":R.priority==="low"?"bg-green-500/20 text-green-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:R.priority?R.priority==="high"||R.priority==="urgent"?o==="es"?"Alta":"High":R.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:oe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Be(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(S=>jsxs("button",{onClick:()=>{kt("priority",S.id),Be(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",R.priority===S.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",S.color)}),jsx("span",{className:A?"text-white":"text-gray-900",children:S.label})]},S.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:R.startDate&&R.endDate?`${Math.ceil((R.endDate.getTime()-R.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:g("w-4 h-4 rounded-full border-2",A?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[ee?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:R.progress||0,onChange:S=>{let H=parseInt(S.target.value),Z=R.status;H===100?Z="completed":H>0?Z="in-progress":Z="todo";let Te={...R,progress:H,status:Z};Tt(Te);},onBlur:()=>Ae(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",A?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>Ae(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",A?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:g("h-full rounded-full transition-all",R.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${R.progress||0}%`}})}),jsxs("span",{className:g("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[R.progress||0,"%"]})]})]}),x&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R.status==="completed"||R.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:w?.estimateMinutes?ds(w.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):w?.estimateMinutes?jsx("button",{type:"button",onClick:()=>ht("estimate"),className:g("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ds(w.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>ht("estimate"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Dt==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Pn,{mode:"estimate",locale:o,isDark:A,currentValue:w?.estimateMinutes||null,onSave:async S=>{await D?.(R.id,S),ht(false);},onClose:()=>ht(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:Y?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",A?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):R.status==="completed"||R.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:R.quotedMinutes?ds(R.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):R.quotedMinutes?jsx("button",{type:"button",onClick:()=>ht("quoted"),className:g("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:ds(R.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>ht("quoted"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Dt==="quoted"&&!Y&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Pn,{mode:"quoted",locale:o,isDark:A,currentValue:R.quotedMinutes||null,onSave:async S=>{M?(await M(R.id,S),we(H=>H?{...H,quotedMinutes:S}:null)):kt("quotedMinutes",S),ht(false);},onClose:()=>ht(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[R.status==="completed"||R.progress===100?jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",A?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):P?jsxs("button",{type:"button",onClick:()=>z?.(R.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),Ty(O||0)]}):jsx("button",{type:"button",onClick:()=>N?.(R.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",A?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),R.status==="completed"||R.progress===100?jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>ht("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",A?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),w&&w.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g("text-sm font-medium",w.health==="over-budget"?"text-red-500":w.health==="at-risk"?"text-yellow-500":A?"text-white":"text-gray-900"),children:[ds(w.loggedMinutes),w.estimateMinutes&&jsxs("span",{className:g("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",ds(w.estimateMinutes)]})]}),w.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:g("h-full rounded-full transition-all",w.health==="over-budget"?"bg-red-500":w.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,w.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:Dt==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(Pn,{mode:"log",locale:o,isDark:A,currentValue:null,onSave:async(S,H)=>{S&&await T?.(R.id,{durationMinutes:S,note:H,source:"manual"}),ht(false);},onClose:()=>ht(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx(ls,{selectedTags:R.tags||[],availableTags:c,onChange:S=>{kt("tags",S);},onCreateTag:l,theme:Se})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[R.dependencies&&R.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:R.dependencies.map(S=>{let H=m.find(Z=>Z.id===S);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",A?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[H?.name||S.slice(0,8),jsx("button",{onClick:()=>{let Z=(R.dependencies||[]).filter(Te=>Te!==S);kt("dependencies",Z);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},S)})}),jsxs("button",{onClick:()=>{Ft(),Ie(!ot);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:ot&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Ie(false),st("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:zt,onChange:S=>st(S.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:m.length>0?m.filter(S=>S.id!==R.id).filter(S=>zt===""||S.name.toLowerCase().includes(zt.toLowerCase())).map(S=>{let H=R.dependencies?.includes(S.id);return jsxs("button",{onClick:()=>{let Z=R.dependencies||[],Te;H?Te=Z.filter(gt=>gt!==S.id):Te=[...Z,S.id],kt("dependencies",Te);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",H&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",H?"bg-[#00E5CC] border-[#00E5CC]":A?"border-white/30":"border-gray-300"),children:H&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",A?"text-white":"text-gray-900"),children:S.name}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:S.id.slice(0,8)})]})]},S.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Ft(),Ee(!bt);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:R.color||"#6366F1"}}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:Ao.find(S=>S.value===R.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:bt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ee(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:Ao.map(S=>{let H=R.color===S.value;return jsx("button",{onClick:()=>{kt("color",S.value),Ee(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",H&&"ring-2 ring-offset-2",A?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:S.value,outlineColor:H?S.value:void 0},title:S.name,children:H&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},S.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:R.isMilestone||false,onChange:S=>kt("isMilestone",S.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",R.isMilestone?"bg-purple-500 border-purple-500":A?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ke,value:xe,onChange:S=>aa(S.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",R.subtasks&&R.subtasks.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",R.subtasks.filter(S=>S.progress===100).length,"/",R.subtasks.length,")"]})]})}),R.subtasks&&R.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...R.subtasks].sort((S,H)=>(S.position??0)-(H.position??0)).map(S=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",A?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>dr(S.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",S.progress===100?"bg-green-500 border-green-500":A?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:S.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",S.progress===100?"line-through text-[#6B7280]":A?"text-white":"text-gray-900"),children:S.name}),jsx("button",{onClick:()=>xr(S.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",A?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},S.id))}),Fe?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:Ht,onChange:S=>he(S.target.value),onKeyDown:S=>{S.key==="Enter"&&Ht.trim()?Ia():S.key==="Escape"&&(Qe(false),he(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",A?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:Ia,disabled:!Ht.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",Ht.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":A?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{Qe(false),he("");},className:g("p-2 rounded-lg transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Qe(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",p.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",p.length,")"]})]}),p.length>0&&jsx("div",{className:"space-y-2 mb-4",children:p.map(S=>{let H=be(S.type),Z=S.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[Z&&S.thumbnailUrl?jsx("img",{src:S.thumbnailUrl,alt:S.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",A?"bg-white/10":"bg-gray-200"),children:jsx(H,{className:g("w-5 h-5",A?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:S.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",A?"text-white":"text-gray-900"),children:S.name}),jsx("p",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:re(S.size)})]}),d&&jsx("button",{onClick:()=>d(S.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",A?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},S.id)})}),jsxs("div",{onDragOver:ce,onDragLeave:B,onDrop:q,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",_e?A?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":A?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",L&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:pe,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!u||L}),L?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:g("w-6 h-6 mx-auto mb-2",_e?"text-[#00E5CC]":A?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:_e?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!u&&jsx("p",{className:g("text-xs mt-1",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:g("w-96 border-l flex flex-col",A?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:g("p-1.5 rounded transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
1
|
+
import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,selectionStore,BoardStore}from'@libxai/core';export{Board as BoardModel,BoardStore,Card as CardModel,Column as ColumnModel,DependencyEngine,Store}from'@libxai/core';import {createContext,memo,useRef,useState,forwardRef,useContext,useCallback,useEffect,useMemo,useImperativeHandle,useLayoutEffect,Component}from'react';import {useDroppable,useSensors,useSensor,PointerSensor,KeyboardSensor,DndContext,closestCorners,DragOverlay}from'@dnd-kit/core';import {useSortable,SortableContext,verticalListSortingStrategy,sortableKeyboardCoordinates}from'@dnd-kit/sortable';import {useVirtualizer}from'@tanstack/react-virtual';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {jsPDF}from'jspdf';import hy from'html2canvas';import {createPortal}from'react-dom';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {AnimatePresence,motion}from'framer-motion';import {CheckCircle2,PlayCircle,Circle,Diamond,Copy,Scissors,Settings,Eye,EyeOff,ArrowDown,ArrowUp,ArrowUpDown,BarChart3,Link2,Minus,Plus,Trash2,Pencil,Edit3,AlertTriangle,Paperclip,Users,Tag,CheckSquare,ChevronDown,Calendar,Hash,Type,BarChart,CalendarClock,FileText,Timer,Clock,CalendarCheck,Flag,CircleDot,Filter,Rows3,MoreHorizontal,Moon,Sun,Palette,Check,ZoomOut,ZoomIn,ChevronsDownUp,Keyboard,ChevronRight,Image,File,User,CalendarDays,X,Hourglass,Play,Square,Upload,MessageSquare,Rows4,Rows2,Zap,Layers,GitBranch,FileImage,FileSpreadsheet,FolderKanban,Share2,Download,Columns3,ChevronLeft,GripVertical,Smile,Send,FileJson,AlertCircle,Milestone,List,Search,PanelRight,FolderOpen,Folder,Info,Target,DollarSign,Loader2}from'lucide-react';import {Command}from'cmdk';import {ResponsiveContainer,LineChart,CartesianGrid,XAxis,YAxis,Tooltip,Legend,Line,AreaChart,Area,PieChart,Pie,Cell,BarChart as BarChart$1,Bar}from'recharts';import {toPng}from'html-to-image';var vl=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var wl=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:a}=e;return "translate3d("+(t?Math.round(t):0)+"px, "+(a?Math.round(a):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:a}=e;return "scaleX("+t+") scaleY("+a+")"}},Transform:{toString(e){if(e)return [wl.Translate.toString(e),wl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:a,easing:r}=e;return t+" "+a+"ms "+r}}});function g(...e){return twMerge(clsx(e))}function kl(e,t){return e===null&&t===null?1e3:e===null&&t!==null?t/2:e!==null&&t===null?e+1e3:e!==null&&t!==null?(e+t)/2:1e3}function py(e){return Array.from({length:e},(t,a)=>(a+1)*1e3)}function dd(e,t){return e.length===0?1e3:t===0?kl(null,e[0].position):t>=e.length?kl(e[e.length-1].position,null):kl(e[t-1].position,e[t].position)}function fm(e,t=100){return e>t}var my=e=>{if(e.message.includes("network")||e.message.includes("fetch"))return true;if("status"in e){let t=e.status;return t>=500||t===429}return false};function gy(e,t,a,r){let n=t*Math.pow(a,e-1),s=n*.2*Math.random();return Math.min(n+s,r)}async function Cl(e,t={}){let{maxAttempts:a=3,initialDelay:r=1e3,backoffMultiplier:n=2,maxDelay:s=1e4,shouldRetry:o=my,onRetry:i}=t,c,l=0;for(let u=1;u<=a;u++){l=u;try{return {data:await e(),attempts:l,success:!0}}catch(p){if(c=p,u===a||!o(c,u))return {error:c,attempts:l,success:false};let m=gy(u,r,n,s);if(i)try{i(c,u,m);}catch(f){console.error("Error in retry callback:",f);}await new Promise(f=>setTimeout(f,m));}}return {error:c||new Error("Unknown error"),attempts:l,success:false}}function fy(e,t=3){let a;for(let r=1;r<=t;r++)try{return {data:e(),success:!0}}catch(n){if(a=n,r===t)return {error:a,success:false}}return {error:a||new Error("Unknown error"),success:false}}function by(e,t={}){return async(...a)=>Cl(()=>e(...a),t)}var ud=class{constructor(t=5,a=6e4){this.threshold=t;this.resetTimeout=a;this.failures=0;this.lastFailureTime=0;this.isOpen=false;}async execute(t){if(this.isOpen)if(Date.now()-this.lastFailureTime>=this.resetTimeout)this.reset();else throw new Error("Circuit breaker is open - too many failures");try{let a=await t();return this.onSuccess(),a}catch(a){throw this.onFailure(),a}}onSuccess(){this.failures=0,this.isOpen=false;}onFailure(){this.failures++,this.lastFailureTime=Date.now(),this.failures>=this.threshold&&(this.isOpen=true);}reset(){this.failures=0,this.isOpen=false;}getStatus(){return {failures:this.failures,isOpen:this.isOpen}}};var bm=(s=>(s[s.DEBUG=0]="DEBUG",s[s.INFO=1]="INFO",s[s.WARN=2]="WARN",s[s.ERROR=3]="ERROR",s[s.NONE=4]="NONE",s))(bm||{}),ns=class ns{constructor(t={}){this.defaultLogHandler=t=>{let{timestamp:a,level:r,message:n,component:s,...o}=t,i=`[${a}] [${r}] [${s}]`,c=Object.keys(o).length>0;switch(r){case "DEBUG":console.debug(i,n,c?o:"");break;case "INFO":console.info(i,n,c?o:"");break;case "WARN":console.warn(i,n,c?o:"");break;case "ERROR":console.error(i,n,c?o:""),t.error?.stack&&console.error(t.error.stack);break}};let a=process.env.NODE_ENV==="development";this.options={minLevel:t.minLevel??(a?0:1),enabled:t.enabled??true,onLog:t.onLog??this.defaultLogHandler,enableTiming:t.enableTiming??true,componentName:t.componentName??"ASAKAA",...ns.globalOptions};}static configure(t){ns.globalOptions={...ns.globalOptions,...t};}child(t){return new ns({...this.options,componentName:`${this.options.componentName}:${t}`})}debug(t,a){this.log(0,t,a);}info(t,a){this.log(1,t,a);}warn(t,a){this.log(2,t,a);}error(t,a,r){this.log(3,t,{...r,error:a?{message:a.message,stack:a.stack,name:a.name}:void 0});}startTimer(t){return this.options.enableTiming?new Tl((a,r)=>{this.log(0,`${t} completed`,{...r,action:t,duration:a});},true):new Tl(()=>{},false)}log(t,a,r){if(!this.options.enabled||t<this.options.minLevel)return;let n={timestamp:new Date().toISOString(),level:bm[t],message:a,component:this.options.componentName,...r};this.options.onLog(n);}};ns.globalOptions={};var pd=ns,Tl=class{constructor(t,a){this.onEnd=t;this.enabled=a;this.startTime=a?performance.now():0;}end(t){if(!this.enabled)return 0;let a=Math.round(performance.now()-this.startTime);return this.onEnd(a,t),a}elapsed(){return this.enabled?Math.round(performance.now()-this.startTime):0}},hm=new pd;function yy(e,t){let a={board:{id:e.id,title:e.title,metadata:e.metadata,exportedAt:new Date().toISOString()},columns:e.columns,cards:e.cards,options:t};return JSON.stringify(a,null,2)}function xy(e,t){let a=["Card ID","Title","Description","Column","Priority","Labels","Assigned Users","Start Date","End Date","Created At","Updated At"],r=e.cards.map(s=>{let o=e.columns.find(i=>i.id===s.columnId);return [s.id,md(s.title),md(s.description||""),md(o?.title||""),s.priority||"",(s.labels||[]).join(";"),(s.assignedUserIds||[]).join(";"),s.startDate||"",s.endDate||"",s.createdAt||"",s.updatedAt||""]});return [a.join(","),...r.map(s=>s.join(","))].join(`
|
|
2
|
+
`)}async function vy(e,t,a){let r=t;if(!r){let o=document.querySelector(".asakaa-board");o&&(r=o.parentElement||o);}if(r)try{let o=await hy(r,{backgroundColor:"#0a0a0a",scale:1.5,logging:!1,useCORS:!0,allowTaint:!0,windowWidth:r.scrollWidth,windowHeight:r.scrollHeight}),i=o.toDataURL("image/png"),c=297,l=210,u=o.width/o.height,p=c-20,d=p/u;d>l-20&&(d=l-20,p=d*u);let m=new jsPDF({orientation:"landscape",unit:"mm",format:"a4"});m.setFontSize(16),m.setTextColor(255,255,255),m.setFillColor(10,10,10),m.rect(0,0,c,15,"F"),m.text(e.title||"Kanban Board",10,10);let f=(c-p)/2;return m.addImage(i,"PNG",f,20,p,d),m}catch(o){console.error("Error capturing board:",o);}let n=new jsPDF,s=20;return n.setFontSize(20),n.text(e.title||"Kanban Board",20,s),s+=10,n.setFontSize(10),n.setTextColor(128,128,128),n.text(`Exported on ${new Date().toLocaleString()}`,20,s),s+=15,n.setTextColor(0,0,0),e.columns.forEach(o=>{let i=e.cards.filter(c=>c.columnId===o.id);s>250&&(n.addPage(),s=20),n.setFontSize(16),n.setFont("helvetica","bold"),n.text(o.title,20,s),s+=8,i.length===0?(n.setFontSize(10),n.setFont("helvetica","italic"),n.setTextColor(128,128,128),n.text("No cards in this column",20,s),n.setTextColor(0,0,0),s+=10):i.forEach(c=>{if(s>260&&(n.addPage(),s=20),n.setFontSize(12),n.setFont("helvetica","bold"),n.text(c.title,25,s),s+=6,c.description){n.setFontSize(9),n.setFont("helvetica","normal");let u=n.splitTextToSize(c.description,160);n.text(u,25,s),s+=u.length*5;}let l=[];if(c.priority&&l.push(`Priority: ${c.priority}`),c.labels&&c.labels.length>0&&l.push(`Labels: ${c.labels.join(", ")}`),c.assignedUserIds&&c.assignedUserIds.length>0&&l.push(`Assigned: ${c.assignedUserIds.length} user(s)`),c.startDate||c.endDate){let u=[];c.startDate&&u.push(`Start: ${c.startDate}`),c.endDate&&u.push(`End: ${c.endDate}`),l.push(u.join(" \u2192 "));}l.length>0&&(n.setFontSize(8),n.setTextColor(100,100,100),n.text(l.join(" \u2022 "),25,s),n.setTextColor(0,0,0),s+=5),s+=5;}),s+=5;}),n}function md(e){return e.includes(",")||e.includes('"')||e.includes(`
|
|
3
|
+
`)?`"${e.replace(/"/g,'""')}"`:e}async function xm(e,t,a,r){switch(t){case "json":return yy(e,r);case "csv":return xy(e);case "pdf":return await vy(e,a);default:throw new Error(`Unsupported export format: ${t}`)}}function vm(e,t,a){let r=`board-export-${new Date().getTime()}`;if(t==="pdf"&&typeof e=="object"&&e!==null&&"save"in e){let u=`${r}.pdf`;e.save(u);return}if(typeof e!="string")throw new Error("Invalid content type for non-PDF export");let s=`${r}.${{json:"json",csv:"csv",pdf:"pdf"}[t]}`,o={json:"application/json",csv:"text/csv",pdf:"application/pdf"},i=new Blob([e],{type:o[t]}),c=URL.createObjectURL(i),l=document.createElement("a");l.href=c,l.download=s,document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c);}function wy(e){try{let t=JSON.parse(e);if(!t.board||!t.columns||!t.cards)return {success:!1,errors:["Invalid JSON format: missing required fields (board, columns, cards)"]};let a={id:t.board.id,title:t.board.title,columns:t.columns,cards:t.cards,metadata:t.board.metadata};return {success:!0,cardsImported:a.cards.length,columnsImported:a.columns.length}}catch(t){return {success:false,errors:[`Failed to parse JSON: ${t instanceof Error?t.message:"Unknown error"}`]}}}function ky(e){try{let t=e.trim().split(`
|
|
4
|
+
`);if(t.length<1||!t[0])return {success:!1,errors:["CSV file is empty or invalid"]};let a=wm(t[0]),r=[],n=new Map,s=[];for(let o=1;o<t.length;o++)try{let i=wm(t[o]||"");if(i.length>a.length){s.push(`Line ${o+1}: Too many columns`);continue}if(a.length-i.length>3){s.push(`Line ${o+1}: Column count mismatch (expected ${a.length}, got ${i.length})`);continue}for(;i.length<a.length;)i.push("");let l={};a.forEach((m,f)=>{l[m]=i[f]||"";});let u=l.Column||"Unnamed";n.has(u)||n.set(u,{id:`col-${n.size+1}`,title:u,position:n.size+1,cardIds:[]});let p=n.get(u),d={id:l["Card ID"]||`card-${o}`,title:l.Title||"Untitled",description:l.Description?l.Description:void 0,columnId:p.id,position:p.cardIds.length+1,priority:l.Priority||void 0,labels:l.Labels?l.Labels.split(";").filter(Boolean):void 0,assignedUserIds:l["Assigned Users"]?l["Assigned Users"].split(";").filter(Boolean):void 0,startDate:l["Start Date"]?l["Start Date"]:void 0,endDate:l["End Date"]?l["End Date"]:void 0,createdAt:l["Created At"]?l["Created At"]:void 0,updatedAt:l["Updated At"]?l["Updated At"]:void 0};r.push(d),p.cardIds.push(d.id);}catch(i){s.push(`Line ${o+1}: ${i instanceof Error?i.message:"Unknown error"}`);}return r.length===0?{success:!1,errors:["No valid cards found in CSV",...s]}:{success:!0,cardsImported:r.length,columnsImported:n.size,errors:s.length>0?s:void 0}}catch(t){return {success:false,errors:[`Failed to parse CSV: ${t instanceof Error?t.message:"Unknown error"}`]}}}function wm(e){let t=[],a="",r=false;for(let n=0;n<e.length;n++){let s=e[n],o=e[n+1];s==='"'&&r&&o==='"'?(a+='"',n++):s==='"'?r=!r:s===","&&!r?(t.push(a),a=""):a+=s;}return t.push(a),t}function km(e,t){switch(t){case "json":return wy(e);case "csv":return ky(e);default:return {success:false,errors:[`Unsupported import format: ${t}`]}}}function Cm(e){return new Promise((t,a)=>{let r=new FileReader;r.onload=n=>{n.target?.result?t(n.target.result):a(new Error("Failed to read file"));},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(e);})}var gd=createContext(null);function Tm(){return useContext(gd)}var Dm=createContext(null);function Nm({children:e,themeName:t}){return jsx(Dm.Provider,{value:{themeName:t},children:e})}function Dl(){return useContext(Dm)}function Pa({children:e,container:t}){let[a,r]=useState(false),n=Tm(),s=Dl();if(useEffect(()=>(r(true),()=>r(false)),[]),!a)return null;let o=t||(typeof document<"u"?document.body:null);if(!o)return null;if(n){let{theme:i,themeName:c}=n,l={"--asakaa-color-background-primary":i.bgPrimary,"--asakaa-color-background-secondary":i.bgSecondary,"--asakaa-color-background-card":i.bgGrid,"--asakaa-color-background-hover":i.hoverBg,"--asakaa-color-text-primary":i.textPrimary,"--asakaa-color-text-secondary":i.textSecondary,"--asakaa-color-text-tertiary":i.textTertiary,"--asakaa-color-text-inverse":i.taskBarHandle||"#FFFFFF","--asakaa-color-border-default":i.border,"--asakaa-color-border-hover":i.borderLight,"--asakaa-color-border-subtle":i.borderLight,"--asakaa-color-interactive-primary":i.accent,"--asakaa-color-interactive-primaryHover":i.accentHover,"--asakaa-color-interactive-primaryBorder":`${i.accent}4D`,"--asakaa-color-interactive-primaryBackground":`${i.accent}1A`,"--asakaa-color-interactive-primaryBackgroundHover":`${i.accent}33`,"--asakaa-color-status-success":i.statusCompleted,"--asakaa-color-status-warning":i.milestone,"--asakaa-color-status-error":i.criticalPath,"--asakaa-color-danger":i.criticalPath,"--asakaa-color-danger-border":`${i.criticalPath}4D`,"--asakaa-color-danger-background":`${i.criticalPath}14`,"--asakaa-color-danger-backgroundHover":`${i.criticalPath}26`};return createPortal(jsx("div",{"data-theme":c,"data-gantt-portal":"true",style:l,children:e}),o)}return s?createPortal(jsx("div",{"data-theme":s.themeName,"data-kanban-portal":"true",children:e}),o):createPortal(e,o)}var Fm={URGENT:{label:"Urgent",color:"#EF4444"},HIGH:{label:"High",color:"#F97316"},MEDIUM:{label:"Normal",color:"#F59E0B"},LOW:{label:"Low",color:"#10B981"}},Py="#BDC3C7",Fy=({color:e})=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",fill:e,opacity:"0.9"}),jsx("circle",{cx:"8",cy:"8",r:"6",stroke:e,strokeWidth:"1.5",opacity:"0.3"})]});function os({priority:e,onChange:t,className:a}){let[r,n]=useState(false),[s,o]=useState({top:0,left:0}),i=useRef(null),c=useRef(null),l=()=>{if(!c.current)return;let m=c.current.getBoundingClientRect(),f=window.innerHeight,v=window.innerWidth,b=160,w=220,h=4,x=m.right-b;x<10&&(x=m.left),x+b>v-10&&(x=v-b-10);let y=f-m.bottom,k=m.top,M;y>=w+h?M=m.bottom+h:k>=w+h?M=m.top-w-h:M=y>=k?m.bottom+h:Math.max(10,m.top-w-h),o({top:M,left:x}),n(true);};useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&!c.current?.contains(f.target)&&n(false);};if(r)return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[r]),useEffect(()=>{let m=f=>{f.key==="Escape"&&n(false);};if(r)return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[r]);let u=m=>{t(m),n(false);},p=e?Fm[e]:null,d=p?.color||Py;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:c,onClick:()=>r?n(false):l(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:e?`${d}10`:"transparent",boxShadow:e?`0 0 0 2px ${d}30 inset`:"none"},title:p?.label||"Set priority",children:jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 2L3 14M3 2L13 6L3 8V2Z",stroke:d,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:d,fillOpacity:e?"0.6":"0.4"})})}),r&&jsx(Pa,{children:jsxs("div",{ref:i,className:"priority-selector-menu",style:{position:"fixed",top:`${s.top}px`,left:`${s.left}px`,zIndex:99999,minWidth:"160px",maxHeight:"calc(100vh - 40px)",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Priority"})}),jsxs("div",{className:"py-1",children:[Object.entries(Fm).map(([m,f])=>jsxs("button",{onClick:()=>u(m),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98] priority-option",style:{color:f.color,background:"transparent"},onMouseEnter:v=>{v.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:v=>{v.currentTarget.style.background="transparent";},children:[jsx(Fy,{color:f.color}),jsx("span",{className:"font-semibold text-sm",children:f.label}),e===m&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},m)),jsx("div",{className:"mt-0.5 pt-0.5 border-t",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsxs("button",{onClick:()=>u(void 0),className:"w-full px-3 py-1.5 flex items-center gap-2 text-xs font-medium transition-all active:scale-[0.98]",style:{color:"var(--modal-v2-text-primary, #e5e5e5)",background:"transparent"},onMouseEnter:m=>{m.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:m=>{m.currentTarget.style.background="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"#9CA3AF",strokeWidth:"1.5",strokeDasharray:"2 2",opacity:"0.6"})}),jsx("span",{className:"font-semibold text-sm",children:"Clear"}),!e&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})})]})]})})]})}var Ly=[{label:"Today",days:0},{label:"Tomorrow",days:1},{label:"Next Week",days:7},{label:"2 Weeks",days:14},{label:"4 Weeks",days:28},{label:"8 Weeks",days:56}];function vi({startDate:e,endDate:t,onChange:a,className:r}){let[n,s]=useState(false),[o,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),d=(Dl()?.themeName||"dark")==="dark",m=()=>{if(!l.current)return;let x=l.current.getBoundingClientRect(),y=window.innerHeight,k=window.innerWidth,M=320,H=380,E=4,N=x.left;N+M>k-10&&(N=k-M-10),N<10&&(N=10);let D=y-x.bottom,S=x.top,V;D>=H+E?V=x.bottom+E:S>=H+E?V=x.top-H-E:V=D>=S?x.bottom+E:Math.max(10,x.top-H-E),i({top:V,left:N}),s(true);};useEffect(()=>{let x=y=>{c.current&&!c.current.contains(y.target)&&!l.current?.contains(y.target)&&s(false);};if(n)return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[n]),useEffect(()=>{let x=y=>{y.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[n]);let f=x=>{let y=new Date,k=N=>{let D=N.getFullYear(),S=String(N.getMonth()+1).padStart(2,"0"),V=String(N.getDate()).padStart(2,"0");return `${D}-${S}-${V}`},M=k(y),H=new Date(y);H.setDate(H.getDate()+x);let E=k(H);a(M,E),s(false);},v=()=>{if(!e||!t)return "Set date";let x=H=>{if(H instanceof Date)return H;if(typeof H!="string"||!H.match(/^\d{4}-\d{2}-\d{2}$/))return null;let E=H.split("-").map(Number);if(E.length!==3||E.some(V=>isNaN(V)))return null;let N=E[0],D=E[1],S=E[2];return N===void 0||D===void 0||S===void 0?null:new Date(N,D-1,S)},y=x(e),k=x(t);if(!y||!k||isNaN(y.getTime())||isNaN(k.getTime()))return "Set date";let M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];return `${M[y.getMonth()]} ${y.getDate()} \u2013 ${M[k.getMonth()]} ${k.getDate()}`},b=e&&t,h=(()=>{if(!t)return false;let x=typeof t=="string"?new Date(t):t,y=new Date;return y.setHours(0,0,0,0),x<y})();return jsxs("div",{className:`relative ${r||""}`,children:[jsxs("button",{ref:l,onClick:()=>n?s(false):m(),className:`flex items-center gap-1.5 px-2 py-1 rounded-md text-xs transition-all hover:bg-white/5 ${h?"asakaa-date-overdue":"asakaa-date"}`,title:b?`${v()}`:"Set date range",children:[jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{x:"2",y:"3",width:"12",height:"11",rx:"2",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M2 6H14",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("path",{d:"M11 2V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),e&&t&&jsx("span",{className:"whitespace-nowrap",children:v()})]}),n&&jsx(Pa,{children:jsxs("div",{ref:c,className:"date-picker-menu rounded-xl shadow-2xl border min-w-[320px]",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,background:d?"#1A1D25":"#FFFFFF",border:`1px solid ${d?"rgba(255, 255, 255, 0.15)":"rgba(0, 0, 0, 0.12)"}`,boxShadow:d?"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)":"0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08)",zIndex:99999},children:[jsxs("div",{className:"p-4 border-b",style:{borderColor:d?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)"},children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Quick Select"}),jsx("div",{className:"grid grid-cols-2 gap-2",children:Ly.map(x=>jsx("button",{onClick:()=>f(x.days),className:"px-3 py-2.5 rounded-lg text-xs font-semibold transition-all active:scale-95",style:{color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",border:`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`,backgroundColor:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)"},onMouseEnter:y=>{y.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.1)",y.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.4)":"rgba(0, 0, 0, 0.25)"}`;},onMouseLeave:y=>{y.currentTarget.style.backgroundColor=d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",y.currentTarget.style.border=`1px solid ${d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)"}`;},children:x.label},x.label))})]}),jsxs("div",{className:"p-4",children:[jsx("span",{className:"text-xs font-bold uppercase tracking-wider block mb-3",style:{color:d?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.7)"},children:"Custom Range"}),jsxs("div",{className:"space-y-3",children:[jsx("input",{type:"date",value:e||"",onChange:x=>a(x.target.value,t),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}}),jsx("input",{type:"date",value:t||"",onChange:x=>a(e,x.target.value),className:"w-full px-3 py-2.5 rounded-lg text-sm border focus:outline-none transition-all",style:{background:d?"rgba(255, 255, 255, 0.12)":"rgba(0, 0, 0, 0.05)",borderColor:d?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.15)",color:d?"rgba(255, 255, 255, 0.95)":"rgba(0, 0, 0, 0.85)",colorScheme:d?"dark":"light"}})]}),(e||t)&&jsx("button",{onClick:()=>{a(void 0,void 0),s(false);},className:"mt-4 w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all active:scale-95 border",style:{color:"#ef4444",borderColor:"rgba(239, 68, 68, 0.3)",background:"rgba(239, 68, 68, 0.1)"},onMouseEnter:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.2)";},onMouseLeave:x=>{x.currentTarget.style.background="rgba(239, 68, 68, 0.1)";},children:"Clear Dates"})]})]})})]})}function Po({assignedUsers:e=[],availableUsers:t,onChange:a,className:r,maxVisibleAvatars:n=3,variante:s,nombreDeLaTarea:o,es:i=true}){let[c,l]=useState(false),[u,p]=useState(""),[d,m]=useState({top:0,left:0}),f=useRef(null),v=useRef(null),b=()=>{if(!v.current)return;let k=v.current.getBoundingClientRect(),M=window.innerHeight,H=window.innerWidth,E=300,N=380,D=4,S=k.right-E;S<10&&(S=k.left),S+E>H-10&&(S=H-E-10);let V=M-k.bottom,W=k.top,R;V>=N+D?R=k.bottom+D:W>=N+D?R=k.top-N-D:R=V>=W?k.bottom+D:Math.max(10,k.top-N-D),m({top:R,left:S}),l(true);};useEffect(()=>{let k=M=>{f.current&&!f.current.contains(M.target)&&!v.current?.contains(M.target)&&(l(false),p(""));};if(c)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[c]),useEffect(()=>{let k=M=>{M.key==="Escape"&&(l(false),p(""));};if(c)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[c]);let w=k=>{let M=e.some(H=>H.id===k.id);a(M?e.filter(H=>H.id!==k.id):[...e,k]);},h=t.filter(k=>k.name.toLowerCase().includes(u.toLowerCase())),x=e.slice(0,n),y=e.length-n;return jsxs("div",{className:`relative ${r||""}`,children:[s==="v6"?jsxs("button",{ref:v,type:"button","data-resp-v6":true,onClick:()=>c?l(false):b(),"aria-label":e.length>0?`${i?"Responsable":"Owner"}: ${e.map(k=>k.name).join(", ")}`:`${i?"Sin responsable. Asignar":"No owner. Assign"} ${o??""}`.trim(),title:e.map(k=>k.name).join(", ")||void 0,style:{width:22,height:22,padding:0,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",cursor:"pointer",position:"relative",border:e.length>0?0:"1px dashed var(--v6-tenue-borde, #7A848E)",background:e.length>0?"var(--v6-neutro-fondo, #E1E4E8)":"transparent",color:e.length>0?"var(--v6-texto, #0E1114)":"var(--v6-tenue, #5F6972)",fontSize:11,fontWeight:600,letterSpacing:"-0.03em",overflow:"hidden"},children:[e.length===0?jsxs("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[jsx("path",{d:"M5 12h14"}),jsx("path",{d:"M12 5v14"})]}):e[0]?.avatar?jsx("img",{src:e[0].avatar,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):e[0]?.initials,e.length>1&&jsxs("span",{"aria-hidden":true,style:{position:"absolute",right:-4,bottom:-3,minWidth:12,height:12,padding:"0 2px",borderRadius:6,fontSize:8,lineHeight:"12px",background:"var(--v6-tarjeta, #fff)",color:"var(--v6-texto-2, #4D5761)",boxShadow:"0 0 0 1px var(--v6-borde, #E2E5E9)"},children:["+",e.length-1]})]}):jsx("button",{ref:v,onClick:()=>c?l(false):b(),className:"flex items-center gap-1 p-0.5 rounded transition-all hover:bg-white/10 hover:scale-105 active:scale-95",title:e.length>0?`${e.length} assigned`:"Assign users",children:e.length>0?jsxs("div",{className:"asakaa-avatar-group",children:[x.map(k=>jsx("div",{className:"asakaa-avatar",title:k.name,children:k.avatar?jsx("img",{src:k.avatar,alt:k.name,className:"asakaa-avatar-img"}):k.initials},k.id)),y>0&&jsxs("div",{className:"asakaa-avatar",children:["+",y]})]}):jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center transition-all",style:{background:"rgba(96, 165, 250, 0.15)",border:"1.5px solid rgba(96, 165, 250, 0.4)",color:"#60a5fa"},children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M8 8a3 3 0 100-6 3 3 0 000 6zM4 14c0-2.21 1.79-4 4-4s4 1.79 4 4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"13",y1:"5",x2:"13",y2:"9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("line",{x1:"11",y1:"7",x2:"15",y2:"7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}),c&&jsx(Pa,{children:jsxs("div",{ref:f,className:"user-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${d.top}px`,left:`${d.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-xs font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.8))"},children:"Assign Users"})}),jsx("div",{className:"px-3 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("input",{type:"text",value:u,onChange:k=>p(k.target.value),placeholder:"Search users...",className:"w-full px-3 py-2.5 rounded-lg text-sm border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.2))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[300px] overflow-y-auto",children:h.length===0?jsx("div",{className:"px-4 py-3 text-sm text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.6))"},children:"No users found"}):h.map(k=>{let M=e.some(H=>H.id===k.id);return jsxs("button",{onClick:()=>w(k),className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm transition-all active:scale-98",style:{background:"transparent"},onMouseEnter:H=>{H.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.1))";},onMouseLeave:H=>{H.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-[11px] font-bold flex-shrink-0 shadow-sm",style:{backgroundColor:k.color,color:"#fff"},children:k.avatar?jsx("img",{src:k.avatar,alt:k.name,className:"w-full h-full rounded-full object-cover"}):k.initials}),jsx("span",{className:"font-semibold flex-1 text-left truncate",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.95))"},children:k.name}),jsx("span",{className:"w-5 text-lg flex-shrink-0 text-right",style:{color:M?"#00E5CC":"transparent"},children:M?"\u2713":""})]},k.id)})}),e.length>0&&jsx("div",{className:"px-3 py-3 border-t border-white/10",children:jsx("button",{onClick:()=>{a([]),l(false);},className:"w-full px-3 py-2.5 rounded-lg text-sm font-semibold transition-all hover:bg-red-600/30 active:scale-95 border",style:{color:"#f87171",borderColor:"rgba(248, 113, 113, 0.3)",background:"rgba(248, 113, 113, 0.08)"},children:"Clear All"})})]})})]})}function Nl(e,t,a){let r=new Map;e.forEach(c=>{if(c.dependencies&&Array.isArray(c.dependencies)){let l=c.dependencies.map(u=>{if(typeof u=="string")return u;let p=u;return p.taskId||p.targetId||""}).filter(Boolean);r.set(c.id,l);}});let n=r.get(a)||[];r.set(a,[...n,t]);let s=new Set,o=new Set,i=c=>{if(!s.has(c)){s.add(c),o.add(c);let l=r.get(c)||[];for(let u of l){if(!s.has(u)&&i(u))return true;if(o.has(u))return true}}return o.delete(c),false};return i(a)}function ki({currentCardId:e,dependencies:t=[],availableTasks:a,onChange:r,className:n,validateCircular:s=true,onCircularDependencyError:o}){let[i,c]=useState(false),[l,u]=useState(""),[p,d]=useState(t.length>0),[m,f]=useState({top:0,left:0}),[v,b]=useState(null),w=useRef(null),h=useRef(null),x=()=>{if(!h.current)return;let E=h.current.getBoundingClientRect(),N=window.innerHeight,D=window.innerWidth,S=300,V=p?380:120,W=4,R=E.right-S;R<10&&(R=E.left),R+S>D-10&&(R=D-S-10);let A=N-E.bottom,ve=E.top,q;A>=V+W?q=E.bottom+W:ve>=V+W?q=E.top-V-W:q=A>=ve?E.bottom+W:Math.max(10,E.top-V-W),f({top:q,left:R}),c(true);};useEffect(()=>{if(!i||!h.current)return;let E=h.current.getBoundingClientRect(),N=window.innerHeight,D=window.innerWidth,S=300,V=p?380:120,W=4,R=E.right-S;R<10&&(R=E.left),R+S>D-10&&(R=D-S-10);let A=N-E.bottom,ve=E.top,q;A>=V+W?q=E.bottom+W:ve>=V+W?q=E.top-V-W:q=A>=ve?E.bottom+W:Math.max(10,E.top-V-W),f({top:q,left:R});},[p,i]),useEffect(()=>{let E=N=>{w.current&&!w.current.contains(N.target)&&!h.current?.contains(N.target)&&(c(false),u(""));};if(i)return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[i]),useEffect(()=>{let E=N=>{N.key==="Escape"&&(c(false),u(""));};if(i)return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[i]);let y=E=>{let N=t.includes(E),D=a.find(S=>S.id===E);if(b(null),N){let S=t.filter(V=>V!==E);r(S),S.length===0&&d(false);}else {if(s&&Nl(a,E,e)){let V=`Cannot add "${D?.title||E}" as dependency - would create circular reference`;b(V),o?.(E,D?.title||E),setTimeout(()=>b(null),3e3);return}r([...t,E]),d(true);}},k=()=>{let E=!p;d(E),E||r([]);},M=a.filter(E=>E.id!==e).filter(E=>E.title.toLowerCase().includes(l.toLowerCase())||E.id.toLowerCase().includes(l.toLowerCase())),H=t.length>0?"#00E5CC":"#BDC3C7";return jsxs("div",{className:`relative ${n||""}`,children:[jsxs("button",{ref:h,onClick:()=>i?c(false):x(),className:"flex items-center gap-1 px-2 py-1 rounded transition-all hover:bg-white/5",title:t.length>0?`${t.length} dependencies`:"Add dependencies",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M7 9L9 7M11.5 3.5L10 2C8.89543 0.89543 7.10457 0.89543 6 2C4.89543 3.10457 4.89543 4.89543 6 6L7.5 7.5M4.5 12.5L6 14C7.10457 15.1046 8.89543 15.1046 10 14C11.1046 12.8954 11.1046 11.1046 10 10L8.5 8.5",stroke:H,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),t.length>0&&jsx("span",{className:"text-xs font-medium",style:{color:H},children:t.length})]}),i&&jsx(Pa,{children:jsxs("div",{ref:w,className:"dependencies-selector-menu rounded-xl shadow-2xl border min-w-[300px]",style:{position:"fixed",top:`${m.top}px`,left:`${m.left}px`,maxHeight:"calc(100vh - 40px)",overflow:"hidden",display:"flex",flexDirection:"column",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)",zIndex:99999},children:[v&&jsxs("div",{className:"px-4 py-3 flex items-center gap-2",style:{background:"rgba(239, 68, 68, 0.15)",borderBottom:"1px solid rgba(239, 68, 68, 0.3)"},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8 5V8M8 11H8.01M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z",stroke:"#ef4444",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"text-xs font-medium",style:{color:"#ef4444"},children:v})]}),jsx("div",{className:"px-4 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Task Dependencies"})}),jsx("div",{className:"px-4 py-3 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsxs("label",{className:"flex items-center gap-2 cursor-pointer group",onClick:k,children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center transition-all",style:{background:p?"#00E5CC":"transparent",borderColor:p?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:p&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsx("span",{className:"text-sm font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.8))"},children:"Has dependencies"})]})}),p&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.05))"},children:jsx("input",{type:"text",value:l,onChange:E=>u(E.target.value),placeholder:"Search by name or ID...",className:"w-full px-3 py-2 rounded-md text-xs border outline-none transition-all",style:{background:"var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))",borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))",color:"var(--modal-v2-text-primary, #ffffff)"},autoFocus:true})}),jsx("div",{className:"py-2 max-h-[280px] overflow-y-auto",children:M.length===0?jsx("div",{className:"px-4 py-3 text-xs text-center",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:"No tasks found"}):M.map(E=>{let N=t.includes(E.id);return jsxs("button",{onClick:()=>y(E.id),className:"w-full px-4 py-2 flex items-start gap-3 text-sm transition-colors",style:{background:"transparent"},onMouseEnter:D=>{D.currentTarget.style.background="var(--modal-v2-bg-secondary, rgba(255, 255, 255, 0.05))";},onMouseLeave:D=>{D.currentTarget.style.background="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0 mt-0.5 transition-all",style:{background:N?"#00E5CC":"transparent",borderColor:N?"#00E5CC":"var(--modal-v2-border, rgba(255, 255, 255, 0.3))"},children:N&&jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M2 6L5 9L10 3",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxs("div",{className:"flex-1 text-left",children:[jsx("div",{className:"font-medium",style:{color:"var(--modal-v2-text-primary, rgba(255, 255, 255, 0.9))"},children:E.title}),jsx("div",{className:"text-xs mt-0.5",style:{color:"var(--modal-v2-text-tertiary, rgba(255, 255, 255, 0.5))"},children:E.id})]})]},E.id)})})]}),t.length>0&&jsx("div",{className:"px-3 py-2 border-t border-white/5",children:jsx("button",{onClick:()=>{r([]),d(false),c(false);},className:"w-full px-3 py-2 rounded-md text-xs font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#E74C3C"},children:"Clear All Dependencies"})})]})})]})}var fo=memo(({card:e,render:t,onClick:a,isSelected:r,disableDrag:n,className:s,onUpdate:o,availableUsers:i=[],allCards:c=[]})=>{let{attributes:l,listeners:u,setNodeRef:p,transform:d,transition:m,isDragging:f}=useSortable({id:e.id,disabled:n,data:{type:"card",card:e}}),v={transform:wl.Transform.toString(d),transition:m};if(t)return jsx("div",{ref:p,style:v,...l,...u,onClick:()=>a?.(e),children:t(e)});let b=i.filter(y=>e.assignedUserIds?.includes(y.id)),w=e.progress===100,h=(e.attachments||[]).filter(y=>y.type.startsWith("image/")),x={...v,...e.color&&{borderTopWidth:"3px",borderTopStyle:"solid",borderTopColor:e.color}};return jsxs("div",{ref:p,style:x,className:g("asakaa-card",f&&"asakaa-card-dragging",r&&"ring-2 ring-asakaa-accent-blue",s),...l,...u,onClick:y=>{y.target.closest(".priority-selector, .date-picker, .user-selector, .dependencies-selector")||a?.(e);},children:[e.coverImage&&jsx("div",{className:"asakaa-card-cover mb-3",children:jsx("img",{src:e.coverImage,alt:`Cover for ${e.title}`,className:"w-full h-32 object-cover rounded-md",loading:"lazy",onError:y=>{y.currentTarget.style.display="none";}})}),h.length>0&&!e.coverImage&&jsx("div",{className:"asakaa-card-attachments mb-3",children:h.length===1&&h[0]?jsx("img",{src:h[0].url,alt:h[0].name,className:"w-full h-32 object-cover rounded-md",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:y=>{y.currentTarget.style.display="none";}}):jsx("div",{className:"grid grid-cols-2 gap-1",children:h.slice(0,4).map((y,k)=>jsxs("div",{className:"relative",children:[jsx("img",{src:y.url,alt:y.name,className:"w-full h-16 object-cover rounded",loading:"lazy",decoding:"async",style:{imageRendering:"auto",WebkitBackfaceVisibility:"hidden",backfaceVisibility:"hidden",transform:"translateZ(0)"},onError:M=>{M.currentTarget.style.display="none";}}),k===3&&h.length>4&&jsx("div",{className:"absolute inset-0 bg-black/60 rounded flex items-center justify-center",children:jsxs("span",{className:"text-white text-sm font-medium",children:["+",h.length-4]})})]},y.id))})}),jsx("h3",{className:"asakaa-card-title mb-2",style:{textDecoration:w?"line-through":"none",opacity:w?.6:1},children:e.title}),e.description&&jsx("p",{className:"asakaa-card-description mb-3",children:e.description}),jsxs("div",{className:"flex items-center gap-3 mb-3 pt-1",children:[jsx("div",{onClick:y=>y.stopPropagation(),className:"priority-selector",children:jsx(os,{priority:e.priority,onChange:y=>o?.(e.id,{priority:y})})}),jsx("div",{onClick:y=>y.stopPropagation(),className:"date-picker",children:jsx(vi,{startDate:e.startDate?typeof e.startDate=="string"?e.startDate:e.startDate.toISOString().split("T")[0]:void 0,endDate:e.endDate?typeof e.endDate=="string"?e.endDate:e.endDate.toISOString().split("T")[0]:void 0,onChange:(y,k)=>o?.(e.id,{startDate:y,endDate:k})})}),i.length>0&&jsx("div",{onClick:y=>y.stopPropagation(),className:"user-selector",children:jsx(Po,{assignedUsers:b,availableUsers:i,onChange:y=>o?.(e.id,{assignedUserIds:y.map(k=>k.id)})})}),jsx("div",{onClick:y=>y.stopPropagation(),className:"dependencies-selector",children:jsx(ki,{currentCardId:e.id,dependencies:Array.isArray(e.dependencies)?e.dependencies.map(y=>typeof y=="string"?y:y.taskId):[],availableTasks:c,onChange:y=>o?.(e.id,{dependencies:y})})})]}),e.labels&&e.labels.length>0&&jsx("div",{className:"flex flex-wrap gap-1",children:e.labels.slice(0,3).map(y=>jsx("span",{className:"asakaa-label",children:y},y))}),typeof e.progress=="number"&&jsxs("div",{className:"mt-3 pt-2 border-t border-white/5",children:[jsxs("div",{className:"flex items-center justify-between mb-1",children:[jsx("span",{className:"text-[10px] text-[#6B7280]",children:"Progreso"}),jsxs("span",{className:"text-[10px] font-medium",style:{color:"#00E5CC"},children:[Math.round(e.progress),"%"]})]}),jsx("div",{className:"h-1.5 rounded-full bg-white/5 overflow-hidden",children:jsx("div",{className:"h-full rounded-full transition-all duration-300",style:{width:`${Math.min(100,Math.max(0,e.progress))}%`,backgroundColor:"#00E5CC"}})})]})]})},(e,t)=>e.card.id===t.card.id&&e.card.title===t.card.title&&e.card.description===t.card.description&&e.card.position===t.card.position&&e.card.columnId===t.card.columnId&&e.card.priority===t.card.priority&&e.card.color===t.card.color&&e.card.progress===t.card.progress&&e.card.startDate===t.card.startDate&&e.card.endDate===t.card.endDate&&e.isSelected===t.isSelected&&e.render===t.render&&JSON.stringify(e.card.labels)===JSON.stringify(t.card.labels)&&JSON.stringify(e.card.assignedUserIds)===JSON.stringify(t.card.assignedUserIds)&&JSON.stringify(e.card.dependencies)===JSON.stringify(t.card.dependencies)&&JSON.stringify(e.card.attachments?.map(a=>a.id))===JSON.stringify(t.card.attachments?.map(a=>a.id)));fo.displayName="Card";var Ci={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!",columns:"Columns"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task",dependencies:"Dependencies\u2026"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Om={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos los niveles",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista de seguimiento",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!",columns:"Columnas"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea",dependencies:"Dependencias\u2026"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por hacer",inProgress:"En progreso",completed:"Completada"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},yd={en:Ci,es:Om};function Hm(e){return yd[e]||yd.en}function xd(e,t){let a=Hm(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var ls=createContext(Ci);function Rr(){return useContext(ls)}function bo(){let e=useContext(ls);return e===Ci&&typeof document<"u"?document.documentElement.lang?.startsWith("es")??false:e.toolbar.visibility==="Visibilidad"}var Ti={todo:{label:"To Do",color:"#94a3b8",icon:"circle"},"in-progress":{label:"In Progress",color:"#60a5fa",icon:"circle-dot"},completed:{label:"Completed",color:"#34d399",icon:"check-circle"}},Vm=({icon:e,color:t})=>e==="circle"?jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"})}):e==="circle-dot"?jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:"none"}),jsx("circle",{cx:"8",cy:"8",r:"3",fill:t})]}):jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:t,strokeWidth:"1.5",fill:t,fillOpacity:"0.2"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:t,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Gm({status:e="todo",onChange:t,className:a,customStatuses:r=[]}){let[n,s]=useState(false),[o,i]=useState({top:0,left:0}),c=useRef(null),l=useRef(null),p=bo()?{todo:"Por hacer","in-progress":"En progreso",completed:"Completada"}:{todo:"To do","in-progress":"In progress",completed:"Completed"},d=[...Object.entries(Ti).map(([h,x])=>({id:h,label:p[h]??x.label,color:x.color,icon:x.icon})),...r.filter(h=>!Object.keys(Ti).includes(h.id)).map(h=>({id:h.id,label:h.title,color:h.color||"#8B5CF6",icon:"circle-dot"}))],m=()=>{let h=Ti[e];if(h)return {...h,label:p[e]??h.label,id:e};let x=r.find(y=>y.id===e);return x?{id:x.id,label:x.title,color:x.color||"#8B5CF6",icon:"circle-dot"}:{...Ti.todo,label:p.todo??Ti.todo.label,id:"todo"}},f=()=>{if(!l.current)return;let h=l.current.getBoundingClientRect(),x=window.innerHeight,y=window.innerWidth,k=180,M=280,H=4,E=h.right-k;E<10&&(E=h.left),E+k>y-10&&(E=y-k-10);let N=x-h.bottom,D=h.top,S;N>=M+H?S=h.bottom+H:D>=M+H?S=h.top-M-H:S=N>=D?h.bottom+H:Math.max(10,h.top-M-H),i({top:S,left:E}),s(true);};useEffect(()=>{let h=x=>{c.current&&!c.current.contains(x.target)&&!l.current?.contains(x.target)&&s(false);};if(n)return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[n]),useEffect(()=>{let h=x=>{x.key==="Escape"&&s(false);};if(n)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[n]);let v=h=>{t(h),s(false);},b=m(),w=b.color;return jsxs("div",{className:`relative ${a||""}`,children:[jsx("button",{ref:l,onClick:()=>n?s(false):f(),className:"flex items-center justify-center w-8 h-8 rounded-lg transition-all hover:bg-white/15 hover:scale-110 active:scale-95",style:{background:`${w}10`,boxShadow:`0 0 0 2px ${w}30 inset`},title:b.label,children:jsx(Vm,{icon:b.icon,color:w})}),n&&jsx(Pa,{children:jsxs("div",{ref:c,className:"status-selector-menu",style:{position:"fixed",top:`${o.top}px`,left:`${o.left}px`,zIndex:99999,minWidth:"180px",maxHeight:"calc(100vh - 40px)",overflowY:"auto",borderRadius:"8px",background:"var(--modal-v2-bg, #1f1f1f)",border:"1px solid var(--modal-v2-border, rgba(255, 255, 255, 0.15))",boxShadow:"0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},children:[jsx("div",{className:"px-3 py-1.5 border-b",style:{borderColor:"var(--modal-v2-border, rgba(255, 255, 255, 0.1))"},children:jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:"var(--modal-v2-text-secondary, rgba(255, 255, 255, 0.7))"},children:"Status"})}),jsx("div",{className:"py-1",children:d.map(h=>jsxs("button",{onClick:()=>v(h.id),className:"w-full px-3 py-2 flex items-center gap-2.5 text-sm font-medium transition-all active:scale-[0.98] status-option",style:{color:h.color,background:"transparent"},onMouseEnter:x=>{x.currentTarget.style.background="var(--modal-v2-bg-tertiary, rgba(255, 255, 255, 0.15))";},onMouseLeave:x=>{x.currentTarget.style.background="transparent";},children:[jsx(Vm,{icon:h.icon,color:h.color}),jsx("span",{className:"font-semibold",children:h.label}),e===h.id&&jsx("svg",{className:"ml-auto",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"#00E5CC",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]},h.id))})]})})]})}var _m={en:{renameColumn:"Rename Column",rename:"Rename",delete:"Delete",columnName:"Column name",columnOptions:"Column options"},es:{renameColumn:"Renombrar Columna",rename:"Renombrar",delete:"Eliminar",columnName:"Nombre de columna",columnOptions:"Opciones de columna"}};function Km({columnTitle:e,onRename:t,onDelete:a,isDeletable:r=false,className:n,locale:s="en"}){let o=_m[s]||_m.en,[i,c]=useState(false),[l,u]=useState(false),[p,d]=useState(e),[m,f]=useState({top:0,left:0}),v=useRef(null),b=useRef(null),w=useRef(null);useEffect(()=>{if(i&&b.current){let k=b.current.getBoundingClientRect();f({top:k.bottom+window.scrollY+8,left:k.left+window.scrollX});}},[i]),useEffect(()=>{let k=M=>{v.current&&!v.current.contains(M.target)&&!b.current?.contains(M.target)&&(c(false),u(false));};if(i)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[i]),useEffect(()=>{let k=M=>{M.key==="Escape"&&(c(false),u(false),d(e));};if(i)return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[i,e]),useEffect(()=>{l&&w.current&&(w.current.focus(),w.current.select());},[l]);let h=()=>{u(true),d(e);},x=()=>{let k=p.trim();k&&k!==e&&t(k),u(false),c(false),d(e);},y=k=>{k.key==="Enter"?x():k.key==="Escape"&&(u(false),d(e));};return jsxs("div",{className:`relative ${n||""}`,children:[jsx("button",{ref:b,onClick:()=>c(!i),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-[var(--pj-hover,rgba(255,255,255,0.1))]",title:o.columnOptions,"aria-label":o.columnOptions,children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"3",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"8",r:"1.5",fill:"currentColor"}),jsx("circle",{cx:"8",cy:"13",r:"1.5",fill:"currentColor"})]})}),i&&jsx(Pa,{children:jsx("div",{ref:v,className:"fixed rounded-xl shadow-2xl border min-w-[200px]",style:{top:`${m.top}px`,left:`${m.left}px`,background:"var(--pj-superficie, var(--asakaa-color-background-card, #1f1f1f))",borderColor:"var(--pj-borde, rgba(255, 255, 255, 0.15))",color:"var(--pj-texto, var(--asakaa-color-text-primary, #f4f5f8))",boxShadow:"var(--pj-elev-2, 0 20px 60px rgba(0, 0, 0, 0.8))",zIndex:99999},children:l?jsxs("div",{className:"p-3",children:[jsx("label",{className:"text-xs font-bold uppercase tracking-wider block mb-2 opacity-80",children:o.renameColumn}),jsx("input",{ref:w,type:"text",value:p,onChange:k=>d(k.target.value),onKeyDown:y,onBlur:x,className:"w-full px-3 py-2 rounded-lg text-sm border outline-none transition-all bg-[var(--pj-superficie,rgba(255,255,255,0.05))] border-[var(--pj-borde,rgba(255,255,255,0.2))] text-[color:inherit] placeholder:opacity-50 focus:border-[var(--pj-acento,#00E5CC)]",placeholder:o.columnName,maxLength:50})]}):jsxs("div",{className:"py-1",children:[jsxs("button",{onClick:h,className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm hover:bg-[var(--pj-hover,rgba(255,255,255,0.1))] transition-all",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M11.5 1.5L14.5 4.5L5 14H2V11L11.5 1.5Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-medium",children:o.rename})]}),r&&a&&jsxs(Fragment,{children:[jsx("div",{className:"h-px mx-2 my-1",style:{background:"var(--pj-borde, rgba(255, 255, 255, 0.15))"}}),jsxs("button",{onClick:()=>{a(),c(false);},className:"w-full px-4 py-2.5 flex items-center gap-3 text-sm text-[color:var(--pj-peligro,#f87171)] hover:bg-red-500/10 transition-all",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M2 4H14M5 4V2.5C5 2.22386 5.22386 2 5.5 2H10.5C10.7761 2 11 2.22386 11 2.5V4M12.5 4V13.5C12.5 13.7761 12.2761 14 12 14H4C3.72386 14 3.5 13.7761 3.5 13.5V4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M6.5 7V11M9.5 7V11",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),jsx("span",{className:"font-medium",children:o.delete})]})]})]})})})]})}var Ml=e=>!String(e||"es").toLowerCase().startsWith("en"),Oy=["CO","MX","AR","CL","PE","EC","UY","BR","US","ES"];function Hy(){try{let e=typeof document<"u"?document.documentElement.dataset.pais:void 0;return e&&Oy.includes(e)?e:"CO"}catch{return "CO"}}var qm=e=>`${Ml(e)?"es":"en"}-${Hy()}`;function Wy(e,t){if(!e)return "$";try{return new Intl.NumberFormat(qm(t),{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).formatToParts(0).find(a=>a.type==="currency")?.value??"$"}catch{return "$"}}function Ao(e,t="es",a=0){return Number.isFinite(e)?new Intl.NumberFormat(qm(t),{minimumFractionDigits:0,maximumFractionDigits:a}).format(e):"\u2014"}function Qa(e,t,a="es",r={}){if(!Number.isFinite(e))return "\u2014";let n=e<0?"-":"",s=Math.abs(e),o;if(r.compacto&&s>=1e3){let c=Ml(a),[l,u]=s>=1e9?[1e9,c?" mil M":"B"]:s>=1e6?[1e6,c?" M":"M"]:[1e3,c?" mil":"K"];o=Ao(s/l,a,1)+u;}else o=Ao(s,a,r.decimales??0);let i=Wy(t,a);return i==="$"||!t?`${n}$${o}${t?` ${t}`:""}`:Ml(a)?`${n}${o} ${i}`:`${n}${i}${o}`}function un(e,t="es"){if(!Number.isFinite(e))return "\u2014";let a=e<0?"-":"",r=Math.round(Math.abs(e)),n=Math.floor(r/60),s=r%60;return n===0&&s===0?"0 h":n===0?`${a}${s} min`:`${a}${Ao(n,t)} h${s?` ${s} min`:""}`}function Wr(e,t="es",a=0){return Number.isFinite(e)?`${Ao(e,t,a)}%`:"\u2014"}var zy=["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],Uy=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function zr(e,t="es",a={}){let r=jy(e);if(!r)return "\u2014";let n=a.hoy??new Date,s=a.anio==="siempre"||a.anio!=="nunca"&&r.getFullYear()!==n.getFullYear();return Ml(t)?`${r.getDate()} ${zy[r.getMonth()]}${s?` ${r.getFullYear()}`:""}`:`${Uy[r.getMonth()]} ${r.getDate()}${s?`, ${r.getFullYear()}`:""}`}function jy(e){if(!e)return null;if(e instanceof Date)return isNaN(e.getTime())?null:e;if(e.length===10&&e[4]==="-"&&e[7]==="-"){let[a=NaN,r=NaN,n=NaN]=e.split("-").map(Number),s=new Date(a,r-1,n);return isNaN(s.getTime())?null:s}let t=new Date(e);return isNaN(t.getTime())?null:t}var Bs=memo(({column:e,cards:t,renderColumn:a,renderCard:r,renderHeader:n,renderEmptyState:s,onCardClick:o,onCardUpdate:i,availableUsers:c,allCards:l,enableVirtualization:u,cardHeight:p=120,isCollapsed:d,onToggleCollapse:m,onColumnRename:f,onColumnDelete:v,isDeletable:b=false,className:w,renderMetrics:h,locale:x})=>{let{setNodeRef:y,isOver:k}=useDroppable({id:e.id,data:{type:"column",column:e}}),M=useRef(null),H=u??fm(t.length),E=useVirtualizer({count:t.length,getScrollElement:()=>M.current,estimateSize:()=>p,enabled:H}),N=t.filter(R=>!R.metadata?.isContainer).length;if(a)return jsx("div",{ref:y,className:w,children:a(e,t)});let S=(()=>{if(!e.wipLimit)return {state:"none",percentage:0};let R=t.length/e.wipLimit*100;return t.length>e.wipLimit?{state:"exceeded",percentage:R}:R>=80?{state:"warning",percentage:R}:R>=60?{state:"approaching",percentage:R}:{state:"ok",percentage:R}})(),V=S.state==="exceeded",W=()=>"asakaa-column-count";return jsxs("div",{ref:y,className:g("asakaa-column",k&&"ring-2 ring-asakaa-accent-blue",V&&"ring-2 ring-asakaa-accent-red",w),children:[n?n(e,N):jsxs("div",{className:"asakaa-column-header group",children:[jsx("h2",{className:"asakaa-column-title",children:e.title}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g(W()),children:[N,e.wipLimit&&` / ${e.wipLimit}`]}),e.wipLimit&&S.state!=="none"&&jsxs("span",{className:"text-xs font-medium flex items-center",title:`${Wr(S.percentage,x==="es"?"es":"en")} capacity${e.wipLimitType==="hard"?" (Hard limit - blocks new cards)":" (Soft limit - shows warning)"}`,children:[S.state==="exceeded"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#EF4444",opacity:"0.9"}),jsx("path",{d:"M5 5L11 11M11 5L5 11",stroke:"white",strokeWidth:"2",strokeLinecap:"round"})]}),S.state==="warning"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("path",{d:"M8 1L15 14H1L8 1Z",fill:"#F59E0B",opacity:"0.9"}),jsx("path",{d:"M8 6V9M8 11V11.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"})]}),S.state==="approaching"&&jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M8 1L10 7H14L10 10L12 16L8 12L4 16L6 10L2 7H6L8 1Z",fill:"#FB923C",opacity:"0.9"})}),S.state==="ok"&&jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",children:[jsx("circle",{cx:"8",cy:"8",r:"7",fill:"#10B981",opacity:"0.9"}),jsx("path",{d:"M5 8L7 10L11 6",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})]}),(f||v)&&jsx(Km,{columnTitle:e.title,onRename:R=>f?.(e.id,R),onDelete:v?()=>v(e.id):void 0,isDeletable:b,locale:x}),m&&jsx("button",{onClick:m,className:"text-asakaa-text-tertiary hover:text-asakaa-text-primary","aria-label":d?"Expand column":"Collapse column",children:d?"\u25B6":"\u25BC"})]})]}),h&&h(e,t),!d&&jsx("div",{ref:M,className:"asakaa-column-cards",style:{maxHeight:H?"600px":void 0},children:jsx(SortableContext,{items:t.map(R=>R.id),strategy:verticalListSortingStrategy,children:t.length===0?s?s(e):jsx("div",{className:"asakaa-drop-zone asakaa-empty",children:jsx("p",{children:"Drop cards here"})}):H?jsx("div",{style:{height:`${E.getTotalSize()}px`,position:"relative"},children:E.getVirtualItems().map(R=>{let A=t[R.index];return A?jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${R.start}px)`},children:jsx(fo,{card:A,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l})},A.id):null})}):t.map(R=>jsx(fo,{card:R,render:r,onClick:o,onUpdate:i,availableUsers:c,allCards:l},R.id))})})]})});Bs.displayName="Column";function wd({title:e,onSave:t,className:a}){let[r,n]=useState(false),[s,o]=useState(e),i=useRef(null);useEffect(()=>{r&&i.current&&(i.current.focus(),i.current.select());},[r]);let c=()=>{let u=s.trim();u&&u!==e?t(u):o(e),n(false);},l=u=>{u.key==="Enter"?c():u.key==="Escape"&&(o(e),n(false));};return r?jsx("input",{ref:i,type:"text",value:s,onChange:u=>o(u.target.value),onBlur:c,onKeyDown:l,className:g("asakaa-column-title bg-transparent border-b-2 border-[#00E5CC]","outline-none px-1 -ml-1",a),maxLength:50}):jsx("h2",{className:g("asakaa-column-title cursor-pointer",a),onClick:()=>n(true),title:"Click to edit",children:e})}function ba(e){let t=(e??"").trim().split(/\s+/).filter(r=>/[\p{L}\p{N}]/u.test(r)),a=r=>r.match(/[\p{L}\p{N}]/u)?.[0]??"";return t.length>=2?(a(t[0])+a(t[t.length-1])).toUpperCase():t.length===1?t[0].replace(/[^\p{L}\p{N}]/gu,"").slice(0,2).toUpperCase():"?"}function ox(e,t){let a=e.slice(0,t),r=a.lastIndexOf("@");if(r===-1)return null;let n=a[r-1];if(r>0&&n&&!/\s/.test(n))return null;let s=a.slice(r+1);return /\s/.test(s)?null:{start:r,end:t,query:s.toLowerCase()}}function eg(e,t){let a=[],r=/@(\S+)/g,n;for(;(n=r.exec(e))!==null;){let s=n[1]?.toLowerCase()??"";if(!s)continue;let o=t.find(i=>{let c=i.name.toLowerCase(),l=c.replace(/\s+/g,""),u=c.split(/\s+/);return !!(l===s||c===s||u.some(p=>p===s))});o&&!a.includes(o.id)&&a.push(o.id);}return a}function sx(e){return ba(e)}function ix(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}var lx=["\u{1F600}","\u{1F602}","\u{1F970}","\u{1F60D}","\u{1F914}","\u{1F44D}","\u{1F44E}","\u{1F389}","\u{1F525}","\u2764\uFE0F","\u{1F4AF}","\u2705","\u274C","\u26A0\uFE0F","\u{1F4CC}","\u{1F4A1}","\u{1F680}","\u2B50","\u{1F3AF}","\u{1F4AA}","\u{1F64F}","\u{1F440}","\u{1F4DD}","\u{1F4AC}"];function tg({value:e,onChange:t,onSubmit:a,users:r,placeholder:n,disabled:s=false,isSubmitting:o=false,theme:i="dark",locale:c="es",currentUser:l,enableEmoji:u=true,enableAttachments:p=true,pendingFiles:d=[],onFilesSelect:m,onRemoveFile:f,maxFileSizeMB:v=10}){let b=i==="dark",[w,h]=useState(false),[x,y]=useState([]),[k,M]=useState(0),[H,E]=useState(null),[N,D]=useState(false),S=useRef(null),V=useRef(null),W=useRef(null),R=useRef(null),A=useCallback(($,fe)=>{let ie=ox($,fe);if(E(ie),ie){let et=r.filter(Xe=>Xe.name.toLowerCase().includes(ie.query)||Xe.email&&Xe.email.toLowerCase().includes(ie.query)).slice(0,5);y(et),h(et.length>0),M(0);}else h(false),y([]);},[r]),ve=$=>{let fe=$.target.value;if(t(fe),A(fe,$.target.selectionStart||0),S.current){S.current.style.height="24px";let ie=S.current.scrollHeight,et=280,Xe=Math.min(ie,et);S.current.style.height=`${Xe}px`,S.current.style.overflowY=ie>et?"auto":"hidden";}},q=()=>{S.current&&A(e,S.current.selectionStart||0);},le=useCallback($=>{if(!H||!S.current)return;let fe=e.slice(0,H.start),ie=e.slice(H.end),et=`@${$.name.replace(/\s+/g,"")} `,Xe=fe+et+ie;t(Xe),h(false),E(null),setTimeout(()=>{if(S.current){let Qe=H.start+et.length;S.current.selectionStart=Qe,S.current.selectionEnd=Qe,S.current.focus();}},0);},[H,e,t]),B=$=>{if(w&&x.length>0)switch($.key){case "ArrowDown":$.preventDefault(),M(fe=>fe<x.length-1?fe+1:0);break;case "ArrowUp":$.preventDefault(),M(fe=>fe>0?fe-1:x.length-1);break;case "Enter":{$.preventDefault();let fe=x[k];fe&&le(fe);break}case "Tab":{$.preventDefault();let fe=x[k];fe&&le(fe);break}case "Escape":$.preventDefault(),h(false);break}else $.key==="Enter"&&!$.shiftKey&&($.preventDefault(),a());};useEffect(()=>{let $=fe=>{V.current&&!V.current.contains(fe.target)&&S.current&&!S.current.contains(fe.target)&&h(false),R.current&&!R.current.contains(fe.target)&&D(false);};return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[]);let pe=useCallback($=>{if(!S.current)return;let fe=S.current.selectionStart||e.length,ie=e.slice(0,fe)+$+e.slice(fe);t(ie),D(false),setTimeout(()=>{if(S.current){let et=fe+$.length;S.current.selectionStart=et,S.current.selectionEnd=et,S.current.focus();}},0);},[e,t]),nt=useCallback($=>{if(!m||!$.target.files)return;let fe=Array.from($.target.files),ie=v*1024*1024,et=fe.filter(Xe=>Xe.size>ie?(console.warn(`File ${Xe.name} exceeds max size of ${v}MB`),false):true);et.length>0&&m(et),$.target.value="";},[m,v]),Ue=useCallback($=>$.type.startsWith("image/")?Image:$.type.includes("pdf")||$.type.includes("document")?FileText:File,[]);return useEffect(()=>{if(w&&V.current){let $=V.current.children[k];$&&$.scrollIntoView({block:"nearest"});}},[k,w]),jsxs("div",{className:"flex flex-col gap-2",children:[d.length>0&&jsx("div",{className:"flex flex-wrap gap-2",children:d.map($=>{let fe=Ue($.file),ie=$.file.type.startsWith("image/");return jsxs("div",{className:g("relative group flex items-center gap-2 px-2 py-1.5 rounded-lg",b?"bg-white/10":"bg-gray-100"),children:[ie&&$.preview?jsx("img",{src:$.preview,alt:$.file.name,className:"w-6 h-6 rounded object-cover"}):jsx(fe,{className:g("w-4 h-4",b?"text-[#9CA3AF]":"text-gray-500")}),jsxs("div",{className:"flex-1 min-w-0 max-w-[120px]",children:[jsx("p",{className:g("text-xs truncate",b?"text-white":"text-gray-900"),children:$.file.name}),jsx("p",{className:g("text-xs",b?"text-[#6B7280]":"text-gray-400"),children:ix($.file.size)})]}),f&&jsx("button",{onClick:()=>f($.id),className:g("p-0.5 rounded-full transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600"),children:jsx(X,{className:"w-3 h-3"})})]},$.id)})}),jsxs("div",{className:"flex items-start gap-2",children:[l&&jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:l.color||"#8B5CF6"},children:l.name?ba(l.name):"U"}),jsxs("div",{className:g("flex-1 relative min-w-0"),children:[jsxs("div",{className:g("flex items-end gap-1 px-2 py-2 rounded-lg",b?"bg-white/5":"bg-white border border-gray-200"),children:[u&&jsxs("div",{className:"relative",children:[jsx("button",{type:"button",onClick:()=>D(!N),disabled:s||o,className:g("p-1 rounded transition-colors flex-shrink-0",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:"Emojis",children:jsx(Smile,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:N&&jsx(motion.div,{ref:R,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 mb-2 p-2 rounded-lg shadow-xl z-50",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-8 gap-1 w-[200px]",children:lx.map($=>jsx("button",{type:"button",onClick:()=>pe($),className:g("w-6 h-6 flex items-center justify-center text-lg rounded transition-colors hover:scale-110",b?"hover:bg-white/10":"hover:bg-gray-100"),children:$},$))})})})]}),p&&m&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:()=>W.current?.click(),disabled:s||o,className:g("p-1.5 rounded transition-colors",b?"hover:bg-white/10 text-[#6B7280] hover:text-white":"hover:bg-gray-100 text-gray-400 hover:text-gray-600",(s||o)&&"opacity-50"),title:c==="es"?"Adjuntar archivo":"Attach file",children:jsx(Paperclip,{className:"w-4 h-4"})}),jsx("input",{ref:W,type:"file",multiple:true,onChange:nt,className:"hidden",accept:"image/*,.pdf,.doc,.docx,.xls,.xlsx,.txt,.zip"})]}),jsx("textarea",{ref:S,value:e,onChange:ve,onSelect:q,onKeyDown:B,placeholder:n||(c==="es"?"Escribe un comentario...":"Write a comment..."),disabled:s||o,rows:1,className:g("flex-1 bg-transparent text-sm outline-none min-w-[100px] resize-none py-0.5",b?"text-white placeholder:text-[#6B7280] scrollbar-slim":"text-gray-900 placeholder:text-gray-400 scrollbar-slim-light",(s||o)&&"opacity-50"),style:{lineHeight:"1.5",height:"24px",maxHeight:"280px",overflowY:"hidden"}}),jsx("button",{onClick:a,disabled:o||!e.trim()&&d.length===0||s,className:g("p-1.5 rounded transition-colors",(e.trim()||d.length>0)&&!s?"bg-[#00E5CC] text-white hover:bg-[#00C4AE]":b?"text-[#6B7280]":"text-gray-400",o&&"opacity-50 cursor-not-allowed"),children:o?jsx("div",{className:"w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin"}):jsx(Send,{className:"w-4 h-4"})})]}),jsx(AnimatePresence,{children:w&&x.length>0&&jsx(motion.div,{ref:V,initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:g("absolute bottom-full left-0 right-0 mb-1 py-1 rounded-lg shadow-xl z-50","max-h-[200px] overflow-y-auto",b?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:x.map(($,fe)=>jsxs("button",{type:"button",onClick:()=>le($),className:g("w-full flex items-center gap-3 px-3 py-2 text-left transition-colors",fe===k?b?"bg-white/10":"bg-gray-100":b?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:$.color||"#8B5CF6"},children:sx($.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("p",{className:g("text-sm font-medium truncate",b?"text-white":"text-gray-900"),children:$.name}),$.email&&jsx("p",{className:g("text-xs truncate",b?"text-[#6B7280]":"text-gray-500"),children:$.email})]})]},$.id))})})]})]})]})}function ag({content:e,theme:t="dark"}){let a=t==="dark",r=[],n=/@(\S+)/g,s=0,o;for(;(o=n.exec(e))!==null;)o.index>s&&r.push({type:"text",value:e.slice(s,o.index)}),r.push({type:"mention",value:o[0]}),s=o.index+o[0].length;return s<e.length&&r.push({type:"text",value:e.slice(s)}),jsx("span",{className:"whitespace-pre-wrap break-words",children:r.map((i,c)=>i.type==="mention"?jsx("span",{className:g("inline-flex items-center px-1 py-0.5 rounded","font-medium text-sm",a?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:i.value},c):jsx("span",{children:i.value},c))})}var Ll=["#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#22C55E","#10B981","#00E5CC","#00E5CC","#0EA5E9","#00E5CC","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899"];function $s({selectedTags:e,availableTags:t,onChange:a,onCreateTag:r,theme:n,disabled:s=false,compact:o=true}){let[i,c]=useState(false),[l,u]=useState(""),[p,d]=useState(false),[m,f]=useState(Ll[10]||"#00E5CC"),[v,b]=useState({top:0,left:0}),w=useRef(null),h=useRef(null),x=useRef(null),y=useRef(null),k=t.filter(S=>S.name.toLowerCase().includes(l.toLowerCase())),M=t.some(S=>S.name.toLowerCase()===l.toLowerCase());useEffect(()=>{if(i&&h.current){let S=h.current.getBoundingClientRect();b({top:S.bottom+6,left:S.left});}},[i]),useEffect(()=>{let S=V=>{let W=V.target,R=w.current?.contains(W),A=x.current?.contains(W);!R&&!A&&(c(false),u(""),d(false));};if(i)return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[i]),useEffect(()=>{i&&y.current&&y.current.focus();},[i]);let H=S=>{let V=e.some(W=>W.id===S.id);a(V?e.filter(W=>W.id!==S.id):[...e,S]);},E=async()=>{if(!(!r||!l.trim())){d(true);try{let S=await r(l.trim(),m);S&&(a([...e,S]),u(""),f(Ll[Math.floor(Math.random()*Ll.length)]||"#00E5CC"));}finally{d(false);}}},N=(S,V)=>{V.stopPropagation(),a(e.filter(W=>W.id!==S));},D={backgroundColor:`${n.textTertiary}15`,border:`1px solid ${n.borderLight}`,color:n.textSecondary};return jsxs("div",{ref:w,className:"relative",children:[jsxs("button",{ref:h,type:"button",onClick:()=>!s&&c(!i),className:"flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:D,disabled:s,children:[jsx(Tag,{className:"w-3.5 h-3.5"}),e.length>0?jsxs("div",{className:"flex items-center gap-1",children:[e.slice(0,2).map(S=>jsx("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-xs font-medium",style:{backgroundColor:`${S.color}20`,color:S.color},children:S.name},S.id)),e.length>2&&jsxs("span",{className:"text-xs",style:{color:n.textTertiary},children:["+",e.length-2]})]}):jsx("span",{children:"Agregar"}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:n.textTertiary}})]}),typeof document<"u"&&createPortal(jsx(AnimatePresence,{children:i&&jsxs(motion.div,{ref:x,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg min-w-[240px]",style:{position:"fixed",top:v.top,left:v.left,zIndex:99999,backgroundColor:n.bgPrimary,border:`1px solid ${n.border}`,boxShadow:"0 4px 20px rgba(0, 0, 0, 0.25)"},children:[jsx("div",{className:"p-2 border-b",style:{borderColor:n.border},children:jsx("input",{ref:y,type:"text",value:l,onChange:S=>u(S.target.value),placeholder:"Buscar o crear etiqueta...",className:"w-full px-3 py-1.5 text-sm rounded-md outline-none",style:{backgroundColor:n.bgSecondary,color:n.textPrimary,border:`1px solid ${n.borderLight}`},onKeyDown:S=>{S.key==="Enter"&&l.trim()&&!M&&r&&E();}})}),e.length>0&&jsxs("div",{className:"p-2 border-b",style:{borderColor:n.border},children:[jsx("p",{className:"text-xs mb-1.5",style:{color:n.textTertiary},children:"Seleccionadas"}),jsx("div",{className:"flex flex-wrap gap-1",children:e.map(S=>jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium cursor-pointer hover:opacity-80",style:{backgroundColor:`${S.color}20`,color:S.color},onClick:V=>N(S.id,V),children:[S.name,jsx(X,{className:"w-3 h-3"})]},S.id))})]}),jsx("div",{className:"max-h-[200px] overflow-y-auto p-1",children:k.length>0?k.map(S=>{let V=e.some(W=>W.id===S.id);return jsxs("button",{type:"button",onClick:()=>H(S),className:"w-full flex items-center gap-2 px-3 py-2 rounded-md text-sm transition-colors",style:{backgroundColor:V?`${S.color}15`:"transparent",color:n.textPrimary},onMouseEnter:W=>{V||(W.currentTarget.style.backgroundColor=n.hoverBg);},onMouseLeave:W=>{V||(W.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:S.color}}),jsx("span",{className:"flex-1 text-left",children:S.name}),V&&jsx(Check,{className:"w-4 h-4",style:{color:S.color}})]},S.id)}):l.trim()?jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No se encontraron etiquetas"}):jsx("div",{className:"p-2 text-center text-sm",style:{color:n.textTertiary},children:"No hay etiquetas disponibles"})}),l.trim()&&!M&&r&&jsxs("div",{className:"p-2 border-t",style:{borderColor:n.border},children:[jsx("div",{className:"flex items-center gap-2 mb-2",children:jsx("p",{className:"text-xs",style:{color:n.textTertiary},children:"Crear nueva etiqueta"})}),jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Ll.map(S=>jsx("button",{type:"button",onClick:()=>f(S),className:"w-5 h-5 rounded-full transition-transform hover:scale-110",style:{backgroundColor:S,outline:m===S?`2px solid ${S}`:"none",outlineOffset:"2px"}},S))}),jsxs("button",{type:"button",onClick:E,disabled:p,className:"w-full flex items-center justify-center gap-2 px-3 py-2 rounded-md text-sm font-medium transition-colors",style:{backgroundColor:m,color:"#FFFFFF",opacity:p?.7:1},children:[p?jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}):jsx(Plus,{className:"w-4 h-4"}),'Crear "',l.trim(),'"']})]})]})}),document.body)]})}function Cd({tag:e,onRemove:t,size:a="sm"}){return jsxs("span",{className:`inline-flex items-center gap-1 rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:`${e.color}20`,color:e.color},children:[e.name,t&&jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),t();},className:"hover:opacity-70",children:jsx(X,{className:"w-3 h-3"})})]})}function ng({tags:e,maxVisible:t=3,size:a="sm"}){if(!e||e.length===0)return null;let r=e.slice(0,t),n=e.length-t;return jsxs("div",{className:"flex flex-wrap gap-1",children:[r.map(s=>jsx(Cd,{tag:s,size:a},s.id)),n>0&&jsxs("span",{className:`inline-flex items-center rounded-full font-medium ${a==="xs"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-xs"}`,style:{backgroundColor:"rgba(100,100,100,0.2)",color:"#9CA3AF"},children:["+",n]})]})}var cs=[{name:"Azul",value:"#00E5CC",light:"#5AADFF"},{name:"P\xFArpura",value:"#A855F7",light:"#C084FC"},{name:"Rosa",value:"#EC4899",light:"#F472B6"},{name:"Rojo",value:"#EF4444",light:"#F87171"},{name:"Naranja",value:"#F59E0B",light:"#FBBF24"},{name:"Amarillo",value:"#EAB308",light:"#FACC15"},{name:"Lima",value:"#84CC16",light:"#A3E635"},{name:"Verde",value:"#10B981",light:"#34D399"},{name:"Esmeralda",value:"#059669",light:"#10B981"},{name:"Cyan",value:"#06B6D4",light:"#22D3EE"},{name:"Azul Cielo",value:"#0EA5E9",light:"#38BDF8"},{name:"\xCDndigo",value:"#4F46E5",light:"#6366F1"},{name:"Violeta",value:"#8B5CF6",light:"#A78BFA"},{name:"Fucsia",value:"#D946EF",light:"#E879F9"},{name:"Coral",value:"#F97316",light:"#FB923C"},{name:"Magenta",value:"#E11D48",light:"#FB7185"}];function og(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h${a}m`}function hx(e){switch(e){case "on-track":return {text:"text-green-600 dark:text-green-400",bg:"bg-green-50 dark:bg-green-900/20",border:"border-green-200 dark:border-green-800"};case "at-risk":return {text:"text-yellow-600 dark:text-yellow-400",bg:"bg-yellow-50 dark:bg-yellow-900/20",border:"border-yellow-200 dark:border-yellow-800"};case "over-budget":return {text:"text-red-600 dark:text-red-400",bg:"bg-red-50 dark:bg-red-900/20",border:"border-red-200 dark:border-red-800"};case "no-estimate":default:return {text:"text-gray-500 dark:text-gray-400",bg:"bg-gray-50 dark:bg-gray-800/50",border:"border-gray-200 dark:border-gray-700"}}}function yx({className:e}){return jsxs("svg",{className:g("w-3 h-3",e),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Td({summary:e,size:t="sm",showEstimate:a=true,onClick:r,className:n}){let s=hx(e.health),o={sm:"text-xs px-1.5 py-0.5 gap-1",md:"text-sm px-2 py-1 gap-1.5",lg:"text-base px-2.5 py-1.5 gap-2"},i={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},c=og(e.loggedMinutes),l=e.estimateMinutes?og(e.estimateMinutes):null,u=a&&l?`${c} / ${l}`:c;return e.loggedMinutes===0&&!e.estimateMinutes?null:jsxs(r?"button":"span",{className:g("inline-flex items-center rounded-full border font-medium","transition-colors duration-150",s.text,s.bg,s.border,o[t],r&&"cursor-pointer hover:opacity-80 focus:outline-none focus:ring-2 focus:ring-offset-1",n),onClick:r,type:r?"button":void 0,children:[jsx(yx,{className:i[t]}),jsx("span",{children:u})]})}function xx(e){let t=e.trim();if(!t)return null;let a;if(t.startsWith("="))a=t.slice(1).trim();else if(t.startsWith("+")&&/[*\/()]/.test(t))a=t.slice(1).trim();else if(/^\d[\d\s]*[*\/]/.test(t)||/^\(/.test(t))a=t;else return null;if(!a||!/^[\d+\-*/().\s]+$/.test(a)||/[+\-*/]{2,}/.test(a.replace(/\s/g,"").replace(/\*-/g,"X").replace(/\/-/g,"X")))return null;try{let r=new Function(`"use strict"; return (${a});`)();return typeof r!="number"||!isFinite(r)||r<0?null:r}catch{return null}}function Il(e){let t=xx(e);return t!==null?String(t):e}function ig(e){let a=Il(e).trim().toLowerCase();if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?0:Math.round(s*60)}function Rl(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function kx(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function Cx({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{d:"M8 5v14l11-7z"})})}function Tx({className:e}){return jsx("svg",{className:e,fill:"currentColor",viewBox:"0 0 24 24",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})})}function lg({className:e}){return jsx("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:jsx("path",{d:"M6 18L18 6M6 6l12 12"})})}function Dx({className:e}){return jsxs("svg",{className:e,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("path",{d:"M12 6v6l4 2"})]})}function Dd({taskId:e,summary:t,entries:a=[],isTimerRunning:r=false,timerElapsedSeconds:n=0,onLogTime:s,onUpdateEstimate:o,onStartTimer:i,onStopTimer:c,onDiscardTimer:l,onClose:u,className:p}){let[d,m]=useState(""),[f,v]=useState(t.estimateMinutes?Rl(t.estimateMinutes):""),[b,w]=useState(""),[h,x]=useState(false),[y,k]=useState(false),M=useRef(null);useEffect(()=>{M.current?.focus();},[]);let H=async()=>{let D=ig(d);if(!(D<=0||!s)){x(true);try{await s({durationMinutes:D,note:b.trim()||void 0,source:"manual"}),m(""),w("");}finally{x(false);}}},E=async()=>{if(!o)return;let D=f.trim()?ig(f):null;await o(D),k(false);},N=D=>{D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),H()),D.key==="Escape"&&u?.();};return jsxs("div",{className:g("w-72 bg-white dark:bg-gray-800 rounded-lg shadow-xl border border-gray-200 dark:border-gray-700","divide-y divide-gray-100 dark:divide-gray-700",p),children:[jsxs("div",{className:"px-3 py-2 flex items-center justify-between",children:[jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-200",children:"Time Tracking"}),jsx("button",{onClick:u,className:"p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-gray-400",children:jsx(lg,{className:"w-4 h-4"})})]}),jsx("div",{className:"px-3 py-2",children:r?jsxs("div",{className:"flex items-center gap-2",children:[jsxs("div",{className:"flex-1 flex items-center gap-2",children:[jsxs("span",{className:"relative flex h-2 w-2",children:[jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-green-400 opacity-75"}),jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-green-500"})]}),jsx("span",{className:"text-lg font-mono font-medium text-gray-900 dark:text-white",children:kx(n)})]}),jsx("button",{onClick:c,className:"p-2 rounded-lg bg-green-500 hover:bg-green-600 text-white",title:"Stop and save",children:jsx(Tx,{className:"w-4 h-4"})}),jsx("button",{onClick:l,className:"p-2 rounded-lg bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-600 dark:text-gray-300",title:"Discard",children:jsx(lg,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:i,className:g("w-full flex items-center justify-center gap-2 px-3 py-2 rounded-lg","bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600","text-gray-700 dark:text-gray-200 font-medium text-sm"),children:[jsx(Cx,{className:"w-4 h-4"}),"Start Timer"]})}),jsxs("div",{className:"px-3 py-2 space-y-2",children:[jsxs("div",{className:"flex gap-2",children:[jsxs("div",{className:"relative flex-1",children:[jsx(Dx,{className:"absolute left-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),jsx("input",{ref:M,type:"text",value:d,onChange:D=>m(D.target.value),onKeyDown:N,placeholder:"8 (=8h), 2h 30m",className:g("w-full pl-8 pr-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsx("button",{onClick:H,disabled:h||!d.trim(),className:g("px-3 py-1.5 rounded-lg text-sm font-medium","bg-[#00E5CC] hover:bg-[#00C4AE] text-white","disabled:opacity-50 disabled:cursor-not-allowed"),children:"Log"})]}),jsx("input",{type:"text",value:b,onChange:D=>w(D.target.value),onKeyDown:N,placeholder:"Note (optional)",className:g("w-full px-3 py-1.5 text-sm rounded-lg","bg-gray-50 dark:bg-gray-700 border border-gray-200 dark:border-gray-600","text-gray-900 dark:text-white placeholder-gray-400","focus:outline-none focus:ring-2 focus:ring-[#00E5CC] focus:border-transparent")})]}),jsxs("div",{className:"px-3 py-2",children:[jsxs("div",{className:"flex justify-between text-sm",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Logged"}),jsx("span",{className:"font-medium text-gray-900 dark:text-white",children:Rl(t.loggedMinutes)})]}),jsxs("div",{className:"flex justify-between text-sm mt-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Estimate"}),y?jsx("div",{className:"flex items-center gap-1",children:jsx("input",{type:"text",value:f,onChange:D=>v(D.target.value),onKeyDown:D=>{D.key==="Enter"&&E(),D.key==="Escape"&&k(false);},onBlur:E,autoFocus:true,className:"w-16 px-1 py-0.5 text-sm text-right rounded border border-[#00E5CC] bg-transparent focus:outline-none",placeholder:"4h"})}):jsx("button",{onClick:()=>k(true),className:"font-medium text-gray-900 dark:text-white hover:text-[#00E5CC]",children:t.estimateMinutes?Rl(t.estimateMinutes):"Set estimate"})]}),t.progressPercent!==null&&jsxs("div",{className:"mt-2",children:[jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"text-gray-500 dark:text-gray-400",children:"Progress"}),jsxs("span",{className:g("font-medium",t.health==="on-track"&&"text-green-600",t.health==="at-risk"&&"text-yellow-600",t.health==="over-budget"&&"text-red-600"),children:[t.progressPercent,"%"]})]}),jsx("div",{className:"h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:jsx("div",{className:g("h-full transition-all duration-300",t.health==="on-track"&&"bg-green-500",t.health==="at-risk"&&"bg-yellow-500",t.health==="over-budget"&&"bg-red-500"),style:{width:`${Math.min(100,t.progressPercent)}%`}})})]})]}),a.length>0&&jsxs("div",{className:"px-3 py-2",children:[jsx("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400 mb-2",children:"Recent Entries"}),jsx("div",{className:"space-y-1 max-h-24 overflow-y-auto",children:a.slice(0,3).map(D=>jsxs("div",{className:"flex items-center justify-between text-xs text-gray-600 dark:text-gray-300",children:[jsx("span",{className:"truncate flex-1",children:D.note||"Time logged"}),jsx("span",{className:"font-medium ml-2",children:Rl(D.durationMinutes)})]},D.id))})]})]})}function Px(e){let a=Il(e).trim().toLowerCase();if(!a||a==="-")return null;if(a.includes(":")){let[o,i]=a.split(":").map(Number);return (o||0)*60+(i||0)}let r=a.match(/(\d+(?:\.\d+)?)\s*h/),n=a.match(/(\d+)\s*m/);if(r||n){let o=r?.[1]?parseFloat(r[1]):0,i=n?.[1]?parseInt(n[1],10):0;return Math.round(o*60)+i}let s=parseFloat(a);return isNaN(s)?null:Math.round(s*60)}function Fx(e){if(!e||e===0)return "";let t=Math.floor(e/60),a=e%60;return t===0?`${a}m`:a===0?`${t}h`:`${t}h ${a}m`}function eo({mode:e,locale:t,isDark:a,currentValue:r,onSave:n,onClose:s,className:o}){let[i,c]=useState(Fx(r)),[l,u]=useState(""),[p,d]=useState(false),m=useRef(null);useEffect(()=>{m.current?.focus();},[]);let f=async()=>{d(true);let x=Px(i);await n(x&&x>0?x:null,l||void 0),d(false);},v=async()=>{d(true),await n(null),d(false);},b=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),f()),x.key==="Escape"&&s();},w={estimate:t==="es"?"Estimaci\xF3n":"Estimate",quoted:t==="es"?"T. Ofertado":"Quoted",log:t==="es"?"Registrar":"Log Time"},h=t==="es";return jsxs("div",{className:g("w-56",o),style:{background:a?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:a?"1px solid rgba(255,255,255,0.10)":"1px solid #E5E7EB",borderRadius:"8px",boxShadow:a?"0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05)":"0 8px 32px rgba(0,0,0,0.12)",backdropFilter:"blur(16px)"},onClick:x=>x.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2",style:{borderBottom:a?"1px solid rgba(255,255,255,0.06)":"1px solid #F3F4F6"},children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Clock,{className:"w-3 h-3",style:{color:a?"#007FFF":"#00E5CC"}}),jsx("span",{className:"font-mono uppercase tracking-wider",style:{fontSize:"10px",fontWeight:600,color:a?"rgba(255,255,255,0.5)":"#6B7280"},children:w[e]})]}),jsx("button",{type:"button",onClick:s,className:"p-0.5 rounded transition-colors",style:{color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:jsx(X,{className:"w-3 h-3"})})]}),jsxs("div",{className:"p-3 space-y-2",children:[jsx("input",{ref:m,type:"text",value:i,onChange:x=>c(x.target.value),onKeyDown:b,placeholder:"2h 30m",className:"w-full font-mono outline-none",style:{fontSize:"13px",fontWeight:700,padding:"6px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"#FFFFFF":"#111827"}}),jsx("p",{className:"font-mono",style:{fontSize:"9px",color:a?"rgba(255,255,255,0.25)":"#9CA3AF",letterSpacing:"0.02em"},children:"8=8h \xB7 1h 30m \xB7 45m \xB7 =8*9"}),e==="log"&&jsx("input",{type:"text",value:l,onChange:x=>u(x.target.value),onKeyDown:b,placeholder:h?"Nota (opcional)":"Note (optional)",className:"w-full outline-none",style:{fontSize:"11px",padding:"5px 10px",borderRadius:"4px",border:a?"1px solid #333":"1px solid #E5E7EB",background:a?"#1A1A1A":"#F9FAFB",color:a?"rgba(255,255,255,0.7)":"#374151"}}),jsx("button",{type:"button",onClick:f,disabled:p||!i.trim(),className:"w-full font-mono uppercase tracking-wider transition-all disabled:opacity-30 disabled:cursor-not-allowed",style:{fontSize:"10px",fontWeight:600,padding:"6px 0",borderRadius:"4px",border:a?"1px solid rgba(0, 229, 204,0.3)":"1px solid #00E5CC",background:a?"rgba(0, 229, 204,0.15)":"#00E5CC",color:a?"#007FFF":"#FFFFFF"},children:p?h?"Guardando...":"Saving...":h?"Registrar":"Save"}),r&&e!=="log"&&jsx("button",{type:"button",onClick:v,disabled:p,className:"w-full font-mono uppercase tracking-wider transition-colors",style:{fontSize:"9px",padding:"4px 0",color:a?"rgba(255,255,255,0.3)":"#9CA3AF"},children:h?"Quitar":"Clear"})]})]})}function Lx(e){switch(e){case "on-track":return "bg-green-500";case "at-risk":return "bg-yellow-500";case "over-budget":return "bg-red-500";case "no-estimate":default:return "bg-gray-400"}}function Ax(e){switch(e){case "on-track":return "text-green-600 dark:text-green-400";case "at-risk":return "text-yellow-600 dark:text-yellow-400";case "over-budget":return "text-red-600 dark:text-red-400";case "no-estimate":default:return "text-gray-500 dark:text-gray-400"}}function Sd({summary:e,showLabel:t=false,size:a="md",className:r}){let n=Lx(e.health),s=Ax(e.health),o={sm:"h-1",md:"h-1.5",lg:"h-2"},i=e.progressPercent??0,c=Math.min(100,i),l=i>100;return e.health==="no-estimate"?jsxs("div",{className:g("flex items-center gap-2",r),children:[jsx("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden",o[a]),children:jsx("div",{className:g("h-full w-1/4",n)})}),t&&jsx("span",{className:g("text-xs font-medium",s),children:"--"})]}):jsxs("div",{className:g("flex items-center gap-2",r),children:[jsxs("div",{className:g("flex-1 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden relative",o[a]),children:[jsx("div",{className:g("h-full transition-all duration-300",n),style:{width:`${c}%`}}),l&&jsx("div",{className:"absolute inset-0 bg-red-500",style:{backgroundImage:"repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.2) 2px, rgba(255,255,255,0.2) 4px)"}})]}),t&&jsxs("span",{className:g("text-xs font-medium tabular-nums min-w-[2.5rem] text-right",s),children:[i,"%"]})]})}function Os(e){if(e<1)return `${Math.round(e*60)}s`;let t=Math.round(e);if(t<60)return `${t}m`;let a=Math.floor(t/60),r=t%60;return r===0?`${a}h`:`${a}h ${r}m`}function Rx(e,t){switch(e){case "profitable":return t?"text-green-400":"text-green-600";case "at-cost":return t?"text-[#00E5CC]":"text-[#00C4AE]";case "loss":return t?"text-red-400":"text-red-600";case "no-estimate":return t?"text-gray-500":"text-gray-400"}}function Bx(e,t){switch(e){case "profitable":return t?"bg-green-900/30 border-green-700/50":"bg-green-50 border-green-200";case "at-cost":return t?"bg-[#00A893]/30 border-[#00C4AE]/50":"bg-[#00E5CC]/15 border-[#00E5CC]/15";case "loss":return t?"bg-red-900/30 border-red-700/50":"bg-red-50 border-red-200";case "no-estimate":return t?"bg-gray-800/50 border-gray-700":"bg-gray-50 border-gray-200"}}function $x(e,t){if(t==="es")switch(e){case "profitable":return "Rentable";case "at-cost":return "En costo";case "loss":return "P\xE9rdida";case "no-estimate":return "Sin oferta"}switch(e){case "profitable":return "Profitable";case "at-cost":return "At Cost";case "loss":return "Loss";case "no-estimate":return "No Estimate"}}function Ox({summary:e,locale:t,isDark:a}){let r=e.totalVarianceMinutes>0,n=r?a?"text-green-400":"text-green-600":e.totalVarianceMinutes<0?a?"text-red-400":"text-red-600":a?"text-gray-400":"text-gray-600",s=a?"bg-[#1A1D25]":"bg-white",o=a?"border-white/5":"border-gray-200",i=a?"text-[#9CA3AF]":"text-gray-500",c=a?"text-[#E5E7EB]":"text-gray-900";return jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-1",i),children:t==="es"?"Variaci\xF3n Total":"Total Variance"}),jsxs("div",{className:g("text-2xl font-bold",n),children:[r?"+":"",Os(Math.abs(e.totalVarianceMinutes))]}),jsxs("div",{className:g("text-xs mt-1",i),children:[e.avgVariancePercent>0?"+":"",e.avgVariancePercent,"%"]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",i),children:t==="es"?"Distribuci\xF3n":"Distribution"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-green-400":"text-green-600",children:t==="es"?"Rentables":"Profitable"}),jsx("span",{className:g("font-medium",c),children:e.profitableTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-[#00E5CC]":"text-[#00C4AE]",children:t==="es"?"En costo":"At Cost"}),jsx("span",{className:g("font-medium",c),children:e.atCostTasksCount})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:a?"text-red-400":"text-red-600",children:t==="es"?"P\xE9rdidas":"Loss"}),jsx("span",{className:g("font-medium",c),children:e.lossTasksCount})]})]})]}),jsxs("div",{className:g("p-4 rounded-lg border",s,o),children:[jsx("div",{className:g("text-sm font-medium mb-2",i),children:t==="es"?"Tiempos":"Time Summary"}),jsxs("div",{className:"space-y-1 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Ofertado":"Sold"}),jsx("span",{className:g("font-medium",c),children:Os(e.totalSoldMinutes)})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{className:i,children:t==="es"?"Trabajado":"Logged"}),jsx("span",{className:g("font-medium",c),children:Os(e.totalLoggedMinutes)})]}),jsxs("div",{className:g("flex justify-between pt-1 border-t",o),children:[jsx("span",{className:i,children:t==="es"?"Tareas":"Tasks"}),jsx("span",{className:g("font-medium",c),children:e.totalTasksWithEstimate})]})]})]})]})}function Hx({task:e,locale:t,isDark:a,onClick:r}){let n=e.varianceMinutes!==null?e.varianceMinutes>0?"+":e.varianceMinutes<0?"-":"":"",s=a?"border-white/5":"border-gray-200",o=a?"text-[#E5E7EB]":"text-gray-900",i=a?"text-[#9CA3AF]":"text-gray-500";return jsxs("tr",{className:g("border-b",s,r&&g("cursor-pointer",a?"hover:bg-white/5":"hover:bg-gray-50")),onClick:()=>r?.(e.taskId),children:[jsxs("td",{className:"px-4 py-3",children:[jsx("div",{className:g("font-medium",o),children:e.taskName}),e.projectName&&jsx("div",{className:g("text-xs mt-1",i),children:e.projectName})]}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.soldEffortMinutes?Os(e.soldEffortMinutes):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:Os(e.loggedMinutes)}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.varianceMinutes!==null?jsxs("span",{className:g("font-medium",e.varianceMinutes>0?a?"text-green-400":"text-green-600":e.varianceMinutes<0?a?"text-red-400":"text-red-600":i),children:[n,Os(Math.abs(e.varianceMinutes))]}):"-"}),jsx("td",{className:"px-4 py-3 text-sm text-center",children:e.variancePercent!==null?jsxs("span",{className:g("font-medium",e.variancePercent>0?a?"text-green-400":"text-green-600":e.variancePercent<0?a?"text-red-400":"text-red-600":i),children:[n,Math.abs(e.variancePercent),"%"]}):"-"}),jsx("td",{className:"px-4 py-3 text-center",children:jsx("span",{className:g("inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border",Bx(e.status,a),Rx(e.status,a)),children:$x(e.status,t)})})]})}function Ed({report:e,isLoading:t=false,locale:a="en",theme:r="light",className:n,onTaskClick:s}){let o=r==="dark",i=o?"bg-[#050505]":"bg-gray-50",c=o?"bg-[#0A0A0A]":"bg-white",l=o?"border-white/[0.08]":"border-gray-200",u=o?"text-white/[0.92]":"text-gray-900",p=o?"text-white/[0.60]":"text-gray-500",d=o?"bg-[#050505]/50":"bg-gray-50",m=useMemo(()=>e?[...e.tasks].sort((f,v)=>f.varianceMinutes===null?1:v.varianceMinutes===null?-1:v.varianceMinutes-f.varianceMinutes):[],[e]);return t?jsx("div",{className:g("p-8 text-center",p,n),children:a==="es"?"Cargando reporte...":"Loading report..."}):!e||e.tasks.length===0?jsx("div",{className:g("p-8 text-center",p,n),children:a==="es"?"No hay datos de rentabilidad disponibles":"No profitability data available"}):jsxs("div",{className:g("space-y-6 p-6",i,n),children:[jsx("div",{className:"flex items-center justify-between",children:jsxs("div",{children:[jsx("h2",{className:g("text-2xl font-bold",u),children:a==="es"?"Reporte de Rentabilidad":"Profitability Report"}),jsx("p",{className:g("text-sm mt-1",p),children:a==="es"?"An\xE1lisis de tiempo ofertado vs tiempo trabajado":"Analysis of sold effort vs actual time logged"})]})}),jsx(Ox,{summary:e.summary,locale:a,isDark:o}),jsx("div",{className:g("rounded-lg border overflow-hidden",c,l),children:jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-white/5",children:[jsx("thead",{className:d,children:jsxs("tr",{children:[jsx("th",{className:g("px-4 py-3 text-left text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Tarea":"Task"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Ofertado":"Sold"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Trabajado":"Logged"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Variaci\xF3n":"Variance"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:"%"}),jsx("th",{className:g("px-4 py-3 text-center text-xs font-medium uppercase tracking-wider",p),children:a==="es"?"Estado":"Status"})]})}),jsx("tbody",{className:g("divide-y",l),children:m.map(f=>jsx(Hx,{task:f,locale:a,isDark:o,onClick:s},f.taskId))})]})})}),jsx("div",{className:g("text-xs text-center",p),children:a==="es"?jsx(Fragment,{children:"Rentable: variaci\xF3n > +5% | En costo: \xB15% | P\xE9rdida: variaci\xF3n < -5%"}):jsx(Fragment,{children:"Profitable: variance > +5% | At cost: \xB15% | Loss: variance < -5%"})})]})}function Hs(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Zx(e){let t=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return t>0?`${t.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`}function yg(e,t=[]){if("title"in e&&!("name"in e)){let a=e,r=(a.assignedUserIds||[]).map(n=>{let s=t.find(o=>o.id===n);return s||null}).filter(n=>n!==null);return {id:a.id,name:a.title,startDate:a.startDate?new Date(a.startDate):void 0,endDate:a.endDate?new Date(a.endDate):void 0,progress:a.progress||0,status:a.columnId,priority:a.priority?.toLowerCase(),assignees:r,dependencies:Array.isArray(a.dependencies)?a.dependencies.map(n=>typeof n=="string"?n:n.taskId):[],tags:a.tags,subtasks:a.subtasks?.map(n=>({id:n.id,name:n.title,progress:n.completed?100:0,startDate:new Date,endDate:new Date})),color:a.color,description:a.description,effortMinutes:a.effortMinutes,timeLoggedMinutes:a.timeLoggedMinutes,soldEffortMinutes:a.soldEffortMinutes}}return e}function ev(e,t){return {...t,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,priority:e.priority?.toUpperCase(),tags:e.tags,description:e.description,color:e.color,columnId:e.status,assignedUserIds:t.assignedUserIds,dependencies:e.dependencies}}function ds({task:e,isOpen:t,onClose:a,onTaskUpdate:r,onCardUpdate:n,theme:s="dark",locale:o="es",availableUsers:i=[],availableTags:c=[],onCreateTag:l,attachments:u=[],onUploadAttachments:p,onDeleteAttachment:d,availableTasks:m=[],comments:f=[],onAddComment:v,currentUser:b,mentionableUsers:w=[],onUploadCommentAttachments:h,enableTimeTracking:x=false,timeTrackingSummary:y,timeEntries:k=[],isTimerRunning:M=false,timerElapsedSeconds:H=0,onTimeLog:E,onEstimateUpdate:N,onSoldEffortUpdate:D,onTimerStart:S,onTimerStop:V,onTimerDiscard:W,blurFinancials:R=false}){let A=s==="dark",ve={textTertiary:A?"#6B7280":"#9CA3AF",textSecondary:A?"#9CA3AF":"#6B7280",textPrimary:A?"#FFFFFF":"#111827",borderLight:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",border:A?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.1)",bgPrimary:A?"#1A1D25":"#FFFFFF",bgSecondary:A?"#0A0A0A":"#F9FAFB",hoverBg:A?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.05)"},q=e&&"title"in e&&!("name"in e),le=e,[B,pe]=useState(e?yg(e,i):null),[nt,Ue]=useState(false),[$,fe]=useState(false),[ie,et]=useState(false),[Xe,Qe]=useState(null),[ct,Tt]=useState(new Date),[_t,tt]=useState(false),[xt,Jt]=useState(false),[Wt,Qt]=useState(""),[Y,Le]=useState(false),[Ye,he]=useState(false),[dt,wt]=useState(false),[ue,ce]=useState(false),[Ae,Et]=useState(""),Pe=useRef(null),ut=useRef(null),[O,re]=useState(""),we=useRef(null),[ot,mt]=useState(""),[Ht,Zt]=useState(false),[Oe,Wa]=useState([]),[la,da]=useState(""),[ke,Te]=useState(false),gt=useRef(null);useEffect(()=>{if(console.log("\u{1F4E5} TaskDetailModal useEffect - task received:",{isOpen:t,taskId:e?.id,taskName:e?.name,soldEffortMinutes:e?.soldEffortMinutes,quotedMinutes:e?.quotedMinutes,effortMinutes:e?.effortMinutes,timeLoggedMinutes:e?.timeLoggedMinutes,fullTask:e}),e&&t){let F=yg(e,i);console.log("\u{1F4E5} After normalizeToTask:",{taskId:F?.id,taskName:F?.name,soldEffortMinutes:F?.soldEffortMinutes,quotedMinutes:F?.quotedMinutes,effortMinutes:F?.effortMinutes,timeLoggedMinutes:F?.timeLoggedMinutes}),pe(F),Et(F.description||""),re(F.name||"");}},[e?.id,e?.quotedMinutes,i,t]),useEffect(()=>{if(!t||!Ae)return;let F=setTimeout(()=>{let P=ut.current;P&&(P.style.height="auto",P.style.height=`${Math.max(100,P.scrollHeight)}px`);},50);return ()=>clearTimeout(F)},[t,Ae]),useEffect(()=>()=>{Pe.current&&clearTimeout(Pe.current),we.current&&clearTimeout(we.current);},[]),useEffect(()=>{t&>.current&&f.length>0&&setTimeout(()=>{gt.current&&(gt.current.scrollTop=gt.current.scrollHeight);},100);},[t,f.length]);let Ie=useCallback(F=>{pe(F),q&&n&&le?n(ev(F,le)):r&&r(F);},[q,le,n,r]),Lt=useCallback(()=>{Ue(false),fe(false),et(false),Qe(null),Jt(false),Qt(""),Le(false);},[]),I=useCallback((F,P)=>{if(!B)return;let z={...B,[F]:P};Ie(z);},[B,Ie]),te=useCallback(()=>{let F=ut.current;F&&(F.style.height="auto",F.style.height=`${Math.max(100,F.scrollHeight)}px`);},[]),Re=useCallback(F=>{Et(F),setTimeout(te,0),Pe.current&&clearTimeout(Pe.current),Pe.current=setTimeout(()=>{if(B){let P={...B,description:F};Ie(P);}},800);},[B,Ie,te]),Ee=useCallback(F=>{re(F),we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{if(B&&F.trim()){let P={...B,name:F.trim()};Ie(P);}},800);},[B,Ie]),_e=useCallback(F=>{let P=F.map(z=>{let j={id:`pending-${Date.now()}-${Math.random().toString(36).slice(2)}`,file:z};return z.type.startsWith("image/")&&(j.preview=URL.createObjectURL(z)),j});Wa(z=>[...z,...P]);},[]),it=useCallback(F=>{Wa(P=>{let z=P.find(j=>j.id===F);return z?.preview&&URL.revokeObjectURL(z.preview),P.filter(j=>j.id!==F)});},[]),qe=useCallback(async()=>{if(!(!B||!ot.trim()&&Oe.length===0||!v)){Zt(true);try{let F=eg(ot,w),P=[];if(Oe.length>0&&h){let z=Oe.map(j=>j.file);P=await h(z);}await v(B.id,ot.trim(),F.length>0?F:void 0,P.length>0?P:void 0),mt(""),Oe.forEach(z=>{z.preview&&URL.revokeObjectURL(z.preview);}),Wa([]);}finally{Zt(false);}}},[B,ot,Oe,v,w,h]),Ze=useCallback(()=>{if(!B||!la.trim())return;let F=B.subtasks||[],P={id:`subtask-${Date.now()}-${Math.random().toString(36).slice(2)}`,name:la.trim(),progress:0,startDate:new Date,endDate:new Date,position:F.length},z=[...F,P],j={...B,subtasks:z};Ie(j),da(""),Te(false);},[B,la,Ie]),Ct=useCallback(F=>{if(!B?.subtasks)return;let P=B.subtasks.map(j=>j.id===F?{...j,progress:j.progress===100?0:100}:j),z={...B,subtasks:P};Ie(z);},[B,Ie]),At=useCallback(F=>{if(!B?.subtasks)return;let P=B.subtasks.filter(j=>j.id!==F),z={...B,subtasks:P};Ie(z);},[B,Ie]),It=useCallback(F=>{let P=typeof F=="string"?new Date(F):F,j=new Date().getTime()-P.getTime(),J=Math.floor(j/6e4),be=Math.floor(j/36e5),Be=Math.floor(j/864e5);return J<1?o==="es"?"Ahora":"Just now":J<60?o==="es"?`Hace ${J} min`:`${J}m ago`:be<24?o==="es"?`Hace ${be}h`:`${be}h ago`:Be<7?o==="es"?`Hace ${Be}d`:`${Be}d ago`:P.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})},[o]),Ke=useCallback(F=>{if(!B)return;let P=B.progress||0;F==="completed"?P=100:F==="in-progress"&&P===0?P=10:F==="todo"&&(P=0);let z={...B,status:F,progress:P};Ie(z),Ue(false);},[B,Ie]),Fe=useCallback((F,P)=>{if(!B)return;let z={...B,startDate:F,endDate:P};Ie(z);},[B,Ie]),ft=useCallback(()=>{let F=ct.getFullYear(),P=ct.getMonth(),z=new Date(F,P,1),J=new Date(F,P+1,0).getDate(),be=z.getDay(),Be=[],De=new Date(F,P,0).getDate();for(let lt=be-1;lt>=0;lt--)Be.push({date:new Date(F,P-1,De-lt),isCurrentMonth:false});for(let lt=1;lt<=J;lt++)Be.push({date:new Date(F,P,lt),isCurrentMonth:true});let Ne=42-Be.length;for(let lt=1;lt<=Ne;lt++)Be.push({date:new Date(F,P+1,lt),isCurrentMonth:false});return Be},[ct]),_a=useCallback(async F=>{if(F.preventDefault(),F.stopPropagation(),wt(false),!B||!p)return;let P=Array.from(F.dataTransfer.files);if(P.length!==0){ce(true);try{await p(B.id,P);}finally{ce(false);}}},[B,p]),ma=useCallback(async F=>{if(!B||!p||!F.target.files)return;let P=Array.from(F.target.files);if(P.length!==0){ce(true);try{await p(B.id,P);}finally{ce(false);}F.target.value="";}},[B,p]),ta=useCallback(F=>{F.preventDefault(),F.stopPropagation(),wt(true);},[]),de=useCallback(F=>{F.preventDefault(),F.stopPropagation(),wt(false);},[]),G=useCallback(F=>F<1024?`${F} B`:F<1024*1024?`${(F/1024).toFixed(1)} KB`:`${(F/(1024*1024)).toFixed(1)} MB`,[]),X$1=useCallback(F=>F.startsWith("image/")?Image:F.includes("pdf")||F.includes("document")?FileText:File,[]);return !t||!B?null:jsx(AnimatePresence,{children:t&&B&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:a,className:"fixed inset-0 bg-black/50 z-40"}),jsxs(motion.div,{initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.98},role:"dialog","aria-modal":"true","aria-label":o==="es"?"Detalle de la tarea":"Task details",className:g("fixed inset-4 md:inset-8 lg:inset-12 rounded-xl shadow-2xl z-50 flex overflow-hidden",A?"bg-[#1A1D25]":"bg-white"),children:[jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[jsxs("div",{className:g("px-6 py-3 border-b flex items-center gap-3 h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Circle,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsxs("span",{className:g("text-xs px-2 py-0.5 rounded",A?"bg-white/10 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:[o==="es"?"Tarea":"Task"," \u2228"]}),jsx("span",{className:g("text-xs font-mono",A?"text-[#6B7280]":"text-gray-400"),children:B.id.slice(0,8)})]}),jsx("div",{className:"flex-1"})]}),jsx("div",{className:"px-6 py-4",children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("button",{onClick:()=>{let F=B.progress===100?0:100,z={...B,progress:F,status:F===100?"completed":"todo"};Ie(z);},className:g("mt-2 w-5 h-5 rounded-full border-2 flex items-center justify-center transition-colors flex-shrink-0",B.progress===100?"bg-green-500 border-green-500":A?"border-white/30 hover:border-white/50":"border-gray-300 hover:border-gray-400"),children:B.progress===100&&jsx(CheckCircle2,{className:"w-3 h-3 text-white"})}),jsx("input",{type:"text",value:O,onChange:F=>Ee(F.target.value),placeholder:o==="es"?"Nombre de la tarea...":"Task name...",className:g("text-xl font-semibold flex-1 bg-transparent outline-none border-none px-0 py-0","focus:ring-0 focus:outline-none",B.progress===100?"line-through text-[#6B7280]":A?"text-white placeholder:text-[#6B7280]":"text-gray-900 placeholder:text-gray-400")})]})}),jsxs("div",{className:"px-6 pb-6 flex-1 overflow-y-auto overflow-x-visible",children:[jsxs("div",{className:"grid grid-cols-2 gap-x-12 gap-y-5",children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CheckCircle2,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Estado":"Status"}),jsx("button",{onClick:()=>{Lt(),Ue(!nt);},className:g("text-xs px-2 py-1 rounded font-medium cursor-pointer transition-all hover:ring-2 hover:ring-white/20",B.progress===100||B.status==="completed"?"bg-green-500/20 text-green-400":B.progress&&B.progress>0||B.status==="in-progress"?"bg-[#00E5CC]/20 text-[#00E5CC]":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.progress===100||B.status==="completed"?o==="es"?"COMPLETADO":"DONE":B.progress&&B.progress>0||B.status==="in-progress"?o==="es"?"EN PROGRESO":"IN PROGRESS":o==="es"?"POR HACER":"TO DO"}),jsx(AnimatePresence,{children:nt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Ue(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"todo",label:o==="es"?"Por hacer":"To Do",color:"bg-gray-400"},{id:"in-progress",label:o==="es"?"En progreso":"In Progress",color:"bg-[#00E5CC]"},{id:"completed",label:o==="es"?"Completado":"Done",color:"bg-green-500"}].map(F=>jsxs("button",{onClick:()=>Ke(F.id),className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",B.status===F.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",F.color)}),jsx("span",{className:A?"text-white":"text-gray-900",children:F.label})]},F.id))})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(User,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Asignados":"Assignees"}),jsxs("button",{onClick:()=>{Lt(),et(!ie);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[B.assignees&&B.assignees.length>0?jsxs("div",{className:"flex items-center gap-1",children:[B.assignees.slice(0,3).map((F,P)=>jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-xs font-medium",style:{backgroundColor:F.color||"#8B5CF6"},title:F.name,children:F.initials||ba(F.name)},P)),B.assignees.length>3&&jsxs("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:["+",B.assignees.length-3]})]}):jsx("span",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Agregar":"Add"}),jsx(ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:ie&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>et(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[200px] max-h-[280px] overflow-y-auto",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:i.length>0?i.map(F=>{let P=B.assignees?.some(z=>z.name===F.name);return jsxs("button",{onClick:()=>{let z=B.assignees||[],j;P?j=z.filter(J=>J.name!==F.name):j=[...z,F],I("assignees",j);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",P&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-white text-xs font-medium flex-shrink-0",style:{backgroundColor:F.color||"#8B5CF6"},children:F.initials||ba(F.name)}),jsx("span",{className:g("flex-1",A?"text-white":"text-gray-900"),children:F.name}),P&&jsx(Check,{className:"w-4 h-4 text-green-500"})]},F.name)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay usuarios disponibles":"No users available"})})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(CalendarDays,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Fechas":"Dates"}),jsxs("button",{onClick:()=>{Qe(Xe?null:"start"),Tt(B.startDate||new Date);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-900"),children:[B.startDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Inicio":"Start"),jsx("span",{className:g("mx-1",A?"text-[#6B7280]":"text-gray-400"),children:"\u2192"}),B.endDate?.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"short",day:"numeric"})||(o==="es"?"Fin":"End")]}),jsx(AnimatePresence,{children:Xe&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Qe(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:g("absolute left-0 top-full mt-2 z-50 rounded-xl shadow-2xl overflow-hidden flex",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),onClick:F=>F.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",A?"border-white/10":"border-gray-200"),children:[(()=>{let F=new Date,P=new Date(F);P.setDate(F.getDate()+1);let z=new Date(F);z.setDate(F.getDate()+((6-F.getDay()+7)%7||7));let j=new Date(F);j.setDate(F.getDate()+((1-F.getDay()+7)%7||7));let J=new Date(F);J.setDate(F.getDate()+(6-F.getDay()+7)%7+7);let be=new Date(F);be.setDate(F.getDate()+14);let Be=new Date(F);return Be.setDate(F.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:F,display:F.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:P,display:P.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:z,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:j,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:J,display:J.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:be,display:be.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:Be,display:Be.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}].map((Ne,lt)=>jsxs("button",{className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{if(Xe==="start"){let kt=B.endDate&&Ne.date>B.endDate?Ne.date:B.endDate;Fe(Ne.date,kt),Qe("end");}else {let kt=B.startDate&&Ne.date<B.startDate?Ne.date:B.startDate;Fe(kt,Ne.date),Qe(null);}},children:[jsx("span",{children:Ne.label}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:Ne.display})]},lt))})(),jsx("div",{className:g("border-t mt-2 pt-2",A?"border-white/10":"border-gray-200"),children:jsxs("button",{onClick:()=>{Fe(void 0,void 0),Qe(null);},className:g("w-full flex items-center justify-between px-3 py-2 text-sm transition-colors",A?"hover:bg-white/5 text-red-400":"hover:bg-gray-50 text-red-500"),children:[jsx("span",{children:o==="es"?"Quitar fechas":"Clear dates"}),jsx(X,{className:"w-4 h-4 opacity-50"})]})})]}),jsxs("div",{className:"p-4",children:[jsx("div",{className:g("text-xs mb-3 px-2 py-1 rounded",A?"bg-white/5 text-[#9CA3AF]":"bg-gray-100 text-gray-600"),children:Xe==="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",A?"text-white":"text-gray-900"),children:ct.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>Tt(new Date),className:g("p-1 rounded text-sm transition-colors",A?"hover:bg-white/10 text-white":"hover:bg-gray-100 text-gray-700"),children:o==="es"?"Hoy":"Today"}),jsx("button",{onClick:()=>Tt(new Date(ct.getFullYear(),ct.getMonth()-1)),className:g("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),jsx("button",{onClick:()=>Tt(new Date(ct.getFullYear(),ct.getMonth()+1)),className:g("p-1 rounded",A?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:(o==="es"?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(F=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",A?"text-[#6B7280]":"text-gray-400"),children:F},F))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:ft().map((F,P)=>{let z=F.date.toDateString()===new Date().toDateString(),j=B.startDate?.toDateString()===F.date.toDateString(),J=B.endDate?.toDateString()===F.date.toDateString(),be=j||J,Be=B.startDate&&B.endDate&&F.date>=B.startDate&&F.date<=B.endDate;return jsx("button",{onClick:()=>{let De=new Date(F.date);if(Xe==="start"){let Ne=B.endDate&&De>B.endDate?De:B.endDate;Fe(De,Ne),Qe("end");}else {let Ne=B.startDate&&De<B.startDate?De:B.startDate;Fe(Ne,De),Qe(null);}},className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!F.isCurrentMonth&&(A?"text-[#4B5563]":"text-gray-300"),F.isCurrentMonth&&(A?"text-white":"text-gray-900"),z&&"ring-2 ring-[#00E5CC]",j&&"bg-[#00E5CC] text-white",J&&!j&&"bg-[#7C3AED] text-white",Be&&!be&&(A?"bg-[#7C3AED]/20":"bg-purple-100"),!be&&(A?"hover:bg-white/10":"hover:bg-gray-100")),children:F.date.getDate()},P)})})]})]})]})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Flag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Prioridad":"Priority"}),jsx("button",{onClick:()=>{Lt(),fe(!$);},className:g("text-xs px-2 py-1 rounded font-medium transition-all hover:ring-2 hover:ring-white/20",B.priority==="high"||B.priority==="urgent"?"bg-red-500/20 text-red-400":B.priority==="medium"?"bg-yellow-500/20 text-yellow-400":B.priority==="low"?"bg-green-500/20 text-green-400":A?"bg-white/10 text-white":"bg-gray-100 text-gray-700"),children:B.priority?B.priority==="high"||B.priority==="urgent"?o==="es"?"Alta":"High":B.priority==="medium"?o==="es"?"Media":"Medium":o==="es"?"Baja":"Low":o==="es"?"Sin prioridad":"No priority"}),jsx(AnimatePresence,{children:$&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>fe(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[140px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[{id:"urgent",label:o==="es"?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:o==="es"?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:o==="es"?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:o==="es"?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:o==="es"?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(F=>jsxs("button",{onClick:()=>{I("priority",F.id),fe(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",B.priority===F.id&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",F.color)}),jsx("span",{className:A?"text-white":"text-gray-900",children:F.label})]},F.id||"none"))})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n":"Duration"}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:B.startDate&&B.endDate?`${Math.ceil((B.endDate.getTime()-B.startDate.getTime())/(1e3*60*60*24))} ${o==="es"?"d\xEDas":"days"}`:o==="es"?"Sin definir":"Not set"})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:g("w-4 h-4 rounded-full border-2",A?"border-[#6B7280]":"border-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Progreso":"Progress"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[_t?jsx("input",{type:"range",min:"0",max:"100",step:"5",value:B.progress||0,onChange:F=>{let P=parseInt(F.target.value),z=B.status;P===100?z="completed":P>0?z="in-progress":z="todo";let j={...B,progress:P,status:z};Ie(j);},onBlur:()=>tt(false),className:g("flex-1 max-w-[120px] h-2 rounded-full appearance-none cursor-pointer",A?"bg-white/10":"bg-gray-200","[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-4 [&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-[#00E5CC] [&::-webkit-slider-thumb]:cursor-pointer"),autoFocus:true}):jsx("button",{onClick:()=>tt(true),className:g("flex-1 h-2 rounded-full overflow-hidden max-w-[120px] cursor-pointer hover:ring-2 hover:ring-white/20 transition-all",A?"bg-white/10":"bg-gray-200"),children:jsx("div",{className:g("h-full rounded-full transition-all",B.progress===100?"bg-green-500":"bg-[#00E5CC]"),style:{width:`${B.progress||0}%`}})}),jsxs("span",{className:g("text-sm font-medium min-w-[40px]",A?"text-white":"text-gray-900"),children:[B.progress||0,"%"]})]})]}),x&&jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Hourglass,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Duraci\xF3n estimada":"Estimated duration"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:B.status==="completed"||B.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:y?.estimateMinutes?Hs(y.estimateMinutes):o==="es"?"Vac\xEDo":"Empty"}):y?.estimateMinutes?jsx("button",{type:"button",onClick:()=>he("estimate"),className:g("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Hs(y.estimateMinutes)}):jsx("button",{type:"button",onClick:()=>he("estimate"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Ye==="estimate"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(eo,{mode:"estimate",locale:o,isDark:A,currentValue:y?.estimateMinutes||null,onSave:async F=>{await N?.(B.id,F),he(false);},onClose:()=>he(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Tiempo ofertado":"Quoted time"}),jsx("div",{className:"flex items-center gap-2 flex-1",children:R?jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",A?"text-[#94A3B8]":"text-gray-500"),title:o==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data","aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"}):B.status==="completed"||B.progress===100?jsx("span",{className:g("text-sm px-2 py-0.5 cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:B.quotedMinutes?Hs(B.quotedMinutes):o==="es"?"Vac\xEDo":"Empty"}):B.quotedMinutes?jsx("button",{type:"button",onClick:()=>he("quoted"),className:g("text-sm px-2 py-0.5 rounded",A?"text-white hover:bg-white/10":"text-gray-900 hover:bg-gray-100"),children:Hs(B.quotedMinutes)}):jsx("button",{type:"button",onClick:()=>he("quoted"),className:g("text-sm",A?"text-[#6B7280] hover:text-[#9CA3AF]":"text-gray-400 hover:text-gray-500"),children:o==="es"?"Vac\xEDo":"Empty"})}),jsx(AnimatePresence,{children:Ye==="quoted"&&!R&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(eo,{mode:"quoted",locale:o,isDark:A,currentValue:B.quotedMinutes||null,onSave:async F=>{D?(await D(B.id,F),pe(P=>P?{...P,quotedMinutes:F}:null)):I("quotedMinutes",F),he(false);},onClose:()=>he(false)})})})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Clock,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Registrar tiempo":"Track time"}),jsxs("div",{className:"flex items-center gap-2 flex-1",children:[B.status==="completed"||B.progress===100?jsx("div",{className:g("flex items-center gap-1.5 p-1.5 rounded-full cursor-not-allowed",A?"bg-white/5 text-gray-600":"bg-gray-50 text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}):M?jsxs("button",{type:"button",onClick:()=>V?.(B.id),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors","bg-red-500/10 text-red-500 hover:bg-red-500/20"),children:[jsx(Square,{className:"w-3.5 h-3.5 fill-current"}),Zx(H||0)]}):jsx("button",{type:"button",onClick:()=>S?.(B.id),className:g("flex items-center gap-1.5 p-1.5 rounded-full transition-colors",A?"bg-white/10 text-white hover:bg-white/20":"bg-gray-100 text-gray-700 hover:bg-gray-200"),title:o==="es"?"Iniciar temporizador":"Start timer",children:jsx(Play,{className:"w-3.5 h-3.5 fill-current"})}),B.status==="completed"||B.progress===100?jsxs("div",{className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm cursor-not-allowed",A?"text-gray-600":"text-gray-300"),title:o==="es"?"Tarea completada":"Task completed",children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}):jsxs("button",{type:"button",onClick:()=>he("log"),className:g("flex items-center gap-1.5 px-2 py-1 rounded text-sm transition-colors",A?"text-[#9CA3AF] hover:bg-white/10 hover:text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-700"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),o==="es"?"Agregar tiempo":"Add time"]}),y&&y.loggedMinutes>0&&jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:g("text-sm font-medium",y.health==="over-budget"?"text-red-500":y.health==="at-risk"?"text-yellow-500":A?"text-white":"text-gray-900"),children:[Hs(y.loggedMinutes),y.estimateMinutes&&jsxs("span",{className:g("font-normal",A?"text-[#6B7280]":"text-gray-400"),children:[" / ",Hs(y.estimateMinutes)]})]}),y.health!=="no-estimate"&&jsx("div",{className:"w-16 h-1.5 rounded-full overflow-hidden bg-gray-200 dark:bg-gray-700",children:jsx("div",{className:g("h-full rounded-full transition-all",y.health==="over-budget"?"bg-red-500":y.health==="at-risk"?"bg-yellow-500":"bg-green-500"),style:{width:`${Math.min(100,y.progressPercent||0)}%`}})})]})]}),jsx(AnimatePresence,{children:Ye==="log"&&jsx(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"absolute top-full left-28 mt-2 z-50",children:jsx(eo,{mode:"log",locale:o,isDark:A,currentValue:null,onSave:async(F,P)=>{F&&await E?.(B.id,{durationMinutes:F,note:P,source:"manual"}),he(false);},onClose:()=>he(false)})})})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Tag,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Etiquetas":"Tags"}),jsx($s,{selectedTags:B.tags||[],availableTags:c,onChange:F=>{I("tags",F);},onCreateTag:l,theme:ve})]}),jsxs("div",{className:"flex items-start gap-3 relative",children:[jsx(Link2,{className:g("w-4 h-4 mt-1.5",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0 mt-1",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Relaciones":"Relations"}),jsxs("div",{className:"flex-1",children:[B.dependencies&&B.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:B.dependencies.map(F=>{let P=m.find(z=>z.id===F);return jsxs("span",{className:g("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",A?"bg-[#00E5CC]/20 text-[#00E5CC]":"bg-[#00E5CC]/15 text-[#00C4AE]"),children:[P?.name||F.slice(0,8),jsx("button",{onClick:()=>{let z=(B.dependencies||[]).filter(j=>j!==F);I("dependencies",z);},className:g("ml-0.5 hover:bg-white/20 rounded-full p-0.5 transition-colors"),children:jsx(X,{className:"w-3 h-3"})})]},F)})}),jsxs("button",{onClick:()=>{Lt(),Jt(!xt);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Agregar dependencia":"Add dependency"})]}),jsx(AnimatePresence,{children:xt&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{Jt(false),Qt("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden min-w-[280px] max-h-[320px]",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:[jsx("div",{className:g("p-2 border-b",A?"border-white/10":"border-gray-200"),children:jsx("input",{type:"text",value:Wt,onChange:F=>Qt(F.target.value),placeholder:o==="es"?"Buscar tarea...":"Search task...",className:g("w-full px-3 py-2 rounded-md text-sm outline-none",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400"),autoFocus:true})}),jsx("div",{className:"max-h-[240px] overflow-y-auto",children:m.length>0?m.filter(F=>F.id!==B.id).filter(F=>Wt===""||F.name.toLowerCase().includes(Wt.toLowerCase())).map(F=>{let P=B.dependencies?.includes(F.id);return jsxs("button",{onClick:()=>{let z=B.dependencies||[],j;P?j=z.filter(J=>J!==F.id):j=[...z,F.id],I("dependencies",j);},className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors text-left",A?"hover:bg-white/5":"hover:bg-gray-50",P&&(A?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",P?"bg-[#00E5CC] border-[#00E5CC]":A?"border-white/30":"border-gray-300"),children:P&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:g("block truncate",A?"text-white":"text-gray-900"),children:F.name}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:F.id.slice(0,8)})]})]},F.id)}):jsx("div",{className:g("px-3 py-4 text-sm text-center",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"No hay tareas disponibles":"No tasks available"})})]})]})})]})]}),jsxs("div",{className:"flex items-center gap-3 relative",children:[jsx(Palette,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:"Color"}),jsxs("button",{onClick:()=>{Lt(),Le(!Y);},className:g("flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[jsx("div",{className:"w-4 h-4 rounded-full",style:{backgroundColor:B.color||"#6366F1"}}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:cs.find(F=>F.value===B.color)?.name||(o==="es"?"Azul":"Blue")}),jsx(ChevronDown,{className:g("w-3 h-3",A?"text-[#6B7280]":"text-gray-400")})]}),jsx(AnimatePresence,{children:Y&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>Le(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:g("absolute left-32 top-full mt-1 z-50 rounded-lg shadow-xl overflow-hidden p-3",A?"bg-[#1A1D25] border border-white/10":"bg-white border border-gray-200"),children:jsx("div",{className:"grid grid-cols-6 gap-1.5",children:cs.map(F=>{let P=B.color===F.value;return jsx("button",{onClick:()=>{I("color",F.value),Le(false);},className:g("w-7 h-7 rounded-full flex items-center justify-center transition-all",P&&"ring-2 ring-offset-2",A?"ring-offset-[#1A1D25]":"ring-offset-white"),style:{backgroundColor:F.value,outlineColor:P?F.value:void 0},title:F.name,children:P&&jsx(Check,{className:"w-3.5 h-3.5 text-white"})},F.value)})})})]})})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(Diamond,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("span",{className:g("text-sm w-28 truncate flex-shrink-0",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Hito":"Milestone"}),jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:B.isMilestone||false,onChange:F=>I("isMilestone",F.target.checked),className:g("w-4 h-4 rounded border-2 cursor-pointer appearance-none transition-colors",B.isMilestone?"bg-purple-500 border-purple-500":A?"border-white/30 bg-transparent":"border-gray-300 bg-transparent","checked:bg-purple-500 checked:border-purple-500")}),jsx("span",{className:g("text-sm",A?"text-white":"text-gray-900"),children:o==="es"?"Marcar como hito":"Mark as milestone"})]})]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxs("div",{className:"flex items-center gap-2 mb-3",children:[jsx(FileText,{className:g("w-4 h-4",A?"text-[#6B7280]":"text-gray-400")}),jsx("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:o==="es"?"Descripci\xF3n":"Description"})]}),jsx("textarea",{ref:ut,value:Ae,onChange:F=>Re(F.target.value),placeholder:o==="es"?"Agregar descripci\xF3n...":"Add description...",className:g("w-full min-h-[100px] max-h-[400px] px-3 py-2 rounded-lg text-sm resize-none outline-none transition-colors overflow-y-auto",A?"bg-white/5 text-white placeholder:text-[#6B7280] focus:bg-white/10":"bg-gray-100 text-gray-900 placeholder:text-gray-400 focus:bg-gray-200")})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsx("div",{className:"flex items-center justify-between mb-3",children:jsxs("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[o==="es"?"Subtareas":"Subtasks",B.subtasks&&B.subtasks.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",B.subtasks.filter(F=>F.progress===100).length,"/",B.subtasks.length,")"]})]})}),B.subtasks&&B.subtasks.length>0&&jsx("div",{className:"space-y-2 mb-3",children:[...B.subtasks].sort((F,P)=>(F.position??0)-(P.position??0)).map(F=>jsxs("div",{className:g("flex items-center gap-2 group p-2 rounded-lg -mx-2 transition-colors",A?"hover:bg-white/5":"hover:bg-gray-50"),children:[jsx("button",{onClick:()=>Ct(F.id),className:g("w-5 h-5 rounded border flex items-center justify-center flex-shrink-0 transition-colors",F.progress===100?"bg-green-500 border-green-500":A?"border-white/20 hover:border-green-500/50":"border-gray-300 hover:border-green-500"),children:F.progress===100&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsx("span",{className:g("text-sm flex-1",F.progress===100?"line-through text-[#6B7280]":A?"text-white":"text-gray-900"),children:F.name}),jsx("button",{onClick:()=>At(F.id),className:g("p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",A?"hover:bg-white/10 text-[#6B7280] hover:text-red-400":"hover:bg-gray-100 text-gray-400 hover:text-red-500"),children:jsx(Trash2,{className:"w-3.5 h-3.5"})})]},F.id))}),ke?jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:la,onChange:F=>da(F.target.value),onKeyDown:F=>{F.key==="Enter"&&la.trim()?Ze():F.key==="Escape"&&(Te(false),da(""));},placeholder:o==="es"?"Nombre de la subtarea...":"Subtask name...",autoFocus:true,className:g("flex-1 px-3 py-2 rounded-lg text-sm outline-none transition-colors",A?"bg-white/5 border border-white/10 text-white placeholder:text-[#6B7280] focus:border-[#00E5CC]/50":"bg-gray-50 border border-gray-200 text-gray-900 placeholder:text-gray-400 focus:border-[#00E5CC]")}),jsx("button",{onClick:Ze,disabled:!la.trim(),className:g("px-3 py-2 rounded-lg text-sm font-medium transition-colors",la.trim()?"bg-[#00E5CC] hover:bg-[#00C4AE] text-white":A?"bg-white/5 text-[#6B7280] cursor-not-allowed":"bg-gray-100 text-gray-400 cursor-not-allowed"),children:o==="es"?"Agregar":"Add"}),jsx("button",{onClick:()=>{Te(false),da("");},className:g("p-2 rounded-lg transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-4 h-4"})})]}):jsxs("button",{onClick:()=>Te(true),className:g("w-full flex items-center gap-2 px-3 py-2 rounded-lg text-sm transition-colors",A?"bg-white/5 hover:bg-white/10 text-[#9CA3AF]":"bg-gray-100 hover:bg-gray-200 text-gray-600"),children:[jsx(Plus,{className:"w-4 h-4"}),o==="es"?"Agregar subtarea":"Add subtask"]})]}),jsxs("div",{className:g("mt-6 pt-4 border-t",A?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold mb-3",A?"text-white":"text-gray-900"),children:[o==="es"?"Adjuntos":"Attachments",u.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",u.length,")"]})]}),u.length>0&&jsx("div",{className:"space-y-2 mb-4",children:u.map(F=>{let P=X$1(F.type),z=F.type.startsWith("image/");return jsxs("div",{className:g("flex items-center gap-3 p-2 rounded-lg group transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-50 hover:bg-gray-100"),children:[z&&F.thumbnailUrl?jsx("img",{src:F.thumbnailUrl,alt:F.name,className:"w-10 h-10 rounded object-cover"}):jsx("div",{className:g("w-10 h-10 rounded flex items-center justify-center",A?"bg-white/10":"bg-gray-200"),children:jsx(P,{className:g("w-5 h-5",A?"text-[#9CA3AF]":"text-gray-500")})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("a",{href:F.url,target:"_blank",rel:"noopener noreferrer",className:g("text-sm font-medium truncate block hover:underline",A?"text-white":"text-gray-900"),children:F.name}),jsx("p",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:G(F.size)})]}),d&&jsx("button",{onClick:()=>d(F.id),className:g("p-1.5 rounded opacity-0 group-hover:opacity-100 transition-all",A?"hover:bg-red-500/20 text-red-400":"hover:bg-red-100 text-red-500"),title:o==="es"?"Eliminar":"Delete",children:jsx(Trash2,{className:"w-4 h-4"})})]},F.id)})}),jsxs("div",{onDragOver:ta,onDragLeave:de,onDrop:_a,className:g("border-2 border-dashed rounded-lg p-6 text-center transition-all cursor-pointer relative",dt?A?"border-[#00E5CC] bg-[#00E5CC]/10":"border-[#00E5CC] bg-[#00E5CC]/15":A?"border-white/10 hover:border-white/20":"border-gray-200 hover:border-gray-300",ue&&"pointer-events-none opacity-50"),children:[jsx("input",{type:"file",multiple:true,onChange:ma,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer",disabled:!p||ue}),ue?jsxs(Fragment,{children:[jsx("div",{className:"w-6 h-6 mx-auto mb-2 border-2 border-[#00E5CC] border-t-transparent rounded-full animate-spin"}),jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:o==="es"?"Subiendo...":"Uploading..."})]}):jsxs(Fragment,{children:[jsx(Upload,{className:g("w-6 h-6 mx-auto mb-2",dt?"text-[#00E5CC]":A?"text-[#6B7280]":"text-gray-400")}),jsx("p",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-500"),children:dt?o==="es"?"Suelta los archivos aqu\xED":"Drop files here":o==="es"?jsxs(Fragment,{children:["Suelta tus archivos aqu\xED o ",jsx("span",{className:"underline",children:"haz clic para subir"})]}):jsxs(Fragment,{children:["Drop your files here or ",jsx("span",{className:"underline",children:"click to upload"})]})}),!p&&jsx("p",{className:g("text-xs mt-1",A?"text-[#6B7280]":"text-gray-400"),children:o==="es"?"Upload no disponible":"Upload not available"})]})]})]})]})]}),jsxs("div",{className:g("w-96 border-l flex flex-col",A?"border-white/[0.08] bg-[#0A0A0A]":"border-gray-200 bg-gray-50"),children:[jsxs("div",{className:g("px-4 py-3 border-b flex items-center justify-between h-[49px]",A?"border-white/10":"border-gray-200"),children:[jsxs("h3",{className:g("text-sm font-semibold",A?"text-white":"text-gray-900"),children:[o==="es"?"Actividad":"Activity",f.length>0&&jsxs("span",{className:g("ml-2 text-xs font-normal",A?"text-[#6B7280]":"text-gray-400"),children:["(",f.length,")"]})]}),jsx("button",{onClick:a,className:g("p-1.5 rounded transition-colors",A?"hover:bg-white/10 text-[#9CA3AF]":"hover:bg-gray-100 text-gray-500"),children:jsx(X,{className:"w-5 h-5"})})]}),jsx("style",{children:`
|
|
5
5
|
.activity-comments-scroll::-webkit-scrollbar {
|
|
6
6
|
width: 4px !important;
|
|
7
7
|
}
|
|
@@ -15,8 +15,8 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
15
15
|
.activity-comments-scroll:hover::-webkit-scrollbar-thumb {
|
|
16
16
|
background: ${A?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.15)"} !important;
|
|
17
17
|
}
|
|
18
|
-
`}),jsx("div",{ref:rt,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",A?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((S,H)=>{let Z=typeof S.createdAt=="string"?new Date(S.createdAt):S.createdAt,Te=typeof H.createdAt=="string"?new Date(H.createdAt):H.createdAt;return Z.getTime()-Te.getTime()}).map(S=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:S.user?.color||"#8B5CF6"},children:S.user?.name?.slice(0,2).toUpperCase()||"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:g("text-sm font-medium",A?"text-white":"text-gray-900"),children:S.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:Ra(S.createdAt)})]}),jsx("div",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-600"),children:jsx(Hp,{content:S.content,theme:s})}),S.attachments&&S.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:S.attachments.map(H=>{let Z=H.type.startsWith("image/");return jsxs("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[Z?jsx(Image,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",A?"text-white":"text-gray-900"),children:H.name})]},H.id)})})]})]},S.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:g("w-10 h-10 mb-3",A?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:g("py-4 pl-4 pr-2 border-t",A?"border-white/10":"border-gray-200"),children:jsx(Op,{value:yt,onChange:Ye,onSubmit:Sa,users:h,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:vt,theme:s,locale:o,currentUser:b,enableEmoji:true,enableAttachments:!!y,pendingFiles:wt,onFilesSelect:Xe,onRemoveFile:et})})]})]})]})})}function Bc(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function lo({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:i,isLoading:c,error:l,children:p,availableTags:u=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:b,onAddComment:h,currentUser:y,mentionableUsers:x,onTaskOpen:w,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:O,timeEntries:T,timerState:D,onLogTime:M,onUpdateEstimate:N,onUpdateSoldEffort:z,onStartTimer:$,onStopTimer:Y,onDiscardTimer:A,blurFinancials:Se=false,sidePanel:W,renderColumnMetrics:Ce,suppressDetailModal:R=false}){let[we,G]=Bc(),[Ve,oe]=useState(null),[Be,le]=useState(false),He=useRef(null),$e=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Pe=n?.theme||"dark",je=Pe==="dark"||Pe==="neutral",tt=je?"dark":"",ee=useCallback((L,J)=>{t.onCardUpdate?.(L,J);},[t]),Ae=useCallback((L,J)=>{t.onColumnUpdate?.(L,{title:J});},[t]),ot=useCallback(L=>{t.onColumnDelete?.(L);},[t]),Ie=["todo","in-progress","completed"],zt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),st=useMemo(()=>{let L=new Map;return e.columns.forEach(J=>{let xe=J.cardIds.map(I=>e.cards.find(j=>j.id===I)).filter(I=>I!==void 0).sort((I,j)=>I.position-j.position);L.set(J.id,xe);}),L},[e.cards,e.columns]);useEffect(()=>{let L=He.current;if(!L)return;let J=ke=>{let Ue=ke.target,ue=ke.button===1,at=Ue===L||Ue.classList.contains("asakaa-column")&&!Ue.closest(".asakaa-card");(ue||ke.button===0&&at&&!we.isDragging)&&(ke.preventDefault(),le(true),$e.current={x:ke.clientX,y:ke.clientY,scrollLeft:L.scrollLeft,scrollTop:L.scrollTop},L.style.cursor="grabbing",L.style.userSelect="none");},xe=ke=>{if(!Be)return;let Ue=ke.clientX-$e.current.x,ue=ke.clientY-$e.current.y;L.scrollLeft=$e.current.scrollLeft-Ue,L.scrollTop=$e.current.scrollTop-ue;},I=()=>{Be&&(le(false),L.style.cursor="",L.style.userSelect="");},j=()=>{Be&&(le(false),L.style.cursor="",L.style.userSelect="");};return L.addEventListener("mousedown",J),document.addEventListener("mousemove",xe),document.addEventListener("mouseup",I),L.addEventListener("mouseleave",j),()=>{L.removeEventListener("mousedown",J),document.removeEventListener("mousemove",xe),document.removeEventListener("mouseup",I),L.removeEventListener("mouseleave",j);}},[Be,we.isDragging]);let bt=useMemo(()=>e.cards.map(L=>({id:L.id,name:L.title,startDate:L.startDate?new Date(L.startDate):void 0,endDate:L.endDate?new Date(L.endDate):void 0,progress:L.progress||0,status:L.columnId,priority:L.priority?.toLowerCase(),dependencies:Array.isArray(L.dependencies)?L.dependencies.map(J=>typeof J=="string"?J:J.taskId):[]})),[e.cards]),Ee=useCallback(L=>{let{active:J}=L,xe=e.cards.find(I=>I.id===J.id);xe&&G({isDragging:true,draggedCardId:xe.id,sourceColumnId:xe.columnId,targetColumnId:xe.columnId});},[e.cards,G]),Dt=useCallback(L=>{let{active:J,over:xe}=L;if(!xe||!e.cards.find(ke=>ke.id===J.id))return;let j=null;xe.data.current?.type==="column"?j=xe.id:xe.data.current?.type==="card"&&(j=e.cards.find(Ue=>Ue.id===xe.id)?.columnId||null),j&&j!==we.targetColumnId&&G({...we,targetColumnId:j});},[e.cards,we,G]),ht=useCallback(async L=>{let{active:J,over:xe}=L;if(G({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!xe)return;let I=e.cards.find(ue=>ue.id===J.id);if(!I)return;let j,ke;if(xe.data.current?.type==="column"){j=xe.id;let ue=st.get(j)||[];ke=yc(ue,0);}else {let ue=e.cards.find(Ye=>Ye.id===xe.id);if(!ue)return;j=ue.columnId;let at=st.get(j)||[],yt=at.findIndex(Ye=>Ye.id===xe.id);ke=yc(at,yt);}let Ue=e.columns.find(ue=>ue.id===j);if(Ue&&Ue.wipLimit&&Ue.wipLimitType==="hard"){let ue=st.get(j)||[];if(I.columnId!==j&&ue.length>=Ue.wipLimit){t.onWipLimitExceeded?.(Ue,I);return}}(I.columnId!==j||I.position!==ke)&&await t.onCardMove?.(I.id,j,ke);},[e.cards,e.columns,st,t,G]),_e=useCallback(L=>{R||oe(L),a?.(L),w?.(L.id);},[a,w,R]),dt=useCallback(L=>{t.onCardUpdate?.(L.id,L),oe(L);},[t]);return c?jsx("div",{className:g("asakaa-board",tt,o),style:i,children:jsx($y,{columnCount:3})}):l?jsx("div",{className:g("asakaa-board",tt,o),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(mp,{themeName:Pe,children:[jsxs("div",{className:g("flex h-full overflow-hidden",W?"flex-row":""),children:[jsxs(DndContext,{sensors:zt,collisionDetection:closestCorners,onDragStart:Ee,onDragOver:Dt,onDragEnd:ht,children:[jsxs("div",{ref:He,className:g("asakaa-board",W?"flex-1":"",tt,o),style:{...i,cursor:Be?"grabbing":void 0},"data-theme":Pe,children:[e.columns.sort((L,J)=>L.position-J.position).map(L=>{let J=st.get(L.id)||[],xe=!Ie.includes(L.id),I=r?.renderColumnFooter?.(L);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(is,{column:L,cards:J,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:Ce?(j,ke)=>Ce(j,ke):void 0,onCardClick:_e,onCardUpdate:ee,onColumnRename:t.onColumnUpdate?Ae:void 0,onColumnDelete:t.onColumnDelete?ot:void 0,isDeletable:xe,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight,isCollapsed:n?.collapsedColumnIds?.includes(L.id)}),I]},L.id)}),p]}),jsx(DragOverlay,{children:we.draggedCardId?jsx(zn,{card:e.cards.find(L=>L.id===we.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),W]}),!R&&jsx(Io,{task:Ve,isOpen:!!Ve,onClose:()=>oe(null),onCardUpdate:dt,theme:je?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:u,onCreateTag:d,attachments:Ve?m?.get(Ve.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:bt,comments:b,onAddComment:h,currentUser:y,mentionableUsers:x,onUploadCommentAttachments:C,enableTimeTracking:P,timeTrackingSummary:O,timeEntries:T,isTimerRunning:D?.isRunning,timerElapsedSeconds:D?.elapsedSeconds,onTimeLog:M,onEstimateUpdate:N,onSoldEffortUpdate:z,onTimerStart:$,onTimerStop:Y,onTimerDiscard:A,blurFinancials:Se})]})}function $y({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var zy={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#007FFF",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},Gy={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},Vy={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},jy={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function _y({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),i=useRef(null);useEffect(()=>{let l=p=>{i.current&&!i.current.contains(p.target)&&o(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),o(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,p)=>l.position-p.position).map((l,p)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:p<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:p*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function Ky({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(a||r||n))return null;let u=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(m=>m.handler),d=async(m,f)=>{if(f){c(m);try{await f();}catch(v){console.error(`Export ${m} failed:`,v);}finally{c(null),o(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:u.map((m,f)=>jsxs(motion.button,{onClick:()=>d(m.id,m.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<u.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===m.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:m.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function qy({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, #007FFF 0%, #0055CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Oc({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:p,toolbarEndContent:u}){let d=r==="dark"?zy:Gy,m={...n==="es"?Vy:jy,...l},f=o||i||c;return jsx("div",{className:"h-12 px-4 flex items-center justify-end border-b sticky top-0 z-10",style:{backgroundColor:d.bgGrid,borderColor:d.border},children:jsxs("div",{className:"flex items-center gap-3",children:[p&&jsxs(Fragment,{children:[p,jsx("div",{className:"w-px h-5",style:{backgroundColor:d.borderLight}})]}),f&&jsxs(Fragment,{children:[jsx(Ky,{theme:d,t:m,onExportCSV:o,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:d.borderLight}})]}),u,t&&(s?jsx(_y,{columns:e,onSelect:t,theme:d,t:m,createTaskLabel:a}):jsx(qy,{onClick:()=>t(),label:a||m.newTask}))]})})}function Uc({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let d=i.trim();d&&(e(d),c(""),o(false));},[i,e]),p=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),l()):d.key==="Escape"&&(c(""),o(false));},[l]),u=useCallback(()=>{setTimeout(()=>{i.trim()||o(false);},150);},[i]);return s?jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:d=>c(d.target.value),onKeyDown:p,onBlur:u,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:g("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function ei({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:i="up"}){let[c,l]=useState(""),[p,u]=useState(void 0),[d,m]=useState(null),[f,v]=useState(null),[b,h]=useState(false),[y,x]=useState(false),[w,C]=useState(false),[P,O]=useState(s||new Date),T=useRef(null),D=n==="es",M=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{T.current?.focus();},[]);let N=useCallback(()=>{h(false),x(false),C(false);},[]),z=useCallback(()=>{l(""),u(void 0),m(null),v(null),N(),t();},[t,N]),$=f||s||new Date,Y=useCallback(()=>{let W=c.trim();if(!W)return;let Ce=a.find(we=>we.id===d),R=$;e({name:W,priority:p,assignee:Ce||void 0,assigneeId:d,startDate:R,endDate:R}),l(""),u(void 0),m(null),v(null),N(),T.current?.focus();},[c,p,d,$,a,e,N]),A=useCallback(W=>{W.key==="Enter"&&c.trim()&&(W.preventDefault(),Y()),W.key==="Escape"&&z();},[Y,z,c]),Se=$;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>N(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:T,type:"text",value:c,onChange:W=>l(W.target.value),placeholder:D?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:A})}),jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:W=>{W.stopPropagation(),h(!b),x(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",p?p==="urgent"||p==="high"?"text-red-400 bg-red-500/20":p==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[{id:"urgent",label:D?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:D?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:D?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:D?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:D?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(W=>jsxs("button",{onClick:()=>{u(W.id),h(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",p===W.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",W.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:W.label})]},W.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:W=>{W.stopPropagation(),C(!w),h(false),x(false),O(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#007FFF]/20 text-[#007FFF]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),Se.toLocaleDateString(D?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:w&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let W=new Date,Ce=new Date(W);Ce.setDate(W.getDate()+1);let R=new Date(W);R.setDate(W.getDate()+((6-W.getDay()+7)%7||7));let we=new Date(W);we.setDate(W.getDate()+((1-W.getDay()+7)%7||7));let G=new Date(W);G.setDate(W.getDate()+14);let Ve=new Date(W);Ve.setDate(W.getDate()+28);let oe=D?"es-ES":"en-US";return [{label:D?"Hoy":"Today",date:W,display:W.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:D?"Ma\xF1ana":"Tomorrow",date:Ce,display:Ce.toLocaleDateString(oe,{weekday:"short"}).slice(0,3)+"."},{label:D?"Este fin de semana":"This weekend",date:R,display:D?"s\xE1b.":"sat."},{label:D?"Pr\xF3xima semana":"Next week",date:we,display:D?"lun.":"mon."},{label:D?"2 semanas":"2 weeks",date:G,display:G.toLocaleDateString(oe,{day:"numeric",month:"short"})},{label:D?"4 semanas":"4 weeks",date:Ve,display:Ve.toLocaleDateString(oe,{day:"numeric",month:"short"})}].map((le,He)=>jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{v(le.date),C(false);},children:[jsx("span",{children:le.label}),jsx("span",{className:g("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:le.display})]},He))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:g("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:P.toLocaleDateString(D?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>O(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:D?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>O(new Date(P.getFullYear(),P.getMonth()-1)),className:g("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>O(new Date(P.getFullYear(),P.getMonth()+1)),className:g("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(D?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(W=>jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:W},W))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let W=P.getFullYear(),Ce=P.getMonth(),R=new Date(W,Ce,1).getDay(),we=new Date(W,Ce+1,0).getDate(),G=new Date(W,Ce,0).getDate(),Ve=new Date().toDateString(),oe=[];for(let le=R-1;le>=0;le--)oe.push({dayNum:G-le,isCurrent:false,date:new Date(W,Ce-1,G-le)});for(let le=1;le<=we;le++)oe.push({dayNum:le,isCurrent:true,date:new Date(W,Ce,le)});let Be=42-oe.length;for(let le=1;le<=Be;le++)oe.push({dayNum:le,isCurrent:false,date:new Date(W,Ce+1,le)});return oe.map((le,He)=>{let $e=le.date.toDateString()===Ve,Pe=(f||s)?.toDateString()===le.date.toDateString();return jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!le.isCurrent&&(r?"text-white/20":"text-gray-300"),le.isCurrent&&(r?"text-white":"text-gray-900"),$e&&"ring-1 ring-[#007FFF]",Pe&&"bg-[#007FFF] text-white",!Pe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(le.date),C(false);},children:le.dayNum},He)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:W=>{W.stopPropagation(),x(!y),h(false),C(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#007FFF] bg-[#007FFF]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:d?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(W=>W.id===d)?.color||"#007FFF"},children:a.find(W=>W.id===d)?.initials||a.find(W=>W.id===d)?.name?.slice(0,2).toUpperCase()}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",M,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:W=>W.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{m(null),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!d&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:D?"Sin asignar":"Unassigned"})]}),a.map(W=>jsxs("button",{type:"button",onClick:()=>{m(W.id),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",d===W.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:W.color||"#007FFF"},children:W.initials||W.name?.slice(0,2).toUpperCase()}),jsx("span",{className:r?"text-white":"text-gray-900",children:W.name})]},W.id)),a.length===0&&jsx("div",{className:g("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:D?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:Y,disabled:!c.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#007FFF] hover:bg-[#0066CC] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:D?"Guardar":"Save"})]})]})}function jc({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:i="es"}){let[c,l]=useState(false),p=useRef(null),u=useRef(null),[d,m]=useState({}),[f,v]=useState(false),b=o==="dark",y={buttonLabel:n||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!p.current)return;let w=90,C=()=>{let P=p.current.getBoundingClientRect(),T=window.innerHeight-P.bottom<w+8;v(T),m({position:"fixed",...T?{bottom:window.innerHeight-P.top+4}:{top:P.bottom+4},left:P.left,width:P.width,zIndex:9999});};return C(),window.addEventListener("scroll",C,true),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,true),window.removeEventListener("resize",C);}},[c]),useEffect(()=>{if(!c)return;let w=C=>{let P=C.target;u.current&&!u.current.contains(P)&&p.current&&!p.current.contains(P)&&l(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let x=useCallback(w=>{t({name:w.name,columnId:e,assigneeIds:w.assigneeId?[w.assigneeId]:void 0,startDate:w.startDate,endDate:w.endDate,priority:w.priority});},[t,e]);return jsxs("div",{ref:p,className:g("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),y.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:u,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:d,className:g("rounded-lg shadow-2xl",b?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(ei,{onSubmit:x,onCancel:()=>l(false),availableUsers:a,isDark:b,locale:i,dropdownDirection:"up"})})}),document.body)]})}var ai=class extends BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx(lo,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(n=>`"${n}"`).join(",")).join(`
|
|
19
|
-
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function hm(e={}){return new ai(e)}var us=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function _c(e,t){let a=r=>jsx(us,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function qc({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:p=""}){let[u,d]=useState(false),[m,f]=useState(""),[v,b]=useState("home"),[h,y]=useState(""),[x,w]=useState("");useEffect(()=>{let T=D=>{(D.metaKey||D.ctrlKey)&&D.key===l&&(D.preventDefault(),d(M=>!M)),D.key==="Escape"&&(d(false),b("home"),f(""));};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[l]),useEffect(()=>{u||(b("home"),f(""),y(""),w(""));},[u]);let C=useCallback(()=>{d(false);},[]),P=useCallback(T=>{let[D,M]=T.split(":");switch(D){case "create-card":b("create-card");break;case "create-card-in":y(M||"");break;case "navigate":M?(a?.(M),C()):b("navigate");break;case "search":r?.(m),C();break;case "priority":b("priority");break;case "set-priority":x&&M&&(n?.(x,M),C());break;case "assign":b("assign");break;case "assign-user":x&&M&&(s?.(x,M),C());break;case "ai":b("ai");break;case "ai-generate-plan":o?.(),C();break;case "ai-predict-risks":i?.(),C();break;case "ai-usage":c?.(),C();break;case "back":b("home");break;}},[m,x,t,a,r,n,s,o,i,c,C]),O=useCallback(()=>{h&&m.trim()&&(t?.(h,m.trim()),C());},[h,m,t,C]);return u?jsx(ga,{children:jsx("div",{className:"command-palette-overlay",onClick:C,children:jsx("div",{className:`command-palette ${p}`,onClick:T=>T.stopPropagation(),children:jsxs(Command,{value:m,onValueChange:f,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:v==="create-card"&&h?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:T=>{T.key==="Enter"&&v==="create-card"&&h&&O();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),v==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:P,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:P,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:P,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:P,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(T=>jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:P,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:T.title}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(D=>jsx("span",{className:"command-palette-item-label",children:D},D))})]},T.id))})]}),v==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(T=>jsxs(Command.Item,{value:`create-card-in:${T.id}`,onSelect:P,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:T.title}),jsxs("div",{className:"command-palette-item-count",children:[T.cardIds.length," cards"]})]},T.id))})]}),v==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(T=>{let D=e.columns.find(M=>M.id===T.columnId);return jsxs(Command.Item,{value:`navigate:${T.id}`,onSelect:P,className:"command-palette-item",keywords:[T.title,T.description||"",...T.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:T.priority==="URGENT"?"#EF4444":T.priority==="HIGH"?"#F59E0B":T.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:T.title}),jsx("div",{className:"command-palette-item-meta",children:D?.title})]}),T.labels&&T.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:T.labels.slice(0,2).map(M=>jsx("span",{className:"command-palette-item-label",children:M},M))})]},T.id)})})]}),v==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:P,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:P,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:P,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:P,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function vm(e,t,a,r,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
18
|
+
`}),jsx("div",{ref:gt,className:g("flex-1 overflow-y-auto py-4 pl-4 pr-2 activity-comments-scroll",A?"scrollbar-slim":"scrollbar-slim-light"),children:f.length>0?jsx("div",{className:"space-y-4",children:[...f].sort((F,P)=>{let z=typeof F.createdAt=="string"?new Date(F.createdAt):F.createdAt,j=typeof P.createdAt=="string"?new Date(P.createdAt):P.createdAt;return z.getTime()-j.getTime()}).map(F=>jsxs("div",{className:"flex gap-3",children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-white text-[10px] font-medium flex-shrink-0",style:{backgroundColor:F.user?.color||"#8B5CF6"},children:F.user?.name?ba(F.user.name):"U"}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2 mb-1",children:[jsx("span",{className:g("text-sm font-medium",A?"text-white":"text-gray-900"),children:F.user?.name||(o==="es"?"Usuario":"User")}),jsx("span",{className:g("text-xs",A?"text-[#6B7280]":"text-gray-400"),children:It(F.createdAt)})]}),jsx("div",{className:g("text-sm",A?"text-[#9CA3AF]":"text-gray-600"),children:jsx(ag,{content:F.content,theme:s})}),F.attachments&&F.attachments.length>0&&jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:F.attachments.map(P=>{let z=P.type.startsWith("image/");return jsxs("a",{href:P.url,target:"_blank",rel:"noopener noreferrer",className:g("flex items-center gap-2 px-2 py-1.5 rounded-lg transition-colors",A?"bg-white/5 hover:bg-white/10":"bg-gray-100 hover:bg-gray-200"),children:[z?jsx(Image,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}):jsx(File,{className:g("w-4 h-4",A?"text-[#9CA3AF]":"text-gray-500")}),jsx("span",{className:g("text-xs truncate max-w-[100px]",A?"text-white":"text-gray-900"),children:P.name})]},P.id)})})]})]},F.id))}):jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center",children:[jsx(MessageSquare,{className:g("w-10 h-10 mb-3",A?"text-[#3B4252]":"text-gray-300")}),jsx("p",{className:g("text-sm",A?"text-[#6B7280]":"text-gray-500"),children:o==="es"?"Sin actividad reciente":"No recent activity"})]})}),jsx("div",{className:g("py-4 pl-4 pr-2 border-t",A?"border-white/10":"border-gray-200"),children:jsx(tg,{value:ot,onChange:mt,onSubmit:qe,users:w,placeholder:o==="es"?"Escribe un comentario... (usa @ para mencionar)":"Write a comment... (use @ to mention)",disabled:!v,isSubmitting:Ht,theme:s,locale:o,currentUser:b,enableEmoji:true,enableAttachments:!!h,pendingFiles:Oe,onFilesSelect:_e,onRemoveFile:it})})]})]})]})})}function Pd(){let[e,t]=useState(()=>dragStore.getState());useEffect(()=>dragStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{dragStore.setState(r);},[]);return [e,a]}function $o({board:e,callbacks:t,onCardClick:a,renderProps:r,config:n,availableUsers:s=[],className:o,style:i,isLoading:c,error:l,children:u,availableTags:p=[],onCreateTag:d,attachmentsByCard:m,onUploadAttachments:f,onDeleteAttachment:v,comments:b,onAddComment:w,currentUser:h,mentionableUsers:x,onTaskOpen:y,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:H,timeEntries:E,timerState:N,onLogTime:D,onUpdateEstimate:S,onUpdateSoldEffort:V,onStartTimer:W,onStopTimer:R,onDiscardTimer:A,blurFinancials:ve=false,sidePanel:q,renderColumnMetrics:le,suppressDetailModal:B=false}){let[pe,nt]=Pd(),[Ue,$]=useState(null),[fe,ie]=useState(false),et=useRef(null),Xe=useRef({x:0,y:0,scrollLeft:0,scrollTop:0}),Qe=n?.theme||"dark",ct=Qe==="dark"||Qe==="neutral",Tt=ct?"dark":"",_t=useCallback((ue,ce)=>{t.onCardUpdate?.(ue,ce);},[t]),tt=useCallback((ue,ce)=>{t.onColumnUpdate?.(ue,{title:ce});},[t]),xt=useCallback(ue=>{t.onColumnDelete?.(ue);},[t]),Jt=["todo","in-progress","completed"],Wt=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:8}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),Qt=useMemo(()=>{let ue=new Map;return e.columns.forEach(ce=>{let Ae=ce.cardIds.map(Et=>e.cards.find(Pe=>Pe.id===Et)).filter(Et=>Et!==void 0).sort((Et,Pe)=>Et.position-Pe.position);ue.set(ce.id,Ae);}),ue},[e.cards,e.columns]);useEffect(()=>{let ue=et.current;if(!ue)return;let ce=ut=>{let O=ut.target,re=ut.button===1,we=O===ue||O.classList.contains("asakaa-column")&&!O.closest(".asakaa-card");(re||ut.button===0&&we&&!pe.isDragging)&&(ut.preventDefault(),ie(true),Xe.current={x:ut.clientX,y:ut.clientY,scrollLeft:ue.scrollLeft,scrollTop:ue.scrollTop},ue.style.cursor="grabbing",ue.style.userSelect="none");},Ae=ut=>{if(!fe)return;let O=ut.clientX-Xe.current.x,re=ut.clientY-Xe.current.y;ue.scrollLeft=Xe.current.scrollLeft-O,ue.scrollTop=Xe.current.scrollTop-re;},Et=()=>{fe&&(ie(false),ue.style.cursor="",ue.style.userSelect="");},Pe=()=>{fe&&(ie(false),ue.style.cursor="",ue.style.userSelect="");};return ue.addEventListener("mousedown",ce),document.addEventListener("mousemove",Ae),document.addEventListener("mouseup",Et),ue.addEventListener("mouseleave",Pe),()=>{ue.removeEventListener("mousedown",ce),document.removeEventListener("mousemove",Ae),document.removeEventListener("mouseup",Et),ue.removeEventListener("mouseleave",Pe);}},[fe,pe.isDragging]);let Y=useMemo(()=>e.cards.map(ue=>({id:ue.id,name:ue.title,startDate:ue.startDate?new Date(ue.startDate):void 0,endDate:ue.endDate?new Date(ue.endDate):void 0,progress:ue.progress||0,status:ue.columnId,priority:ue.priority?.toLowerCase(),dependencies:Array.isArray(ue.dependencies)?ue.dependencies.map(ce=>typeof ce=="string"?ce:ce.taskId):[]})),[e.cards]),Le=useCallback(ue=>{let{active:ce}=ue,Ae=e.cards.find(Et=>Et.id===ce.id);Ae&&nt({isDragging:true,draggedCardId:Ae.id,sourceColumnId:Ae.columnId,targetColumnId:Ae.columnId});},[e.cards,nt]),Ye=useCallback(ue=>{let{active:ce,over:Ae}=ue;if(!Ae||!e.cards.find(ut=>ut.id===ce.id))return;let Pe=null;Ae.data.current?.type==="column"?Pe=Ae.id:Ae.data.current?.type==="card"&&(Pe=e.cards.find(O=>O.id===Ae.id)?.columnId||null),Pe&&Pe!==pe.targetColumnId&&nt({...pe,targetColumnId:Pe});},[e.cards,pe,nt]),he=useCallback(async ue=>{let{active:ce,over:Ae}=ue;if(nt({isDragging:false,draggedCardId:null,sourceColumnId:null,targetColumnId:null}),!Ae)return;let Et=e.cards.find(re=>re.id===ce.id);if(!Et)return;let Pe,ut;if(Ae.data.current?.type==="column"){Pe=Ae.id;let re=Qt.get(Pe)||[];ut=dd(re,0);}else {let re=e.cards.find(mt=>mt.id===Ae.id);if(!re)return;Pe=re.columnId;let we=Qt.get(Pe)||[],ot=we.findIndex(mt=>mt.id===Ae.id);ut=dd(we,ot);}let O=e.columns.find(re=>re.id===Pe);if(O&&O.wipLimit&&O.wipLimitType==="hard"){let re=Qt.get(Pe)||[];if(Et.columnId!==Pe&&re.length>=O.wipLimit){t.onWipLimitExceeded?.(O,Et);return}}(Et.columnId!==Pe||Et.position!==ut)&&await t.onCardMove?.(Et.id,Pe,ut);},[e.cards,e.columns,Qt,t,nt]),dt=useCallback(ue=>{B||$(ue),a?.(ue),y?.(ue.id);},[a,y,B]),wt=useCallback(ue=>{t.onCardUpdate?.(ue.id,ue),$(ue);},[t]);return c?jsx("div",{className:g("asakaa-board",Tt,o),style:i,children:jsx(pv,{columnCount:3})}):l?jsx("div",{className:g("asakaa-board",Tt,o),style:i,children:jsx("div",{className:"flex items-center justify-center w-full h-64",children:jsxs("div",{className:"text-center",children:[jsx("p",{className:"text-asakaa-accent-red text-lg font-semibold mb-2",children:"Error loading board"}),jsx("p",{className:"text-asakaa-text-secondary text-sm",children:typeof l=="string"?l:l.message})]})})}):jsxs(Nm,{themeName:Qe,children:[jsxs("div",{className:g("flex h-full overflow-hidden",q?"flex-row":""),children:[jsxs(DndContext,{sensors:Wt,collisionDetection:closestCorners,onDragStart:Le,onDragOver:Ye,onDragEnd:he,children:[jsxs("div",{ref:et,className:g("asakaa-board",q?"flex-1":"",Tt,o),style:{...i,cursor:fe?"grabbing":void 0},"data-theme":Qe,children:[e.columns.sort((ue,ce)=>ue.position-ce.position).map(ue=>{let ce=Qt.get(ue.id)||[],Ae=!Jt.includes(ue.id),Et=r?.renderColumnFooter?.(ue);return jsxs("div",{className:"asakaa-column-wrapper",children:[jsx(Bs,{column:ue,cards:ce,renderCard:r?.renderCard,renderColumn:r?.renderColumn,renderHeader:r?.renderColumnHeader,renderEmptyState:r?.renderEmptyState,renderMetrics:le?(Pe,ut)=>le(Pe,ut):void 0,onCardClick:dt,onCardUpdate:_t,onColumnRename:t.onColumnUpdate?tt:void 0,onColumnDelete:t.onColumnDelete?xt:void 0,isDeletable:Ae,locale:n?.locale==="es"?"es":"en",availableUsers:s,allCards:e.cards,enableVirtualization:n?.enableVirtualization,cardHeight:n?.cardHeight,isCollapsed:n?.collapsedColumnIds?.includes(ue.id)}),Et]},ue.id)}),u]}),jsx(DragOverlay,{children:pe.draggedCardId?jsx(fo,{card:e.cards.find(ue=>ue.id===pe.draggedCardId),render:r?.renderCardOverlay||r?.renderCard,disableDrag:true,className:"opacity-90 rotate-3 shadow-2xl"}):null})]}),q]}),!B&&jsx(ds,{task:Ue,isOpen:!!Ue,onClose:()=>$(null),onCardUpdate:wt,theme:ct?"dark":"light",locale:n?.locale==="es"?"es":"en",availableUsers:s,availableTags:p,onCreateTag:d,attachments:Ue?m?.get(Ue.id)||[]:[],onUploadAttachments:f,onDeleteAttachment:v,availableTasks:Y,comments:b,onAddComment:w,currentUser:h,mentionableUsers:x,onUploadCommentAttachments:k,enableTimeTracking:M,timeTrackingSummary:H,timeEntries:E,isTimerRunning:N?.isRunning,timerElapsedSeconds:N?.elapsedSeconds,onTimeLog:D,onEstimateUpdate:S,onSoldEffortUpdate:V,onTimerStart:W,onTimerStop:R,onTimerDiscard:A,blurFinancials:ve})]})}function pv({columnCount:e}){return jsx(Fragment,{children:Array.from({length:e}).map((t,a)=>jsxs("div",{className:"asakaa-column",children:[jsx("div",{className:"asakaa-skeleton h-8 mb-3"}),jsxs("div",{className:"flex flex-col gap-2",children:[jsx("div",{className:"asakaa-skeleton h-24"}),jsx("div",{className:"asakaa-skeleton h-32"}),jsx("div",{className:"asakaa-skeleton h-28"})]})]},a))})}var hv={bgGrid:"#050505",bgSecondary:"#0A0A0A",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.15)",hoverBg:"rgba(255, 255, 255, 0.04)"},yv={bgGrid:"#FFFFFF",bgSecondary:"#F9FAFB",border:"rgba(0, 0, 0, 0.1)",borderLight:"rgba(0, 0, 0, 0.05)",textPrimary:"#111827",textSecondary:"#6B7280",textTertiary:"#9CA3AF",accent:"#00E5CC",accentLight:"rgba(0, 229, 204, 0.1)",hoverBg:"rgba(0, 0, 0, 0.05)"},xv={newTask:"Nueva Tarea",selectColumn:"Seleccionar columna",export:"Exportar",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"},vv={newTask:"New Task",selectColumn:"Select column",export:"Export",exportCSV:"CSV",exportJSON:"JSON",exportExcel:"Excel"};function wv({columns:e,onSelect:t,theme:a,t:r,createTaskLabel:n}){let[s,o]=useState(false),i=useRef(null);useEffect(()=>{let l=u=>{i.current&&!i.current.contains(u.target)&&o(false);};return s&&document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[s]);let c=l=>{t(l),o(false);};return jsxs("div",{ref:i,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, var(--marca-acento, #00E5CC) 0%, var(--marca-acento-hover, #00C4AE) 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:n||r.newTask}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-48 rounded-lg overflow-hidden z-50",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-[10px] uppercase tracking-wider",style:{color:a.textTertiary},children:r.selectColumn}),e.sort((l,u)=>l.position-u.position).map((l,u)=>jsxs(motion.button,{onClick:()=>c(l.id),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:u<e.length-1?`1px solid ${a.borderLight}`:"none"},whileHover:{backgroundColor:a.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:u*.03},children:[jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:l.color||a.accent}}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:a.textPrimary},children:l.title}),jsxs("div",{className:"text-[10px] truncate",style:{color:a.textTertiary},children:[l.cardIds.length," ",l.cardIds.length===1?"tarea":"tareas"]})]})]},l.id))]})})})]})}function kv({theme:e,t,onExportCSV:a,onExportJSON:r,onExportExcel:n}){let[s,o]=useState(false),[i,c]=useState(null),l=useRef(null);if(useEffect(()=>{let m=f=>{l.current&&!l.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]),!(a||r||n))return null;let p=[{id:"csv",label:t.exportCSV,description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"json",label:t.exportJSON,description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:r},{id:"excel",label:t.exportExcel,description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:n}].filter(m=>m.handler),d=async(m,f)=>{if(f){c(m);try{await f();}catch(v){console.error(`Export ${m} failed:`,v);}finally{c(null),o(false);}}};return jsxs("div",{ref:l,className:"relative",children:[jsxs(motion.button,{onClick:()=>o(!s),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{backgroundColor:s?e.accent:e.bgSecondary,border:`1px solid ${s?e.accent:e.borderLight}`,color:s?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:t.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:s?"rotate(180deg)":"rotate(0deg)"}})]}),jsx(AnimatePresence,{children:s&&jsx(motion.div,{initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"absolute right-0 mt-2 w-44 rounded-lg overflow-hidden z-50",style:{backgroundColor:e.bgSecondary,border:`1px solid ${e.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.25)"},children:jsx("div",{className:"py-1",children:p.map((m,f)=>jsxs(motion.button,{onClick:()=>d(m.id,m.handler),disabled:i!==null,className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:f<p.length-1?`1px solid ${e.borderLight}`:"none"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:f*.03},children:[jsx("div",{className:"flex items-center justify-center w-8 h-8 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:i===m.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-4 h-4"})}):m.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-xs font-medium truncate",style:{color:e.textPrimary},children:m.label}),jsx("div",{className:"text-[10px] truncate",style:{color:e.textTertiary},children:m.description})]})]},m.id))})})})]})}function Cv({onClick:e,label:t}){return jsxs(motion.button,{onClick:e,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-all",style:{background:"linear-gradient(135deg, var(--marca-acento, #00E5CC) 0%, var(--marca-acento-hover, #00C4AE) 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:t})]})}function Ld({columns:e,onCreateTask:t,createTaskLabel:a,theme:r="dark",locale:n="es",useColumnSelector:s=false,onExportCSV:o,onExportJSON:i,onExportExcel:c,translations:l,toolbarRightContent:u,toolbarEndContent:p,toolbarLeftContent:d}){let m=r==="dark"?hv:yv,f={...n==="es"?xv:vv,...l},v=o||i||c;return jsxs("div",{className:`min-h-[48px] px-4 py-1.5 flex flex-wrap items-center gap-y-2 ${d?"justify-between gap-x-3":"justify-end"} border-b sticky top-0 z-10`,style:{backgroundColor:m.bgGrid,borderColor:m.border},children:[d&&jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:d}),jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[u&&jsxs(Fragment,{children:[u,jsx("div",{className:"w-px h-5",style:{backgroundColor:m.borderLight}})]}),v&&jsxs(Fragment,{children:[jsx(kv,{theme:m,t:f,onExportCSV:o,onExportJSON:i,onExportExcel:c}),t&&jsx("div",{className:"w-px h-6",style:{backgroundColor:m.borderLight}})]}),p,t&&(s?jsx(wv,{columns:e,onSelect:t,theme:m,t:f,createTaskLabel:a}):jsx(Cv,{onClick:()=>t(),label:a||f.newTask}))]})]})}function Id({onAddColumn:e,className:t,placeholder:a="Nombre de la columna...",buttonLabel:r="Agregar Columna",disabled:n=false}){let[s,o]=useState(false),[i,c]=useState(""),l=useCallback(()=>{let d=i.trim();d&&(e(d),c(""),o(false));},[i,e]),u=useCallback(d=>{d.key==="Enter"?(d.preventDefault(),l()):d.key==="Escape"&&(c(""),o(false));},[l]),p=useCallback(()=>{setTimeout(()=>{i.trim()||o(false);},150);},[i]);return s?jsx("div",{className:g("asakaa-add-column asakaa-add-column--editing",t),children:jsxs("div",{className:"asakaa-add-column__input-wrapper",children:[jsx("input",{type:"text",value:i,onChange:d=>c(d.target.value),onKeyDown:u,onBlur:p,placeholder:a,autoFocus:true,className:"asakaa-add-column__input"}),jsxs("div",{className:"asakaa-add-column__actions",children:[jsx("button",{onClick:l,disabled:!i.trim(),className:"asakaa-add-column__submit",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("polyline",{points:"20 6 9 17 4 12"})})}),jsx("button",{onClick:()=>{c(""),o(false);},className:"asakaa-add-column__cancel",type:"button",children:jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})]})}):jsx("div",{className:g("asakaa-add-column",t),children:jsxs("button",{onClick:()=>o(true),disabled:n,className:"asakaa-add-column__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),r]})})}function Li({onSubmit:e,onCancel:t,availableUsers:a=[],isDark:r=true,locale:n="es",defaultDate:s,className:o,dropdownDirection:i="up"}){let[c,l]=useState(""),[u,p]=useState(void 0),[d,m]=useState(null),[f,v]=useState(null),[b,w]=useState(false),[h,x]=useState(false),[y,k]=useState(false),[M,H]=useState(s||new Date),E=useRef(null),N=n==="es",D=i==="up"?"bottom-full mb-1":"top-full mt-1";useEffect(()=>{E.current?.focus();},[]);let S=useCallback(()=>{w(false),x(false),k(false);},[]),V=useCallback(()=>{l(""),p(void 0),m(null),v(null),S(),t();},[t,S]),W=f||s||new Date,R=useCallback(()=>{let q=c.trim();if(!q)return;let le=a.find(pe=>pe.id===d),B=W;e({name:q,priority:u,assignee:le||void 0,assigneeId:d,startDate:B,endDate:B}),l(""),p(void 0),m(null),v(null),S(),E.current?.focus();},[c,u,d,W,a,e,S]),A=useCallback(q=>{q.key==="Enter"&&c.trim()&&(q.preventDefault(),R()),q.key==="Escape"&&V();},[R,V,c]),ve=W;return jsxs("div",{className:g("quick-task-create",o),onClick:()=>S(),children:[jsx("div",{className:"p-2.5",children:jsx("input",{ref:E,type:"text",value:c,onChange:q=>l(q.target.value),placeholder:N?"Nombre de la tarea...":"Task name...",className:g("w-full bg-transparent text-sm outline-none font-mono",r?"text-white/90 placeholder:text-white/20":"text-gray-900 placeholder:text-gray-400"),autoFocus:true,onKeyDown:A})}),jsxs("div",{className:g("px-2.5 py-2 flex items-center justify-between border-t",r?"border-white/[0.08]":"border-gray-100"),children:[jsxs("div",{className:"flex items-center gap-1",children:[jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),w(!b),x(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",u?u==="urgent"||u==="high"?"text-red-400 bg-red-500/20":u==="medium"?"text-yellow-400 bg-yellow-500/20":"text-green-400 bg-green-500/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:jsx(Flag,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:b&&jsx(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[120px]",D,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[{id:"urgent",label:N?"Urgente":"Urgent",color:"bg-red-500"},{id:"high",label:N?"Alta":"High",color:"bg-orange-500"},{id:"medium",label:N?"Media":"Medium",color:"bg-yellow-500"},{id:"low",label:N?"Baja":"Low",color:"bg-green-500"},{id:void 0,label:N?"Sin prioridad":"No priority",color:"bg-gray-400"}].map(q=>jsxs("button",{onClick:()=>{p(q.id),w(false);},type:"button",className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",u===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("span",{className:g("w-2 h-2 rounded-full",q.color)}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.label})]},q.id||"none"))})})]}),jsxs("div",{className:"relative",children:[jsxs("button",{onClick:q=>{q.stopPropagation(),k(!y),w(false),x(false),H(f||s||new Date);},type:"button",className:g("flex items-center gap-1 text-xs px-1.5 py-0.5 rounded transition-colors font-mono",f?r?"bg-[#00C4AE]/20 text-[#00C4AE]":"bg-[#00E5CC]/20 text-[#00C4AE]":r?"bg-white/5 text-white/30 hover:bg-white/10":"bg-gray-100 text-gray-500 hover:bg-gray-200"),children:[jsx(CalendarDays,{className:"w-3 h-3"}),ve.toLocaleDateString(N?"es-ES":"en-US",{day:"numeric",month:"short"})]}),jsx(AnimatePresence,{children:y&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-xl shadow-2xl overflow-hidden flex",D,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsx("div",{className:g("w-40 py-2 border-r",r?"border-white/10":"border-gray-200"),children:(()=>{let q=new Date,le=new Date(q);le.setDate(q.getDate()+1);let B=new Date(q);B.setDate(q.getDate()+((6-q.getDay()+7)%7||7));let pe=new Date(q);pe.setDate(q.getDate()+((1-q.getDay()+7)%7||7));let nt=new Date(q);nt.setDate(q.getDate()+14);let Ue=new Date(q);Ue.setDate(q.getDate()+28);let $=N?"es-ES":"en-US";return [{label:N?"Hoy":"Today",date:q,display:q.toLocaleDateString($,{weekday:"short"}).slice(0,3)+"."},{label:N?"Ma\xF1ana":"Tomorrow",date:le,display:le.toLocaleDateString($,{weekday:"short"}).slice(0,3)+"."},{label:N?"Este fin de semana":"This weekend",date:B,display:N?"s\xE1b.":"sat."},{label:N?"Pr\xF3xima semana":"Next week",date:pe,display:N?"lun.":"mon."},{label:N?"2 semanas":"2 weeks",date:nt,display:nt.toLocaleDateString($,{day:"numeric",month:"short"})},{label:N?"4 semanas":"4 weeks",date:Ue,display:Ue.toLocaleDateString($,{day:"numeric",month:"short"})}].map((ie,et)=>jsxs("button",{type:"button",className:g("w-full flex items-center justify-between px-3 py-1.5 text-xs transition-colors",r?"hover:bg-white/5 text-white":"hover:bg-gray-50 text-gray-900"),onClick:()=>{v(ie.date),k(false);},children:[jsx("span",{children:ie.label}),jsx("span",{className:g("text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:ie.display})]},et))})()}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("span",{className:g("text-xs font-medium font-mono",r?"text-white":"text-gray-900"),children:M.toLocaleDateString(N?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{type:"button",onClick:()=>H(new Date),className:g("px-1.5 py-0.5 rounded text-[10px] transition-colors font-mono",r?"hover:bg-white/10 text-white/40":"hover:bg-gray-100 text-gray-500"),children:N?"Hoy":"Today"}),jsx("button",{type:"button",onClick:()=>H(new Date(M.getFullYear(),M.getMonth()-1)),className:g("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronLeft,{className:"w-3.5 h-3.5"})}),jsx("button",{type:"button",onClick:()=>H(new Date(M.getFullYear(),M.getMonth()+1)),className:g("p-0.5 rounded",r?"hover:bg-white/10":"hover:bg-gray-100"),children:jsx(ChevronRight,{className:"w-3.5 h-3.5"})})]})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:(N?["do","lu","ma","mi","ju","vi","s\xE1"]:["su","mo","tu","we","th","fr","sa"]).map(q=>jsx("div",{className:g("w-6 h-6 flex items-center justify-center text-[10px] font-mono",r?"text-white/30":"text-gray-400"),children:q},q))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let q=M.getFullYear(),le=M.getMonth(),B=new Date(q,le,1).getDay(),pe=new Date(q,le+1,0).getDate(),nt=new Date(q,le,0).getDate(),Ue=new Date().toDateString(),$=[];for(let ie=B-1;ie>=0;ie--)$.push({dayNum:nt-ie,isCurrent:false,date:new Date(q,le-1,nt-ie)});for(let ie=1;ie<=pe;ie++)$.push({dayNum:ie,isCurrent:true,date:new Date(q,le,ie)});let fe=42-$.length;for(let ie=1;ie<=fe;ie++)$.push({dayNum:ie,isCurrent:false,date:new Date(q,le+1,ie)});return $.map((ie,et)=>{let Xe=ie.date.toDateString()===Ue,Qe=(f||s)?.toDateString()===ie.date.toDateString();return jsx("button",{type:"button",className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors font-mono",!ie.isCurrent&&(r?"text-white/20":"text-gray-300"),ie.isCurrent&&(r?"text-white":"text-gray-900"),Xe&&"ring-1 ring-[#00C4AE]",Qe&&"bg-[#00C4AE] text-white",!Qe&&(r?"hover:bg-white/10":"hover:bg-gray-100")),onClick:()=>{v(ie.date),k(false);},children:ie.dayNum},et)})})()})]})]})})]}),jsxs("div",{className:"relative",children:[jsx("button",{onClick:q=>{q.stopPropagation(),x(!h),w(false),k(false);},type:"button",className:g("p-1 rounded transition-colors",d?"text-[#00C4AE] bg-[#00C4AE]/20":r?"hover:bg-white/10 text-white/30":"hover:bg-gray-100 text-gray-400"),children:d?jsx("div",{className:"w-4 h-4 rounded-full flex items-center justify-center text-white text-[8px] font-mono font-bold",style:{backgroundColor:a.find(q=>q.id===d)?.color||"#00C4AE"},children:a.find(q=>q.id===d)?.initials||ba(a.find(q=>q.id===d)?.name)}):jsx(User,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:h&&jsxs(motion.div,{initial:{opacity:0,y:i==="up"?-5:5},animate:{opacity:1,y:0},exit:{opacity:0,y:i==="up"?-5:5},className:g("absolute left-0 z-[60] rounded-lg shadow-xl overflow-hidden min-w-[160px] max-h-[200px] overflow-y-auto",D,r?"bg-[#111] border border-white/10":"bg-white border border-gray-200"),onClick:q=>q.stopPropagation(),children:[jsxs("button",{type:"button",onClick:()=>{m(null),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",!d&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:g("w-5 h-5 rounded-full flex items-center justify-center",r?"bg-white/10":"bg-gray-200"),children:jsx(User,{className:"w-3 h-3 text-gray-400"})}),jsx("span",{className:r?"text-white/40":"text-gray-500",children:N?"Sin asignar":"Unassigned"})]}),a.map(q=>jsxs("button",{type:"button",onClick:()=>{m(q.id),x(false);},className:g("w-full flex items-center gap-2 px-3 py-1.5 text-xs transition-colors text-left",r?"hover:bg-white/5":"hover:bg-gray-50",d===q.id&&(r?"bg-white/5":"bg-gray-50")),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-white text-[9px] font-mono font-bold",style:{backgroundColor:q.color||"#00C4AE"},children:q.initials||ba(q.name)}),jsx("span",{className:r?"text-white":"text-gray-900",children:q.name})]},q.id)),a.length===0&&jsx("div",{className:g("px-3 py-2 text-xs font-mono",r?"text-white/30":"text-gray-400"),children:N?"No hay usuarios disponibles":"No users available"})]})})]})]}),jsx("button",{onClick:R,disabled:!c.trim(),type:"button",className:g("px-2.5 py-1 rounded text-xs font-mono font-medium transition-colors",c.trim()?"bg-[#00C4AE] hover:bg-[#00A896] text-white":r?"bg-white/5 text-white/20":"bg-gray-100 text-gray-400"),children:N?"Guardar":"Save"})]})]})}function Hd({columnId:e,onAddCard:t,availableUsers:a=[],className:r,buttonLabel:n,disabled:s=false,theme:o="dark",locale:i="es"}){let[c,l]=useState(false),u=useRef(null),p=useRef(null),[d,m]=useState({}),[f,v]=useState(false),b=o==="dark",h={buttonLabel:n||(i==="es"?"Agregar Tarea":"Add Task")};useEffect(()=>{if(!c||!u.current)return;let y=90,k=()=>{let M=u.current.getBoundingClientRect(),E=window.innerHeight-M.bottom<y+8;v(E),m({position:"fixed",...E?{bottom:window.innerHeight-M.top+4}:{top:M.bottom+4},left:M.left,width:M.width,zIndex:9999});};return k(),window.addEventListener("scroll",k,true),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,true),window.removeEventListener("resize",k);}},[c]),useEffect(()=>{if(!c)return;let y=k=>{let M=k.target;p.current&&!p.current.contains(M)&&u.current&&!u.current.contains(M)&&l(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[c]);let x=useCallback(y=>{t({name:y.name,columnId:e,assigneeIds:y.assigneeId?[y.assigneeId]:void 0,startDate:y.startDate,endDate:y.endDate,priority:y.priority});},[t,e]);return jsxs("div",{ref:u,className:g("asakaa-add-card",r),children:[jsxs("button",{onClick:()=>l(!c),disabled:s,className:"asakaa-add-card__button",type:"button",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),h.buttonLabel]}),createPortal(jsx(AnimatePresence,{children:c&&jsx(motion.div,{ref:p,initial:{opacity:0,y:f?4:-4,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:f?4:-4,scale:.97},transition:{duration:.12},style:d,className:g("rounded-lg shadow-2xl",b?"bg-[#0A0A0A]/95 backdrop-blur-xl border border-white/[0.08] shadow-[0_8px_32px_rgba(0,0,0,0.6)]":"bg-white border border-gray-200 shadow-xl"),children:jsx(Li,{onSubmit:x,onCancel:()=>l(false),availableUsers:a,isDark:b,locale:i,dropdownDirection:"up"})})}),document.body)]})}var Ii=class extends BaseViewAdapter{constructor(a={}){super();this.id="kanban";this.name="Kanban Board";this.version="1.0.0";this.description="";this.icon="";this.supportedExports=["json","csv","pdf","png"];this.root=null;this.description="Interactive Kanban board with drag & drop, filters, and real-time updates",this.icon="\u{1F4CB}",this.kanbanConfig=a,this.options={animations:a.viewOptions?.animations??true,virtualScrolling:a.viewOptions?.virtualScrolling??false,theme:a.viewOptions?.theme??"dark",readonly:a.viewOptions?.readonly??false};}mount(a,r){this.isMounted()&&(console.warn("[KanbanViewAdapter] Already mounted, unmounting first"),this.unmount()),this.container=a,this.data=r,this.root=createRoot(a),this.render(),this.emit("view:mounted",{viewId:this.id,timestamp:Date.now()});}unmount(){this.isMounted()&&(this.emit("view:unmounted",{viewId:this.id,timestamp:Date.now()}),this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.innerHTML="",this.container=null),this.data=null);}update(a){if(!this.isMounted()){console.warn("[KanbanViewAdapter] Not mounted, cannot update");return}this.data=a,this.render(),this.emit("view:updated",{viewId:this.id,data:a});}configure(a){this.options={...this.options,...a},this.isMounted()&&this.render();}async export(a){if(!this.data)throw new Error("No data to export");switch(a){case "json":return JSON.stringify(this.data,null,2);case "csv":return this.exportToCSV();case "pdf":return this.exportToPDF();case "png":return this.exportToPNG();default:throw new Error(`Unsupported export format: ${a}`)}}render(){if(!this.root||!this.data)return;let a={id:this.data.board?.id||"board-1",title:this.data.board?.title||"Untitled Board",columns:this.data.columns,cards:this.data.cards};this.root.render(jsx($o,{board:a,callbacks:this.kanbanConfig.callbacks||{},onCardClick:this.kanbanConfig.onCardClick,renderProps:this.kanbanConfig.renderProps,config:this.kanbanConfig.config,availableUsers:this.kanbanConfig.availableUsers,className:this.kanbanConfig.className,style:this.kanbanConfig.style}));}exportToCSV(){if(!this.data)return "";let a=[["Card ID","Title","Column","Description","Labels","Assignees","Due Date","Position"]];return this.data.cards.forEach(r=>{let n=this.data.columns.find(s=>s.id===r.columnId);a.push([r.id,r.title,n?.title||"",r.description||"",r.labels?.join(", ")||"",r.assignedUserIds?.join(", ")||r.assigneeId||"",r.dueDate?.toString()||"",r.position.toString()]);}),a.map(r=>r.map(n=>`"${n}"`).join(",")).join(`
|
|
19
|
+
`)}async exportToPDF(){throw new Error("PDF export not yet implemented in ViewAdapter")}async exportToPNG(){if(!this.container)throw new Error("View not mounted");let r=await(await import('html2canvas')).default(this.container,{backgroundColor:this.options.theme==="dark"?"#1a1a1a":"#ffffff",scale:2});return new Promise((n,s)=>{r.toBlob(o=>{o?n(o):s(new Error("Failed to create PNG blob"));},"image/png");})}};function Ig(e={}){return new Ii(e)}var Ws=class extends Component{constructor(a){super(a);this.resetError=()=>{this.setState({hasError:false,error:null,errorInfo:null});};this.state={hasError:false,error:null,errorInfo:null};}static getDerivedStateFromError(a){return {hasError:true,error:a}}componentDidCatch(a,r){let{onError:n,componentName:s}=this.props;if(process.env.NODE_ENV==="development"&&(console.error(`Error in ${s||"Component"}:`,a),console.error("Error Info:",r)),this.setState({errorInfo:r}),n)try{n(a,r);}catch(o){console.error("Error in error handler:",o);}}render(){let{hasError:a,error:r}=this.state,{children:n,fallback:s,componentName:o}=this.props;return a&&r?s?s(r,this.resetError):jsx("div",{className:"p-6 rounded-lg border",style:{background:"linear-gradient(135deg, #2d1b1b 0%, #1a1a1a 100%)",borderColor:"rgba(239, 68, 68, 0.3)"},children:jsxs("div",{className:"flex items-start gap-3",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"flex-shrink-0",children:[jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"#EF4444",strokeWidth:"2"}),jsx("path",{d:"M12 8V12",stroke:"#EF4444",strokeWidth:"2",strokeLinecap:"round"}),jsx("circle",{cx:"12",cy:"16",r:"1",fill:"#EF4444"})]}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-lg font-semibold text-red-400 mb-1",children:o?`Error in ${o}`:"Something went wrong"}),jsx("p",{className:"text-sm text-white/70 mb-3",children:r.message||"An unexpected error occurred"}),process.env.NODE_ENV==="development"&&jsxs("details",{className:"mb-3",children:[jsx("summary",{className:"text-xs text-white/50 cursor-pointer hover:text-white/70 mb-2",children:"Error Details (Development Only)"}),jsx("pre",{className:"text-xs text-white/60 bg-black/30 p-3 rounded overflow-auto max-h-48",children:r.stack})]}),jsx("button",{onClick:this.resetError,className:"px-4 py-2 rounded-lg text-sm font-medium transition-all hover:bg-red-600/20 border border-red-500/30",style:{color:"#EF4444"},children:"Try Again"})]})]})}):n}};function Wd(e,t){let a=r=>jsx(Ws,{...t,children:jsx(e,{...r})});return a.displayName=`withErrorBoundary(${e.displayName||e.name||"Component"})`,a}function Ud({board:e,onCreateCard:t,onNavigateToCard:a,onSearch:r,onChangePriority:n,onAssignUser:s,onGeneratePlan:o,onPredictRisks:i,onOpenAIUsage:c,shortcut:l="k",className:u=""}){let[p,d]=useState(false),[m,f]=useState(""),[v,b]=useState("home"),[w,h]=useState(""),[x,y]=useState("");useEffect(()=>{let E=N=>{(N.metaKey||N.ctrlKey)&&N.key===l&&(N.preventDefault(),d(D=>!D)),N.key==="Escape"&&(d(false),b("home"),f(""));};return document.addEventListener("keydown",E),()=>document.removeEventListener("keydown",E)},[l]),useEffect(()=>{p||(b("home"),f(""),h(""),y(""));},[p]);let k=useCallback(()=>{d(false);},[]),M=useCallback(E=>{let[N,D]=E.split(":");switch(N){case "create-card":b("create-card");break;case "create-card-in":h(D||"");break;case "navigate":D?(a?.(D),k()):b("navigate");break;case "search":r?.(m),k();break;case "priority":b("priority");break;case "set-priority":x&&D&&(n?.(x,D),k());break;case "assign":b("assign");break;case "assign-user":x&&D&&(s?.(x,D),k());break;case "ai":b("ai");break;case "ai-generate-plan":o?.(),k();break;case "ai-predict-risks":i?.(),k();break;case "ai-usage":c?.(),k();break;case "back":b("home");break;}},[m,x,t,a,r,n,s,o,i,c,k]),H=useCallback(()=>{w&&m.trim()&&(t?.(w,m.trim()),k());},[w,m,t,k]);return p?jsx(Pa,{children:jsx("div",{className:"command-palette-overlay",onClick:k,children:jsx("div",{className:`command-palette ${u}`,onClick:E=>E.stopPropagation(),children:jsxs(Command,{value:m,onValueChange:f,label:"Command Menu",children:[jsxs("div",{className:"command-palette-header",children:[jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx(Command.Input,{placeholder:v==="create-card"&&w?"Type card title and press Enter...":v==="create-card"?"Select a column first...":"Type a command or search...",className:"command-palette-input",onKeyDown:E=>{E.key==="Enter"&&v==="create-card"&&w&&H();}}),jsxs("div",{className:"command-palette-shortcut",children:[jsx("kbd",{children:navigator.platform.includes("Mac")?"\u2318":"Ctrl"}),jsx("kbd",{children:"K"})]})]}),jsxs(Command.List,{className:"command-palette-list",children:[jsx(Command.Empty,{className:"command-palette-empty",children:"No results found."}),v==="home"&&jsxs(Fragment,{children:[jsxs(Command.Group,{heading:"Actions",className:"command-palette-group",children:[jsxs(Command.Item,{value:"create-card",onSelect:M,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),jsx("path",{d:"M12 8v8m-4-4h8"})]}),jsx("span",{children:"Create Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"C"})]}),jsxs(Command.Item,{value:"navigate",onSelect:M,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"10"}),jsx("polyline",{points:"12 16 16 12 12 8"}),jsx("line",{x1:"8",y1:"12",x2:"16",y2:"12"})]}),jsx("span",{children:"Navigate to Card"}),jsx("div",{className:"command-palette-item-shortcut",children:"G"})]}),jsxs(Command.Item,{value:"search",onSelect:M,className:"command-palette-item",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"11",cy:"11",r:"8"}),jsx("path",{d:"m21 21-4.35-4.35"})]}),jsx("span",{children:"Search Cards"}),jsx("div",{className:"command-palette-item-shortcut",children:"/"})]})]}),jsx(Command.Group,{heading:"AI Features",className:"command-palette-group",children:jsxs(Command.Item,{value:"ai",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"AI Commands"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})}),jsx(Command.Group,{heading:"Cards",className:"command-palette-group",children:e.cards.slice(0,5).map(E=>jsxs(Command.Item,{value:`navigate:${E.id}`,onSelect:M,className:"command-palette-item",children:[jsx("div",{className:"command-palette-item-dot",style:{background:E.priority==="URGENT"?"#EF4444":E.priority==="HIGH"?"#F59E0B":E.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsx("span",{children:E.title}),E.labels&&E.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:E.labels.slice(0,2).map(N=>jsx("span",{className:"command-palette-item-label",children:N},N))})]},E.id))})]}),v==="create-card"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"Select Column",className:"command-palette-group",children:e.columns.map(E=>jsxs(Command.Item,{value:`create-card-in:${E.id}`,onSelect:M,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("rect",{x:"3",y:"3",width:"7",height:"18",rx:"1"})}),jsx("span",{children:E.title}),jsxs("div",{className:"command-palette-item-count",children:[E.cardIds.length," cards"]})]},E.id))})]}),v==="navigate"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsx(Command.Group,{heading:"All Cards",className:"command-palette-group",children:e.cards.map(E=>{let N=e.columns.find(D=>D.id===E.columnId);return jsxs(Command.Item,{value:`navigate:${E.id}`,onSelect:M,className:"command-palette-item",keywords:[E.title,E.description||"",...E.labels||[]],children:[jsx("div",{className:"command-palette-item-dot",style:{background:E.priority==="URGENT"?"#EF4444":E.priority==="HIGH"?"#F59E0B":E.priority==="MEDIUM"?"#00E5CC":"#6B7280"}}),jsxs("div",{className:"command-palette-item-content",children:[jsx("div",{children:E.title}),jsx("div",{className:"command-palette-item-meta",children:N?.title})]}),E.labels&&E.labels.length>0&&jsx("div",{className:"command-palette-item-labels",children:E.labels.slice(0,2).map(D=>jsx("span",{className:"command-palette-item-label",children:D},D))})]},E.id)})})]}),v==="ai"&&jsxs(Fragment,{children:[jsxs(Command.Item,{value:"back",onSelect:M,className:"command-palette-item",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),jsx("span",{children:"Back"})]}),jsxs(Command.Group,{heading:"AI Features",className:"command-palette-group",children:[jsxs(Command.Item,{value:"ai-generate-plan",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z"}),jsx("path",{d:"M2 17L12 22L22 17"}),jsx("path",{d:"M2 12L12 17L22 12"})]}),jsx("span",{children:"Generate Project Plan"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-predict-risks",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),jsx("span",{children:"Predict Risks"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]}),jsxs(Command.Item,{value:"ai-usage",onSelect:M,className:"command-palette-item command-palette-item-ai",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),jsx("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),jsx("span",{children:"AI Usage & Costs"}),jsx("div",{className:"command-palette-item-badge",children:"AI"})]})]})]})]}),jsxs("div",{className:"command-palette-footer",children:[jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"\u2191"}),jsx("kbd",{children:"\u2193"}),jsx("span",{children:"Navigate"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Enter"}),jsx("span",{children:"Select"})]}),jsxs("div",{className:"command-palette-footer-hint",children:[jsx("kbd",{children:"Esc"}),jsx("span",{children:"Close"})]})]})]})})})}):null}function $g(e,t,a,r,n){let s=document.getElementById("attachment-lightbox-native");s&&s.remove();let o=document.createElement("div");o.id="attachment-lightbox-native",o.className="attachment-lightbox",o.style.cssText=`
|
|
20
20
|
position: fixed !important;
|
|
21
21
|
inset: 0 !important;
|
|
22
22
|
z-index: 2147483647 !important;
|
|
@@ -30,7 +30,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
30
30
|
max-height: 92vh !important;
|
|
31
31
|
object-fit: contain !important;
|
|
32
32
|
cursor: default !important;
|
|
33
|
-
`,i.onclick=
|
|
33
|
+
`,i.onclick=p=>p.stopPropagation();let c=document.createElement("div");c.className="attachment-lightbox-hint",c.textContent="Click anywhere or press ESC to close",c.style.cssText=`
|
|
34
34
|
position: absolute !important;
|
|
35
35
|
bottom: 24px !important;
|
|
36
36
|
left: 50% !important;
|
|
@@ -38,7 +38,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
38
38
|
font-size: 12px !important;
|
|
39
39
|
color: rgba(255, 255, 255, 0.4) !important;
|
|
40
40
|
pointer-events: none !important;
|
|
41
|
-
`;let l=()=>{o.remove(),document.removeEventListener("keydown",
|
|
41
|
+
`;let l=()=>{o.remove(),document.removeEventListener("keydown",u);},u=p=>{if(p.key==="Escape")l();else if(p.key==="ArrowLeft"&&a.length>1){let d=r>0?r-1:a.length-1;l(),n(d);}else if(p.key==="ArrowRight"&&a.length>1){let d=r<a.length-1?r+1:0;l(),n(d);}};if(o.onclick=l,document.addEventListener("keydown",u),a.length>1){let p=document.createElement("div");p.className="attachment-lightbox-dots",p.style.cssText=`
|
|
42
42
|
position: absolute !important;
|
|
43
43
|
bottom: 48px !important;
|
|
44
44
|
left: 50% !important;
|
|
@@ -48,7 +48,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
48
48
|
padding: 8px 12px !important;
|
|
49
49
|
background: rgba(0, 0, 0, 0.4) !important;
|
|
50
50
|
border-radius: 20px !important;
|
|
51
|
-
`,
|
|
51
|
+
`,p.onclick=f=>f.stopPropagation(),a.forEach((f,v)=>{let b=document.createElement("button");b.className=`attachment-lightbox-dot ${v===r?"active":""}`,b.style.cssText=`
|
|
52
52
|
width: 8px !important;
|
|
53
53
|
height: 8px !important;
|
|
54
54
|
border-radius: 50% !important;
|
|
@@ -56,7 +56,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
56
56
|
border: none !important;
|
|
57
57
|
padding: 0 !important;
|
|
58
58
|
cursor: pointer !important;
|
|
59
|
-
`,b.onclick=
|
|
59
|
+
`,b.onclick=w=>{w.stopPropagation(),l(),n(v);},p.appendChild(b);});let d=document.createElement("button");d.className="attachment-lightbox-nav-area attachment-lightbox-nav-prev",d.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M15 18L9 12L15 6" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',d.style.cssText=`
|
|
60
60
|
position: absolute !important;
|
|
61
61
|
left: 0 !important;
|
|
62
62
|
top: 0 !important;
|
|
@@ -82,7 +82,7 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
82
82
|
border: none !important;
|
|
83
83
|
cursor: pointer !important;
|
|
84
84
|
opacity: 0.5 !important;
|
|
85
|
-
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let v=r<a.length-1?r+1:0;l(),n(v);},o.appendChild(u),o.appendChild(d),o.appendChild(m);}o.appendChild(i),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function cx(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function dx(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Xc(e){return e.startsWith("image/")}function ps({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10}){let[o,i]=useState(false),[c,l]=useState(false),[p,u]=useState(null),d=useRef(null),m=useRef(e);m.current=e;let f=useCallback((T,D)=>{D.preventDefault(),D.stopPropagation();let M=m.current.filter($=>Xc($.type)),N=M.findIndex($=>$.id===T.id),z=$=>{let Y=m.current.filter(Se=>Xc(Se.type)),A=Y[$];A&&vm(A.url,A.name,Y,$,z);};vm(T.url,T.name,M,N,z);},[]),v=useCallback(T=>{let D=[],M=[];return e.length+T.length>s?(M.push(`Maximum ${s} files allowed`),{valid:D,errors:M}):(T.forEach(N=>{if(N.size/1048576>r){M.push(`${N.name} is too large (max ${r}MB)`);return}if(n&&!n.some($=>N.type.match($))){M.push(`${N.name} has invalid file type`);return}D.push(N);}),{valid:D,errors:M})},[e.length,s,r,n]),b=useCallback(async T=>{let{valid:D,errors:M}=v(T);if(M.length>0){u(M.join(", ")),setTimeout(()=>u(null),5e3);return}if(D.length!==0){l(true),u(null);try{await t?.(D);}catch(N){u(N instanceof Error?N.message:"Upload failed"),setTimeout(()=>u(null),5e3);}finally{l(false);}}},[v,t]),h=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(true);},[]),y=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);},[]),x=useCallback(T=>{T.preventDefault(),T.stopPropagation();},[]),w=useCallback(T=>{T.preventDefault(),T.stopPropagation(),i(false);let D=Array.from(T.dataTransfer.files);b(D);},[b]),C=useCallback(T=>{let D=T.target.files?Array.from(T.target.files):[];b(D),d.current&&(d.current.value="");},[b]),P=useCallback(()=>{d.current?.click();},[]),O=useCallback(T=>{confirm("Are you sure you want to delete this attachment?")&&a?.(T);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${o?"dragging":""} ${c?"uploading":""}`,onDragEnter:h,onDragLeave:y,onDragOver:x,onDrop:w,onClick:P,children:[jsx("input",{ref:d,type:"file",multiple:true,onChange:C,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:c?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:o?"Drop files here":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:["Max ",r,"MB \u2022 ",e.length,"/",s," files"]})]})})]}),p&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:p})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(T=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Xc(T.type)&&T.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:D=>f(T,D),title:"Click to view full size",children:[jsx("img",{src:T.thumbnailUrl||T.url,alt:T.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:dx(T.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:T.name,children:T.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:cx(T.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(T.uploadedAt).toLocaleDateString()})]})]}),jsx("button",{onClick:()=>O(T.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},T.id))})]})}function yx({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function Qc({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(yx,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,i)=>o+i.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,i)=>o+i.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,i)=>o+(i.planned||0),0)})]})]})]})}function Sx({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function Zc({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,l=o<=i;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Sx,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var Bx={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Em=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function $x({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,i=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function Mm({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function ed({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((c,l)=>c+l.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||Bx[c.name]||Em[e.indexOf(c)%Em.length]})),i=o.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?$x:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(Mm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let p=l.payload,u=s>0?(p.value/s*100).toFixed(0):"0";return `${c} (${p.value} - ${u}%)`}})]}):jsxs(BarChart$1,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Mm,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var cl=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,i]=useState(false),[c,l]=useState(false),[p,u]=useState(false),[d,m]=useState(false);if(e.length===0)return null;let f=e.map(w=>w.id),v=w=>{r.onBulkUpdate?.(f,{priority:w}),i(false);},b=w=>{r.onBulkMove?.(f,w),l(false),a();},h=w=>{r.onBulkUpdate?.(f,{assignedUserIds:w}),u(false);},y=w=>{let C=new Set;e.forEach(O=>{O.labels?.forEach(T=>C.add(T));});let P=Array.from(new Set([...C,...w]));r.onBulkUpdate?.(f,{labels:P}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(w),children:[jsx("span",{className:g("asakaa-priority-dot",w==="LOW"&&"bg-asakaa-priority-low",w==="MEDIUM"&&"bg-asakaa-priority-medium",w==="HIGH"&&"bg-asakaa-priority-high",w==="URGENT"&&"bg-asakaa-priority-urgent")}),w]},w))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(w.id),children:w.title},w.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>u(!p),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),p&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(w=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([w.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:w.color},children:w.initials}),w.name]},w.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(w=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>y([w]),children:w},w))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});cl.displayName="BulkOperationsToolbar";function zx(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,i,c,l;switch(t){case "assignee":let p=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);p.length>0?p.forEach(m=>{let f=a?.find(v=>v.id===m);o=`assignee-${m}`,i=f?.name||`User ${m}`,c=f?.color,l=f?.avatar,r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c,icon:l}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];i=d.title,c=d.color,r.has(o)||r.set(o,{id:o,title:i,groupValue:s,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,i=m,c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);}):(o="label-none",i="No Labels",c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function td({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:i,config:c,onCardClick:l,suppressDetailModal:p,availableTags:u,attachmentsByCard:d,renderColumnMetrics:m}){let[f,v]=useState(()=>{let x=new Set;if(s)for(let w of s)w.isCollapsed&&x.add(w.id);return x}),b=useMemo(()=>s||zx(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),h={callbacks:r,availableUsers:a,renderProps:i,config:c,onCardClick:l,suppressDetailModal:p,availableTags:u,attachmentsByCard:d,renderColumnMetrics:m},y=useCallback(x=>{v(w=>{let C=new Set(w);return C.has(x)?C.delete(x):C.add(x),C});},[]);return !s&&(t.groupBy==="none"||b.length===0)?jsx(lo,{board:e,className:n,...h}):jsxs("div",{className:g("asakaa-swimlane-view",n),children:[b.map(x=>{let w=f.has(x.id),C=e.cards.filter(O=>x.cardIds.includes(O.id)),P={...e,cards:C};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:x,isCollapsed:w,cardCount:x.cardIds.length,onToggleCollapse:()=>y(x.id)}):jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&y(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":w?"Expand lane":"Collapse lane",children:w?"\u25B6":"\u25BC"})]}),!w&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx(lo,{board:P,...h})})]},x.id)}),b.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var ad=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function rd({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),i=ad.find(l=>l.value===e)||ad[0];useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&o.current&&!o.current.contains(p.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),n(false);};return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:ad.map(l=>jsxs("button",{onClick:()=>c(l.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var ni=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function jx(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,i=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&i&&c}function Im(e={}){let{shortcuts:t=ni,enabled:a=true,preventDefault:r=true}=e,n=useRef(t),s=useRef(a);useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=useCallback(c=>{n.current=[...n.current,c];},[]),i=useCallback(c=>{n.current=n.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let p=l.target;if(!((p.tagName==="INPUT"||p.tagName==="TEXTAREA"||p.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let u of n.current)if(jx(l,u)){r&&l.preventDefault();let d=new CustomEvent("keyboard-action",{detail:u.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:o,unregisterShortcut:i,isEnabled:a}}function Kx(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function qx(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Yx(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=qx(e),r=t?Kx(t):"";return a?`${a} + ${r}`:r}function Xx(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function nd({shortcuts:e=ni,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!n||!t)return null;let o=Xx(e);return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Yx(l)})]},l.action))})]},i))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var od=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
85
|
+
`,m.onmouseenter=()=>{m.style.opacity="1";},m.onmouseleave=()=>{m.style.opacity="0.5";},m.onclick=f=>{f.stopPropagation();let v=r<a.length-1?r+1:0;l(),n(v);},o.appendChild(p),o.appendChild(d),o.appendChild(m);}o.appendChild(i),o.appendChild(c),document.body.appendChild(o),setTimeout(()=>{c.style.transition="opacity 0.5s ease",c.style.opacity="0";},2e3);}function Ov(e){if(e===0)return "0 Bytes";let t=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,r)*100)/100+" "+a[r]}function Hv(e){return e.startsWith("image/")?"\u{1F5BC}\uFE0F":e.startsWith("video/")?"\u{1F3A5}":e.startsWith("audio/")?"\u{1F3B5}":e.includes("pdf")?"\u{1F4C4}":e.includes("word")||e.includes("document")?"\u{1F4DD}":e.includes("sheet")||e.includes("excel")?"\u{1F4CA}":e.includes("presentation")||e.includes("powerpoint")?"\u{1F4FD}\uFE0F":e.includes("zip")||e.includes("rar")||e.includes("compressed")?"\u{1F5DC}\uFE0F":e.includes("text")?"\u{1F4C3}":"\u{1F4CE}"}function Vd(e){return e.startsWith("image/")}function zs({attachments:e=[],onUpload:t,onDelete:a,maxSizeMB:r=10,allowedTypes:n,maxFiles:s=10,locale:o="en"}){let i=o==="es",[c,l]=useState(false),[u,p]=useState(false),[d,m]=useState(null),f=useRef(null),v=useRef(e);v.current=e;let b=useCallback((D,S)=>{S.preventDefault(),S.stopPropagation();let V=v.current.filter(A=>Vd(A.type)),W=V.findIndex(A=>A.id===D.id),R=A=>{let ve=v.current.filter(le=>Vd(le.type)),q=ve[A];q&&$g(q.url,q.name,ve,A,R);};$g(D.url,D.name,V,W,R);},[]),w=useCallback(D=>{let S=[],V=[];return e.length+D.length>s?(V.push(i?`M\xE1ximo ${s} archivos`:`Maximum ${s} files allowed`),{valid:S,errors:V}):(D.forEach(W=>{if(W.size/1048576>r){V.push(i?`${W.name} es demasiado grande (m\xE1x. ${r} MB)`:`${W.name} is too large (max ${r}MB)`);return}if(n&&!n.some(A=>W.type.match(A))){V.push(`${W.name} has invalid file type`);return}S.push(W);}),{valid:S,errors:V})},[e.length,s,r,n]),h=useCallback(async D=>{let{valid:S,errors:V}=w(D);if(V.length>0){m(V.join(", ")),setTimeout(()=>m(null),5e3);return}if(S.length!==0){p(true),m(null);try{await t?.(S);}catch(W){m(W instanceof Error?W.message:i?"No se pudo subir":"Upload failed"),setTimeout(()=>m(null),5e3);}finally{p(false);}}},[w,t]),x=useCallback(D=>{D.preventDefault(),D.stopPropagation(),l(true);},[]),y=useCallback(D=>{D.preventDefault(),D.stopPropagation(),l(false);},[]),k=useCallback(D=>{D.preventDefault(),D.stopPropagation();},[]),M=useCallback(D=>{D.preventDefault(),D.stopPropagation(),l(false);let S=Array.from(D.dataTransfer.files);h(S);},[h]),H=useCallback(D=>{let S=D.target.files?Array.from(D.target.files):[];h(S),f.current&&(f.current.value="");},[h]),E=useCallback(()=>{f.current?.click();},[]),N=useCallback(D=>{confirm(i?"\xBFEliminar este adjunto?":"Are you sure you want to delete this attachment?")&&a?.(D);},[a]);return jsxs("div",{className:"attachment-uploader",children:[jsxs("div",{className:`attachment-dropzone ${c?"dragging":""} ${u?"uploading":""}`,onDragEnter:x,onDragLeave:y,onDragOver:k,onDrop:M,onClick:E,children:[jsx("input",{ref:f,type:"file",multiple:true,onChange:H,style:{display:"none"},accept:n?.join(",")}),jsx("div",{className:"attachment-dropzone-content",children:u?jsxs(Fragment,{children:[jsx("div",{className:"attachment-spinner"}),jsx("p",{className:"attachment-dropzone-text",children:i?"Subiendo\u2026":"Uploading..."})]}):jsxs(Fragment,{children:[jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"attachment-dropzone-icon",children:[jsx("path",{d:"M21 15V19C21 19.5304 20.7893 20.0391 20.4142 20.4142C20.0391 20.7893 19.5304 21 19 21H5C4.46957 21 3.96086 20.7893 3.58579 20.4142C3.21071 20.0391 3 19.5304 3 19V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M17 8L12 3L7 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M12 3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),jsx("p",{className:"attachment-dropzone-text",children:c?i?"Suelta los archivos aqu\xED":"Drop files here":i?"Arrastra archivos aqu\xED":"Drag & drop files here"}),jsx("p",{className:"attachment-dropzone-subtext",children:i?"o haz clic para elegirlos":"or click to browse"}),jsxs("p",{className:"attachment-dropzone-info",children:[i?"M\xE1x.":"Max"," ",r,"MB \u2022 ",e.length,"/",s," ",i?"archivos":"files"]})]})})]}),d&&jsxs("div",{className:"attachment-error",children:[jsx("span",{className:"attachment-error-icon",children:"\u26A0\uFE0F"}),jsx("span",{className:"attachment-error-text",children:d})]}),e.length>0&&jsx("div",{className:"attachment-list",children:e.map(D=>jsxs("div",{className:"attachment-item",children:[jsx("div",{className:"attachment-preview",children:Vd(D.type)&&D.url?jsxs("button",{type:"button",className:"attachment-thumbnail-btn",onClick:S=>b(D,S),title:"Click to view full size",children:[jsx("img",{src:D.thumbnailUrl||D.url,alt:D.name,className:"attachment-thumbnail"}),jsx("div",{className:"attachment-thumbnail-overlay",children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M15 3H21V9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M9 21H3V15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M21 3L14 10",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M3 21L10 14",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})})]}):jsx("div",{className:"attachment-icon",children:Hv(D.type)})}),jsxs("div",{className:"attachment-info",children:[jsx("a",{href:D.url,target:"_blank",rel:"noopener noreferrer",className:"attachment-name",title:D.name,children:D.name}),jsxs("div",{className:"attachment-meta",children:[jsx("span",{className:"attachment-size",children:Ov(D.size)}),jsx("span",{className:"attachment-separator",children:"\u2022"}),jsx("span",{className:"attachment-date",children:new Date(D.uploadedAt).toLocaleDateString(i?"es-CO":"en-US")})]})]}),jsx("button",{onClick:()=>N(D.id),className:"attachment-delete",title:"Delete attachment",type:"button",children:jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]},D.id))})]})}function Kv({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.period}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," cards"]},r))]})}function _d({data:e,title:t="Team Velocity",height:a=300,showAverage:r=true,showPlanned:n=true}){let s=e.map(o=>({...o,average:o.average??e.reduce((i,c)=>i+c.completed,0)/e.length}));return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(LineChart,{data:s,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"period",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(Kv,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Line,{type:"monotone",dataKey:"completed",stroke:"#10B981",strokeWidth:3,name:"Completed",dot:{fill:"#10B981",r:5},activeDot:{r:7}}),n&&jsx(Line,{type:"monotone",dataKey:"planned",stroke:"#00E5CC",strokeWidth:2,strokeDasharray:"5 5",name:"Planned",dot:{fill:"#00E5CC",r:4}}),r&&jsx(Line,{type:"monotone",dataKey:"average",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"3 3",name:"Average",dot:false})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Completed"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.reduce((o,i)=>o+i.completed,0)})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Average Velocity"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:(e.reduce((o,i)=>o+i.completed,0)/e.length).toFixed(1)})]}),n&&e.some(o=>o.planned)&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Planned"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:e.reduce((o,i)=>o+(i.planned||0),0)})]})]})]})}function aw({active:e,payload:t}){return !e||!t||!t.length?null:jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:t[0].payload.day}),t.map((a,r)=>jsxs("p",{className:"chart-tooltip-value",style:{color:a.color},children:[a.name,": ",jsx("strong",{children:a.value})," tasks"]},r))]})}function Kd({data:e,title:t="Sprint Burndown",height:a=300,totalTasks:r,useArea:n=false}){let s=r??(e[0]?.ideal||e[0]?.remaining||0),o=e[e.length-1]?.remaining||0,i=e[e.length-1]?.ideal||0,c=s>0?(s-o)/s*100:0,l=o<=i;return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:a,children:jsxs(n?AreaChart:LineChart,{data:e,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"day",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(aw,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),n?jsxs(Fragment,{children:[jsx(Area,{type:"monotone",dataKey:"ideal",stroke:"#F59E0B",fill:"rgba(245, 158, 11, 0.2)",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal"}),jsx(Area,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",fill:l?"rgba(16, 185, 129, 0.2)":"rgba(239, 68, 68, 0.2)",strokeWidth:3,name:"Remaining"})]}):jsxs(Fragment,{children:[jsx(Line,{type:"linear",dataKey:"ideal",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",name:"Ideal",dot:{fill:"#F59E0B",r:4}}),jsx(Line,{type:"monotone",dataKey:"remaining",stroke:l?"#10B981":"#EF4444",strokeWidth:3,name:"Remaining",dot:{fill:l?"#10B981":"#EF4444",r:5},activeDot:{r:7}})]})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Progress"}),jsxs("span",{className:"chart-stat-value",style:{color:c>=50?"#10B981":"#F59E0B"},children:[c.toFixed(0),"%"]})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Remaining"}),jsx("span",{className:"chart-stat-value",style:{color:l?"#10B981":"#EF4444"},children:o})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Status"}),jsx("span",{className:"chart-stat-badge",style:{background:l?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:l?"#10B981":"#EF4444"},children:l?"\u2713 On Track":"\u26A0 Behind"})]})]})]})}var uw={URGENT:"#EF4444",HIGH:"#F59E0B",MEDIUM:"#00E5CC",LOW:"#10B981"},Gg=["#00E5CC","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899"];function pw({cx:e,cy:t,midAngle:a,innerRadius:r,outerRadius:n,percent:s}){let o=r+(n-r)*.5,i=e+o*Math.cos(-a*(Math.PI/180)),c=t+o*Math.sin(-a*(Math.PI/180));return s<.05?null:jsx("text",{x:i,y:c,fill:"white",textAnchor:i>e?"start":"end",dominantBaseline:"central",style:{fontSize:"12px",fontWeight:600},children:`${(s*100).toFixed(0)}%`})}function _g({active:e,payload:t}){if(!e||!t||!t.length)return null;let a=t[0].payload,r=t[0].payload.totalValue||0,n=r>0?(a.value/r*100).toFixed(1):"0";return jsxs("div",{className:"chart-tooltip",children:[jsx("p",{className:"chart-tooltip-label",children:a.name}),jsxs("p",{className:"chart-tooltip-value",style:{color:a.color||t[0].color},children:["Count: ",jsx("strong",{children:a.value})]}),jsxs("p",{className:"chart-tooltip-value",style:{color:"rgba(255, 255, 255, 0.7)"},children:["Percentage: ",jsxs("strong",{children:[n,"%"]})]})]})}function qd({data:e,title:t="Distribution",type:a="pie",height:r=300,showPercentages:n=true}){let s=e.reduce((c,l)=>c+l.value,0),o=e.map(c=>({...c,totalValue:s,color:c.color||uw[c.name]||Gg[e.indexOf(c)%Gg.length]})),i=o.map(c=>c.color);return jsxs("div",{className:"chart-container",children:[t&&jsx("h3",{className:"chart-title",children:t}),jsx(ResponsiveContainer,{width:"100%",height:r,children:a==="pie"?jsxs(PieChart,{children:[jsx(Pie,{data:o,cx:"50%",cy:"50%",labelLine:false,label:n?pw:false,outerRadius:r*.35,fill:"#8884d8",dataKey:"value",children:o.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))}),jsx(Tooltip,{content:jsx(_g,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"},formatter:(c,l)=>{let u=l.payload,p=s>0?(u.value/s*100).toFixed(0):"0";return `${c} (${u.value} - ${p}%)`}})]}):jsxs(BarChart$1,{data:o,margin:{top:5,right:30,left:20,bottom:5},children:[jsx(CartesianGrid,{strokeDasharray:"3 3",stroke:"rgba(255, 255, 255, 0.1)"}),jsx(XAxis,{dataKey:"name",stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(YAxis,{stroke:"rgba(255, 255, 255, 0.5)",style:{fontSize:"12px"}}),jsx(Tooltip,{content:jsx(_g,{})}),jsx(Legend,{wrapperStyle:{fontSize:"12px",color:"rgba(255, 255, 255, 0.7)"}}),jsx(Bar,{dataKey:"value",name:"Count",radius:[8,8,0,0],children:o.map((c,l)=>jsx(Cell,{fill:i[l]},`cell-${l}`))})]})}),jsxs("div",{className:"chart-stats",children:[jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Total Cards"}),jsx("span",{className:"chart-stat-value",style:{color:"#00E5CC"},children:s})]}),jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Categories"}),jsx("span",{className:"chart-stat-value",style:{color:"#10B981"},children:e.length})]}),e.length>0&&jsxs("div",{className:"chart-stat",children:[jsx("span",{className:"chart-stat-label",children:"Largest Category"}),jsx("span",{className:"chart-stat-value",style:{color:"#F59E0B"},children:e.reduce((c,l)=>l.value>c.value?l:c).name})]})]})]})}var Kl=memo(({selectedCards:e,availableUsers:t=[],onClearSelection:a,callbacks:r,columns:n=[],availableLabels:s=[]})=>{let[o,i]=useState(false),[c,l]=useState(false),[u,p]=useState(false),[d,m]=useState(false);if(e.length===0)return null;let f=e.map(y=>y.id),v=y=>{r.onBulkUpdate?.(f,{priority:y}),i(false);},b=y=>{r.onBulkMove?.(f,y),l(false),a();},w=y=>{r.onBulkUpdate?.(f,{assignedUserIds:y}),p(false);},h=y=>{let k=new Set;e.forEach(H=>{H.labels?.forEach(E=>k.add(E));});let M=Array.from(new Set([...k,...y]));r.onBulkUpdate?.(f,{labels:M}),m(false);},x=()=>{confirm(`Delete ${e.length} card(s)? This cannot be undone.`)&&(r.onBulkDelete?.(f),a());};return jsx("div",{className:"asakaa-bulk-toolbar",children:jsxs("div",{className:"asakaa-bulk-toolbar-content",children:[jsxs("div",{className:"asakaa-bulk-toolbar-count",children:[e.length," card",e.length!==1?"s":""," selected"]}),jsxs("div",{className:"asakaa-bulk-toolbar-actions",children:[jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>i(!o),title:"Update priority",children:jsx("span",{className:"text-sm",children:"Priority"})}),o&&jsx("div",{className:"asakaa-bulk-menu",children:["LOW","MEDIUM","HIGH","URGENT"].map(y=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>v(y),children:[jsx("span",{className:g("asakaa-priority-dot",y==="LOW"&&"bg-asakaa-priority-low",y==="MEDIUM"&&"bg-asakaa-priority-medium",y==="HIGH"&&"bg-asakaa-priority-high",y==="URGENT"&&"bg-asakaa-priority-urgent")}),y]},y))})]}),n.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>l(!c),title:"Move to column",children:jsx("span",{className:"text-sm",children:"Move"})}),c&&jsx("div",{className:"asakaa-bulk-menu",children:n.map(y=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>b(y.id),children:y.title},y.id))})]}),t.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>p(!u),title:"Assign users",children:jsx("span",{className:"text-sm",children:"Assign"})}),u&&jsx("div",{className:"asakaa-bulk-menu",children:t.map(y=>jsxs("button",{className:"asakaa-bulk-menu-item",onClick:()=>w([y.id]),children:[jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-xs font-medium",style:{backgroundColor:y.color},children:y.initials}),y.name]},y.id))})]}),s.length>0&&jsxs("div",{className:"relative",children:[jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:()=>m(!d),title:"Add labels",children:jsx("span",{className:"text-sm",children:"Labels"})}),d&&jsx("div",{className:"asakaa-bulk-menu",children:s.map(y=>jsx("button",{className:"asakaa-bulk-menu-item",onClick:()=>h([y]),children:y},y))})]}),jsx("button",{className:"asakaa-bulk-toolbar-button asakaa-bulk-toolbar-button-danger",onClick:x,title:"Delete selected cards",children:jsx("span",{className:"text-sm",children:"Delete"})}),jsx("button",{className:"asakaa-bulk-toolbar-button",onClick:a,title:"Clear selection",children:jsx("span",{className:"text-sm",children:"\u2715"})})]})]})})});Kl.displayName="BulkOperationsToolbar";function hw(e,t,a){if(t==="none")return [];let r=new Map;return e.forEach(n=>{let s,o,i,c,l;switch(t){case "assignee":let u=n.assignedUserIds||(n.assigneeId?[n.assigneeId]:[]);u.length>0?u.forEach(m=>{let f=a?.find(v=>v.id===m);o=`assignee-${m}`,i=f?.name||`User ${m}`,c=f?.color,l=f?.avatar,r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c,icon:l}),r.get(o).cardIds.push(n.id);}):(o="assignee-unassigned",i="Unassigned",c="#6b7280",l="\u{1F464}",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c,icon:l}),r.get(o).cardIds.push(n.id));break;case "priority":s=n.priority||"NONE",o=`priority-${s}`;let d={URGENT:{title:"\u{1F534} Urgent",color:"#ef4444"},HIGH:{title:"\u{1F7E0} High",color:"#f97316"},MEDIUM:{title:"\u{1F7E1} Medium",color:"#eab308"},LOW:{title:"\u{1F7E2} Low",color:"#22c55e"},NONE:{title:"\u26AA No Priority",color:"#6b7280"}}[s];i=d.title,c=d.color,r.has(o)||r.set(o,{id:o,title:i,groupValue:s,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);break;case "label":n.labels&&n.labels.length>0?n.labels.forEach(m=>{o=`label-${m}`,i=m,c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:m,cardIds:[],color:c}),r.get(o).cardIds.push(n.id);}):(o="label-none",i="No Labels",c="#6b7280",r.has(o)||r.set(o,{id:o,title:i,groupValue:null,cardIds:[],color:c}),r.get(o).cardIds.push(n.id));break}}),Array.from(r.values()).sort((n,s)=>n.title.localeCompare(s.title))}function Yd({board:e,swimlaneConfig:t,availableUsers:a,callbacks:r,className:n,swimlanes:s,renderSwimlaneHeader:o,renderProps:i,config:c,onCardClick:l,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m}){let[f,v]=useState(()=>{let x=new Set;if(s)for(let y of s)y.isCollapsed&&x.add(y.id);return x}),b=useMemo(()=>s||hw(e.cards,t.groupBy,a),[s,e.cards,t.groupBy,a]),w={callbacks:r,availableUsers:a,renderProps:i,config:c,onCardClick:l,suppressDetailModal:u,availableTags:p,attachmentsByCard:d,renderColumnMetrics:m},h=useCallback(x=>{v(y=>{let k=new Set(y);return k.has(x)?k.delete(x):k.add(x),k});},[]);return !s&&(t.groupBy==="none"||b.length===0)?jsx($o,{board:e,className:n,...w}):jsxs("div",{className:g("asakaa-swimlane-view",n),children:[b.map(x=>{let y=f.has(x.id),k=e.cards.filter(H=>x.cardIds.includes(H.id)),M={...e,cards:k};return jsxs("div",{className:"asakaa-swimlane mb-6 rounded-lg border border-white/10 overflow-hidden",children:[o?o({lane:x,isCollapsed:y,cardCount:x.cardIds.length,onToggleCollapse:()=>h(x.id)}):jsxs("div",{className:"asakaa-swimlane-header px-4 py-3 bg-white/5 backdrop-blur-sm flex items-center justify-between cursor-pointer hover:bg-white/10 transition-colors",onClick:()=>t.collapsible&&h(x.id),style:{borderLeft:x.color?`4px solid ${x.color}`:void 0},children:[jsxs("div",{className:"flex items-center gap-3",children:[x.icon&&jsx("span",{className:"text-2xl leading-none",children:x.icon}),jsx("h3",{className:"text-lg font-semibold",style:{color:x.color},children:x.title}),jsxs("span",{className:"text-sm text-white/50 font-medium",children:["(",x.cardIds.length," ",x.cardIds.length===1?"card":"cards",")"]})]}),t.collapsible&&jsx("button",{className:"text-white/50 hover:text-white transition-colors","aria-label":y?"Expand lane":"Collapse lane",children:y?"\u25B6":"\u25BC"})]}),!y&&jsx("div",{className:"asakaa-swimlane-content p-4",children:jsx($o,{board:M,...w})})]},x.id)}),b.length===0&&jsxs("div",{className:"text-center py-12 text-white/50",children:[jsx("p",{className:"text-lg",children:"No cards to display"}),jsx("p",{className:"text-sm mt-2",children:"Cards will appear here when they match the grouping criteria"})]})]})}var Xd=[{value:"none",label:"No Grouping",icon:"\u{1F4CB}",description:"Standard Kanban board view"},{value:"assignee",label:"By Assignee",icon:"\u{1F465}",description:"Group cards by assigned user"},{value:"priority",label:"By Priority",icon:"\u{1F3AF}",description:"Group cards by priority level"},{value:"label",label:"By Label",icon:"\u{1F3F7}\uFE0F",description:"Group cards by label/tag"}];function Jd({value:e,onChange:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null),i=Xd.find(l=>l.value===e)||Xd[0];useEffect(()=>{function l(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let c=l=>{t(l),n(false);};return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-white/10 hover:bg-white/15 border border-white/20 transition-all text-sm font-medium text-white/90",children:[jsx("span",{className:"text-base leading-none",children:i.icon}),jsx("span",{children:i.label}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[280px] rounded-lg bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl border border-white/20 shadow-2xl z-50 overflow-hidden",children:[jsx("div",{className:"px-3 py-2 border-b border-white/10",children:jsx("span",{className:"text-[10px] font-bold text-white/70 uppercase tracking-wider",children:"Group By"})}),jsx("div",{className:"py-1",children:Xd.map(l=>jsxs("button",{onClick:()=>c(l.value),className:g("w-full px-3 py-2 flex items-start gap-3 text-left transition-all hover:bg-white/10",e===l.value&&"bg-white/5"),children:[jsx("span",{className:"text-xl leading-none mt-0.5",children:l.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"font-semibold text-sm text-white",children:l.label}),e===l.value&&jsx("span",{className:"text-[#00E5CC] text-xs",children:"\u2713"})]}),jsx("p",{className:"text-xs text-white/60 mt-0.5",children:l.description})]})]},l.value))})]})]})}var Bi=[{keys:"ArrowUp",action:"navigate_up",description:"Navigate to card above"},{keys:"ArrowDown",action:"navigate_down",description:"Navigate to card below"},{keys:"ArrowLeft",action:"navigate_left",description:"Navigate to previous column"},{keys:"ArrowRight",action:"navigate_right",description:"Navigate to next column"},{keys:"Enter",action:"open_card",description:"Open selected card"},{keys:"Escape",action:"close_modal",description:"Close modal or dialog"},{keys:"Delete",action:"delete_card",description:"Delete selected card",modifiers:{shift:true}},{keys:"n",action:"new_card",description:"Create new card",modifiers:{ctrl:true}},{keys:"k",action:"search",description:"Open search/command palette",modifiers:{ctrl:true}},{keys:"s",action:"save",description:"Save changes",modifiers:{ctrl:true}},{keys:"z",action:"undo",description:"Undo last action",modifiers:{ctrl:true}},{keys:"y",action:"redo",description:"Redo last undone action",modifiers:{ctrl:true}},{keys:"a",action:"select_all",description:"Select all cards",modifiers:{ctrl:true}},{keys:"Escape",action:"deselect_all",description:"Deselect all cards"},{keys:"?",action:"show_shortcuts",description:"Show keyboard shortcuts help",modifiers:{shift:true}}];function vw(e,t){if(!(Array.isArray(t.keys)?t.keys:[t.keys]).some(l=>e.key===l||e.code===l))return false;let n=t.modifiers||{},s=n.ctrl?e.ctrlKey||e.metaKey:!e.ctrlKey&&!e.metaKey,o=n.shift?e.shiftKey:!e.shiftKey,i=n.alt?e.altKey:!e.altKey,c=n.meta?e.metaKey:true;return s&&o&&i&&c}function Jg(e={}){let{shortcuts:t=Bi,enabled:a=true,preventDefault:r=true}=e,n=useRef(t),s=useRef(a);useEffect(()=>{n.current=t,s.current=a;},[t,a]);let o=useCallback(c=>{n.current=[...n.current,c];},[]),i=useCallback(c=>{n.current=n.current.filter(l=>l.action!==c);},[]);return useEffect(()=>{function c(l){if(!s.current)return;let u=l.target;if(!((u.tagName==="INPUT"||u.tagName==="TEXTAREA"||u.isContentEditable)&&l.key!=="Escape"&&!l.ctrlKey&&!l.metaKey)){for(let p of n.current)if(vw(l,p)){r&&l.preventDefault();let d=new CustomEvent("keyboard-action",{detail:p.action,bubbles:true,cancelable:true});window.dispatchEvent(d);break}}}return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[r]),{registerShortcut:o,unregisterShortcut:i,isEnabled:a}}function kw(e){return {ArrowUp:"\u2191",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",Enter:"\u21B5",Escape:"Esc",Delete:"Del"," ":"Space"}[e]||e.toUpperCase()}function Cw(e){let t=[],a=typeof navigator<"u"&&navigator.platform.includes("Mac");return e.modifiers?.ctrl&&t.push(a?"\u2318":"Ctrl"),e.modifiers?.shift&&t.push("Shift"),e.modifiers?.alt&&t.push(a?"\u2325":"Alt"),e.modifiers?.meta&&t.push("\u2318"),t.join(" + ")}function Tw(e){let t=Array.isArray(e.keys)?e.keys[0]:e.keys,a=Cw(e),r=t?kw(t):"";return a?`${a} + ${r}`:r}function Dw(e){let t={Navigation:[],Actions:[],Editing:[],Selection:[]};return e.forEach(a=>{a.action.includes("navigate")?t.Navigation?.push(a):a.action.includes("select")?t.Selection?.push(a):["undo","redo","save"].includes(a.action)?t.Editing?.push(a):t.Actions?.push(a);}),t}function Qd({shortcuts:e=Bi,isOpen:t,onClose:a,className:r}){let[n,s]=useState(false);if(useEffect(()=>{s(true);},[]),useEffect(()=>{function i(c){c.key==="Escape"&&t&&a();}if(t)return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t,a]),!n||!t)return null;let o=Dw(e);return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",r),children:[jsx("div",{className:"absolute inset-0 backdrop-blur-sm bg-black/40 dark:bg-black/60",onClick:a}),jsxs("div",{className:"relative backdrop-blur-xl rounded-2xl border shadow-2xl max-w-3xl w-full mx-4 max-h-[80vh] overflow-hidden bg-white dark:bg-gradient-to-br dark:from-gray-900/95 dark:to-gray-800/95 border-gray-200 dark:border-white/20",children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between border-gray-200 dark:border-white/10",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3 text-gray-900 dark:text-white",children:[jsx("span",{className:"text-3xl",children:"\u2328\uFE0F"}),"Keyboard Shortcuts"]}),jsx("p",{className:"text-sm mt-1 text-gray-500 dark:text-white/60",children:"Speed up your workflow with these shortcuts"})]}),jsx("button",{onClick:a,className:"transition-colors text-2xl leading-none p-2 rounded-lg text-gray-400 hover:text-gray-600 hover:bg-gray-100 dark:text-white/50 dark:hover:text-white dark:hover:bg-white/10","aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"px-6 py-6 overflow-y-auto max-h-[calc(80vh-120px)]",children:jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:Object.entries(o).map(([i,c])=>c.length===0?null:jsxs("div",{children:[jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2 text-gray-800 dark:text-white/90",children:[jsx("span",{className:"w-1 h-5 bg-[#00E5CC] rounded-full"}),i]}),jsx("div",{className:"space-y-3",children:c.map(l=>jsxs("div",{className:"flex items-center justify-between gap-4 p-3 rounded-lg transition-colors bg-gray-50 hover:bg-gray-100 dark:bg-white/5 dark:hover:bg-white/10",children:[jsx("span",{className:"text-sm text-gray-700 dark:text-white/80",children:l.description}),jsx("kbd",{className:"px-3 py-1.5 border rounded-md text-xs font-mono shadow-sm whitespace-nowrap bg-white border-gray-300 text-gray-800 dark:bg-gradient-to-br dark:from-gray-700 dark:to-gray-800 dark:border-white/20 dark:text-white/90",children:Tw(l)})]},l.action))})]},i))})}),jsx("div",{className:"px-6 py-4 border-t border-gray-200 bg-gray-50 dark:border-white/10 dark:bg-white/5",children:jsxs("p",{className:"text-xs text-center text-gray-500 dark:text-white/50",children:["Press ",jsx("kbd",{className:"px-2 py-0.5 rounded bg-gray-200 text-gray-600 dark:bg-white/10 dark:text-white/70",children:"?"})," to toggle this help panel"]})})]})]})}var Zd=[{id:"bug-report",name:"Bug Report",description:"Report a bug or issue",icon:"\u{1F41B}",category:"Development",template:{title:"[BUG] ",description:`**Steps to reproduce:**
|
|
86
86
|
1.
|
|
87
87
|
|
|
88
88
|
**Expected behavior:**
|
|
@@ -122,24 +122,24 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
122
122
|
1.
|
|
123
123
|
|
|
124
124
|
**Action items:**
|
|
125
|
-
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function sd({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function l(p){s.current&&!s.current.contains(p.target)&&o.current&&!o.current.contains(p.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),n(false);},c=e.reduce((l,p)=>{let u=p.category||"Other";return l[u]||(l[u]=[]),l[u].push(p),l},{});return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,p])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:p.map(u=>jsxs("button",{onClick:()=>i(u),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:u.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:u.name}),u.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:u.description})]})]},u.id))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function ld({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,i]=useState("export"),[c,l]=useState("json"),[p,u]=useState(null),d=useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,b=await sp(e,c,v);ip(b,c);},f=async v=>{let b=v.target.files?.[0];if(b){try{let h=await dp(b),y=b.name.endsWith(".json")?"json":"csv",x=cp(h,y);u(x),x.success&&r&&r(x,h);}catch(h){u({success:false,errors:[`Failed to read file: ${h instanceof Error?h.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(v=>jsxs("button",{onClick:()=>l(v),className:g("p-4 rounded-lg border-2 transition-all text-center",c===v?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:m,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:d,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),p&&jsxs("div",{className:g("p-4 rounded-lg",p.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",p.success?"text-green-400":"text-red-400"),children:p.success?"\u2713 Import Successful":"\u2717 Import Failed"}),p.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",p.cardsImported]}),jsxs("div",{children:["Columns imported: ",p.columnsImported]})]}),p.errors&&p.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:p.errors.map((v,b)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},b))})]})]})]})]})]})}var tv=["URGENT","HIGH","MEDIUM","LOW"],av=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],rv=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function cd({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:p=[],showQuickFilters:u=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,b]=useState(true),h=useCallback(P=>{a({search:P.target.value});},[a]),y=useCallback(P=>{a({dateFilter:P.target.value});},[a]),x=useCallback(P=>{r({by:P.target.value});},[r]),w=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),C=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>b(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:P=>{P.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:P=>{P.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),C&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&jsxs("div",{className:"filter-bar__content",children:[u&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:h,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:y,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:P=>{let O=P.target.value;a({priorities:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),tv.map(P=>jsx("option",{value:P,children:P},P))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:P=>{let O=P.target.value;a({assignees:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(P=>jsx("option",{value:P.id,children:P.name},P.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:P=>{let O=P.target.value;a({labels:O==="all"?[]:[O]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(P=>jsx("option",{value:P,children:P},P))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:x,className:"filter-bar__select filter-bar__select--sm",children:av.map(P=>jsx("option",{value:P.value,children:P.label},P.value))}),t.by!=="none"&&jsx("button",{onClick:w,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:m,onChange:P=>f(P.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:rv.map(P=>jsx("option",{value:P.value,children:P.label},P.value))})}),C&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function dd({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,p]=useState(false),u=useRef(null);useEffect(()=>{let m=f=>{u.current&&!u.current.contains(f.target)&&p(false);};return l&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[l]);let d=m=>{m(),p(false);};return jsxs("div",{className:g("relative",r),ref:u,children:[jsxs("button",{onClick:()=>p(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>d(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>d(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>d(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>d(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>d(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>d(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>d(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var ud={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},pd={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},md={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},Bo={dark:ud,light:pd,neutral:md},ul="dark";var pl=createContext(void 0),mv="asakaa-theme";function $m({children:e,defaultTheme:t=ul,storageKey:a=mv}){let[r,n]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{n(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=Bo[r];Object.entries(c.colors).forEach(([p,u])=>{u&&i.style.setProperty(`--theme-${gv(p)}`,u);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([p,u])=>{let d=c.colors[p];d&&i.style.setProperty(u,d);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:Bo};return jsx(pl.Provider,{value:o,children:e})}function fs(){let e=useContext(pl);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function gv(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function gd({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=fs();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(Bo).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var ft={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function Om(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return ft[e]||ft.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",ft[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",ft[e].bgSecondary),bgGrid:r("--theme-bg-card",ft[e].bgGrid),bgWeekend:r("--theme-bg-hover",ft[e].bgWeekend),border:r("--theme-border-primary",ft[e].border),borderLight:r("--theme-border-subtle",ft[e].borderLight),textPrimary:r("--theme-text-primary",ft[e].textPrimary),textSecondary:r("--theme-text-secondary",ft[e].textSecondary),textTertiary:r("--theme-text-tertiary",ft[e].textTertiary),accent:r("--theme-accent-primary",ft[e].accent),accentHover:r("--theme-accent-hover",ft[e].accentHover),accentLight:r("--theme-accent-primary",ft[e].accentLight),taskBarPrimary:r("--theme-accent-primary",ft[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",ft[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",ft[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",ft[e].dependency),dependencyHover:r("--theme-border-secondary",ft[e].dependencyHover),criticalPath:r("--theme-error",ft[e].criticalPath),criticalPathLight:r("--theme-error",ft[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",ft[e].today):e==="neutral"?r("--theme-text-primary",ft[e].today):r("--theme-error",ft[e].today),todayLight:e==="light"?r("--theme-accent-primary",ft[e].todayLight):e==="neutral"?r("--theme-text-primary",ft[e].todayLight):r("--theme-error",ft[e].todayLight),milestone:r("--theme-warning",ft[e].milestone),milestoneLight:r("--theme-warning",ft[e].milestoneLight),statusTodo:r("--theme-text-tertiary",ft[e].statusTodo),statusInProgress:r("--theme-accent-primary",ft[e].statusInProgress),statusCompleted:r("--theme-success",ft[e].statusCompleted),hoverBg:r("--theme-bg-hover",ft[e].hoverBg),focusRing:r("--theme-accent-primary",ft[e].focusRing),...ft[e].dotGrid&&{dotGrid:ft[e].dotGrid},...ft[e].glassHeader&&{glassHeader:ft[e].glassHeader},...ft[e].glassToolbar&&{glassToolbar:ft[e].glassToolbar},...ft[e].forecastHud&&{forecastHud:ft[e].forecastHud},...ft[e].neonRedGlow&&{neonRedGlow:ft[e].neonRedGlow},...ft[e].executionBarBg&&{executionBarBg:ft[e].executionBarBg}}}var ml={columns:{taskName:"TASK NAME",startDate:"Start Date",endDate:"End Date",duration:"Duration",assignees:"Assignees",status:"Status",progress:"% Complete",priority:"Priority"},toolbar:{today:"Today",day:"Day",week:"Week",month:"Month",export:"Export",exportPdf:"Export to PDF",exportPng:"Export to PNG",exportCsv:"Export to CSV",exportExcel:"Export to Excel",exportMsProject:"Export to MS Project",undo:"Undo",redo:"Redo",createTask:"New Task",density:"Row Density",compact:"Compact",normal:"Normal",spacious:"Spacious",filterAll:"All",filterIncomplete:"Incomplete",filterInProgress:"In Progress",filterCompleted:"Completed",filter:"Filters",filterBy:"FILTER BY STATUS",filterAllDesc:"Show all tasks",filterIncompleteDesc:"Hide completed tasks",filterInProgressDesc:"Tasks currently being worked on",filterCompletedDesc:"Only show finished tasks",clearFilter:"Clear filter",hideCompleted:"Hide Completed Tasks",toDo:"To Do / Pending",wbsLevel:"Level",wbsAllLevels:"All",viewExecution:"Execution",viewOracle:"Pulse View",simulateScenario:"Simulate Scenario",projectForecast:"PROJECT FORECAST",expectedFinish:"Expected Finish",confidence:"Confidence",costAtCompletion:"Cost at Completion",delayLabel:"Delay",earlyLabel:"Early",onTimeLabel:"On Time",budgetOver:"Over",budgetUnder:"Under",baselines:"Baselines",visibility:"Visibility",share:"Share",copySnapshotLink:"Copy Snapshot Link",copied:"Copied!",columns:"Columns"},contextMenu:{editTask:"Edit Task",addSubtask:"Add Subtask",markIncomplete:"Mark Incomplete",setInProgress:"Set In Progress",markComplete:"Mark Complete",duplicateTask:"Duplicate Task",splitTask:"Split Task",deleteTask:"Delete Task"},actions:{edit:"Edit",delete:"Delete",duplicate:"Duplicate",addSubtask:"Add Subtask",indent:"Indent",outdent:"Outdent",moveUp:"Move Up",moveDown:"Move Down",splitTask:"Split Task",linkTasks:"Link Tasks",unlinkTasks:"Unlink Tasks"},status:{todo:"To Do",inProgress:"In Progress",completed:"Completed"},labels:{progress:"Progress",duration:"Duration",days:"days",day:"day",assigned:"Assigned",milestone:"Milestone",criticalPath:"Critical Path",subtask:"Subtask",task:"Task",noTasks:"No tasks yet",addTask:"Add task",newTask:"New Task",loading:"Loading...",error:"Error",today:"Today",week:"Week",clickToSetDates:"Click to set dates..."},ai:{placeholder:'Ask AI to edit tasks... (e.g., "Move Design to next week")',thinking:"Thinking...",suggestions:{moveTask:'Move "Task Name" to next Monday',extendTask:'Extend "Task Name" by 3 days',renameTask:'Rename "Old Name" to "New Name"',setProgress:'Set "Task Name" progress to 50%',linkTasks:'Link "Task A" to "Task B"',createTask:'Create a new task called "New Task"',deleteTask:'Delete "Task Name"',assignTask:'Assign John to "Task Name"'},errors:{taskNotFound:"Task not found",invalidDate:"Invalid date",invalidDuration:"Invalid duration",invalidProgress:"Invalid progress value",unknownCommand:"Unknown command",processingError:"Error processing command"}},export:{projectName:"Gantt Project",ganttTasks:"Gantt Tasks",taskId:"Task ID",taskName:"Task Name",startDate:"Start Date",endDate:"End Date",isMilestone:"Is Milestone",parentId:"Parent ID",yes:"Yes",no:"No",noTasksToExport:"No tasks available to export"},dateFormat:{short:"MM/dd",medium:"MMM d",long:"MMMM d, yyyy"}},Hm={columns:{taskName:"NOMBRE DE TAREA",startDate:"Fecha Inicio",endDate:"Fecha Fin",duration:"Duraci\xF3n",assignees:"Asignados",status:"Estado",progress:"% Completado",priority:"Prioridad"},toolbar:{today:"Hoy",day:"D\xEDa",week:"Semana",month:"Mes",export:"Exportar",exportPdf:"Exportar a PDF",exportPng:"Exportar a PNG",exportCsv:"Exportar a CSV",exportExcel:"Exportar a Excel",exportMsProject:"Exportar a MS Project",undo:"Deshacer",redo:"Rehacer",createTask:"Nueva Tarea",density:"Densidad",compact:"Compacto",normal:"Normal",spacious:"Espacioso",filterAll:"Todas",filterIncomplete:"Sin completar",filterInProgress:"En progreso",filterCompleted:"Completadas",filter:"Filtros",filterBy:"FILTRAR POR ESTADO",filterAllDesc:"Mostrar todas las tareas",filterIncompleteDesc:"Ocultar tareas completadas",filterInProgressDesc:"Tareas en las que se est\xE1 trabajando",filterCompletedDesc:"Solo mostrar tareas terminadas",clearFilter:"Limpiar filtro",hideCompleted:"Ocultar Tareas Completadas",toDo:"Por Hacer / Pendiente",wbsLevel:"Nivel",wbsAllLevels:"Todos",viewExecution:"Ejecuci\xF3n",viewOracle:"Vista Pulse",simulateScenario:"Simular Escenario",projectForecast:"PRON\xD3STICO DEL PROYECTO",expectedFinish:"Fin Estimado",confidence:"Confianza",costAtCompletion:"Costo al Completar",delayLabel:"Retraso",earlyLabel:"Adelanto",onTimeLabel:"A Tiempo",budgetOver:"Excedido",budgetUnder:"Bajo",baselines:"L\xEDneas Base",visibility:"Visibilidad",share:"Compartir",copySnapshotLink:"Copiar enlace de vista",copied:"\xA1Copiado!",columns:"Columnas"},contextMenu:{editTask:"Editar Tarea",addSubtask:"Agregar Subtarea",markIncomplete:"Marcar Incompleta",setInProgress:"Marcar En Progreso",markComplete:"Marcar Completada",duplicateTask:"Duplicar Tarea",splitTask:"Dividir Tarea",deleteTask:"Eliminar Tarea"},actions:{edit:"Editar",delete:"Eliminar",duplicate:"Duplicar",addSubtask:"Agregar Subtarea",indent:"Aumentar Nivel",outdent:"Disminuir Nivel",moveUp:"Mover Arriba",moveDown:"Mover Abajo",splitTask:"Dividir Tarea",linkTasks:"Vincular Tareas",unlinkTasks:"Desvincular Tareas"},status:{todo:"Por Hacer",inProgress:"En Progreso",completed:"Completado"},labels:{progress:"Progreso",duration:"Duraci\xF3n",days:"d\xEDas",day:"d\xEDa",assigned:"Asignado",milestone:"Hito",criticalPath:"Ruta Cr\xEDtica",subtask:"Subtarea",task:"Tarea",noTasks:"Sin tareas a\xFAn",addTask:"Agregar tarea",newTask:"Nueva Tarea",loading:"Cargando...",error:"Error",today:"Hoy",week:"Semana",clickToSetDates:"Clic para establecer fechas..."},ai:{placeholder:'P\xEDdele a la IA que edite tareas... (ej: "Mover Dise\xF1o a la pr\xF3xima semana")',thinking:"Pensando...",suggestions:{moveTask:'Mover "Nombre de Tarea" al pr\xF3ximo lunes',extendTask:'Extender "Nombre de Tarea" por 3 d\xEDas',renameTask:'Renombrar "Nombre Anterior" a "Nombre Nuevo"',setProgress:'Establecer progreso de "Nombre de Tarea" al 50%',linkTasks:'Vincular "Tarea A" con "Tarea B"',createTask:'Crear una nueva tarea llamada "Nueva Tarea"',deleteTask:'Eliminar "Nombre de Tarea"',assignTask:'Asignar a Juan a "Nombre de Tarea"'},errors:{taskNotFound:"Tarea no encontrada",invalidDate:"Fecha inv\xE1lida",invalidDuration:"Duraci\xF3n inv\xE1lida",invalidProgress:"Valor de progreso inv\xE1lido",unknownCommand:"Comando desconocido",processingError:"Error procesando el comando"}},export:{projectName:"Proyecto Gantt",ganttTasks:"Tareas Gantt",taskId:"ID de Tarea",taskName:"Nombre de Tarea",startDate:"Fecha Inicio",endDate:"Fecha Fin",isMilestone:"Es Hito",parentId:"ID Padre",yes:"S\xED",no:"No",noTasksToExport:"No hay tareas disponibles para exportar"},dateFormat:{short:"dd/MM",medium:"d MMM",long:"d de MMMM de yyyy"}},fd={en:ml,es:Hm};function Um(e){return fd[e]||fd.en}function bd(e,t){let a=Um(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},contextMenu:{...a.contextMenu,...t.contextMenu},actions:{...a.actions,...t.actions},status:{...a.status,...t.status},labels:{...a.labels,...t.labels},ai:{...a.ai,...t.ai,suggestions:{...a.ai.suggestions,...t.ai?.suggestions},errors:{...a.ai.errors,...t.ai?.errors}},export:{...a.export,...t.export},dateFormat:{...a.dateFormat,...t.dateFormat}}:a}var hs=createContext(ml);function Ur(){return useContext(hs)}function ii(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),i=o.bottom+4,c;a==="right"?c=o.right-r:c=o.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),n}function qm({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[i,c]=useState(false),[l,p]=useState(null),u=useRef(null),d=useRef(null),m=Ur(),f=ii(u,i,"right",176);if(useEffect(()=>{if(!i)return;let y=x=>{let w=x.target;u.current&&!u.current.contains(w)&&d.current&&!d.current.contains(w)&&c(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[i]),!(t||a||r||n||s||o))return null;let b=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(y=>y.handler),h=async(y,x)=>{if(x){p(y);try{await x();}catch(w){console.error(`Export ${y} failed:`,w);}finally{p(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:u,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:b.map((y,x)=>jsxs(motion.button,{onClick:()=>h(y.id,y.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<b.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===y.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):y.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:y.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:y.description})]})]},y.id))})})}),document.body)]})}function hd({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,i]=useState(false),[c,l]=useState(null),[p,u]=useState(false),d=useRef(null),m=useRef(null),f=Ur(),v=ii(d,o,"right",224),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",h=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let C=P=>{let O=P.target;d.current&&!d.current.contains(O)&&m.current&&!m.current.contains(O)&&i(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[o]);let y=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(C=>C.handler),x=async(C,P)=>{if(P){l(C);try{await P();}catch(O){console.error(`Export ${C} failed:`,O);}finally{l(null),i(false);}}},w=()=>{s?.(),u(true),setTimeout(()=>u(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>i(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[y.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:y.map((C,P)=>jsxs(motion.button,{onClick:()=>x(C.id,C.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:P*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===C.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):C.icon}),jsx("span",{className:"flex-1 text-left",children:C.label})]},C.id))})]}),y.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:h?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:w,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:y.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:p?"rgba(34,197,94,0.15)":e.accentLight,color:p?"#22C55E":e.accent},children:p?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:p?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function Bv({options:e,value:t,onChange:a,theme:r,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function $v({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function yd({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),i=useRef(null),c=Ur(),l=ii(o,n,"left");useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&i.current&&!i.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let p=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(d,m)=>({value:m+1,label:`L${m+1}`}))],u=t==="all"?c.toolbar.wbsAllLevels||"All":`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${u}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:u})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:p.map((d,m)=>{let f=t===d.value;return jsxs(motion.button,{onClick:()=>{a(d.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:m<p.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:d.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(d.value))})})})}),document.body)]})}function xd({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),i=useRef(null),c=useRef(null),l=Ur(),p=ii(i,s,"left");useEffect(()=>{if(!s)return;let v=setTimeout(()=>{let b=y=>{let x=y.target;i.current&&!i.current.contains(x)&&c.current&&!c.current.contains(x)&&o(false);},h=y=>{y.key==="Escape"&&o(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",h),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",h);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[s]);let u=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||r,m=(t!=="all"?1:0)+(r?1:0),f=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:v=>{v.stopPropagation(),o(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?f?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?f?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:d?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsxs("span",{children:[l.toolbar.filter||"Filters",m>0?` \xB7 ${m}`:""]})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:p.top,left:p.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${f?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:f?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:u.map(v=>{let b=t===v.value&&!r,h=()=>v.value==="all"?b?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):v.icon;return jsxs(motion.button,{onClick:()=>{a(v.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${b?v.color:"text-gray-400"} flex-shrink-0`,children:h()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:v.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},v.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#00E5CC":f?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function zm({value:e,onChange:t,theme:a}){let r=Ur(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let i=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function Ov({theme:e,forecast:t}){let a=Ur(),r=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",n=t?.expectedFinish?t.expectedFinish.toLocaleDateString(void 0,{month:"short",day:"numeric"}):"\u2014",s=t?.delayDays,o=s!=null,i=s!=null?s>0?`+${s}d ${a.toolbar.delayLabel}`:s<0?`${s}d ${a.toolbar.earlyLabel}`:a.toolbar.onTimeLabel:null,c=s!=null&&s>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:s!=null&&s<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},l=t?.confidencePercent,p=l!=null?l>=75?"#22C55E":l>=40?"#F59E0B":"#EF4444":e.textTertiary,u=t?.costAtCompletion,d=t?.currency||"$",m=u!=null?u>=1e6?`${d}${(u/1e6).toFixed(2)}M`:u>=1e3?`${d}${(u/1e3).toFixed(1)}K`:`${d}${u.toFixed(0)}`:"\u2014",f=t?.budgetVariancePercent,v=f!=null&&f!==0,b=f!=null?f>0?`+${f.toFixed(0)}% ${a.toolbar.budgetOver}`:`${f.toFixed(0)}% ${a.toolbar.budgetUnder}`:null,h=f!=null&&f>0?{bg:r?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:r?"#EF4444":"#DC2626"}:f!=null&&f<0?{bg:r?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:r?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(r?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:a.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.expectedFinish,": ",n]}),o&&i&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:c.bg,color:c.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:i})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:p,fontFamily:"'JetBrains Mono', monospace"},children:l!=null?`${l.toFixed(0)}%`:"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:r?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[a.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:m}),v&&b&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:h.bg,color:h.text,fontFamily:"'JetBrains Mono', monospace"},children:b})]})]})]})}function Gm({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:p,hasDependencies:u=true}){let[d,m]=useState(false),f=useRef(null),v=useRef(null),b=Ur(),h=ii(f,d,"right",208),y=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!d)return;let P=O=>{let T=O.target;f.current&&!f.current.contains(T)&&v.current&&!v.current.contains(T)&&m(false);};return document.addEventListener("mousedown",P),()=>document.removeEventListener("mousedown",P)},[d]);let x=b.toolbar.visibility==="Visibilidad",w=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!u,tooltip:u?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:n},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],C=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsx(motion.button,{ref:f,onClick:()=>m(!d),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:d?e.accent:e.textTertiary,backgroundColor:d?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:b.toolbar.visibility,children:jsx(Eye,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:d&&jsxs(motion.div,{ref:v,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:h.top,left:h.left,zIndex:99999,backgroundColor:y?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${y?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:y?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:w.map((P,O)=>{let T=P.icon,D=P.disabled,M=P.tooltip;return jsxs(motion.button,{onClick:()=>!D&&P.onChange?.(!P.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:D?y?"rgba(255,255,255,0.3)":"#9CA3AF":y?"rgba(255,255,255,0.85)":"#111827",cursor:D?"not-allowed":"pointer"},whileHover:D?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:O*.03},title:M,children:[jsx(T,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:D?y?"rgba(255,255,255,0.2)":"#D1D5DB":P.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:P.label}),P.active&&!D&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:y?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:y?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),C.map((P,O)=>{let T=l===P.value;return jsxs(motion.button,{onClick:()=>p(P.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:y?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(w.length+O)*.03},children:[jsx("span",{style:{color:T?e.accent||"#00E5CC":y?"rgba(255,255,255,0.85)":e.textPrimary},children:P.label}),T&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},P.value)})]})]})}),document.body)]})}function Hv({theme:e,etiqueta:t,children:a}){let[r,n]=useState(false),s=useRef(null);return useEffect(()=>{if(!r)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},i=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",i);}},[r]),jsxs("div",{ref:s,className:"relative",children:[jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":r,title:t,className:"flex items-center justify-center rounded-md",style:{width:32,height:32,color:e.textSecondary,border:`1px solid ${e.borderLight}`},children:"\u22EF"}),r&&jsx("div",{className:"absolute right-0 mt-1 p-1.5 rounded-lg shadow-lg",style:{top:"100%",minWidth:200,zIndex:300,backgroundColor:e.bgPrimary,border:`1px solid ${e.borderLight}`},children:a})]})}function gl({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:r,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:i,rowDensity:c,onRowDensityChange:l,showThemeSelector:p=false,showCreateTaskButton:u=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:b=false,onHideCompletedChange:h,toolbarRightContent:y,wbsLevel:x,onWbsLevelChange:w,maxWbsDepth:C=4,viewMode:P="execution",onViewModeChange:O,projectForecast:T,hideForecastHud:D,onExportPNG:M,onExportPDF:N,onExportExcel:z,onExportCSV:$,onExportJSON:Y,onExportMSProject:A,showCriticalPath:Se=true,onShowCriticalPathChange:W,showDependencies:Ce=true,onShowDependenciesChange:R,highlightWeekends:we=true,onHighlightWeekendsChange:G,showBaseline:Ve=false,onShowBaselineChange:oe,onCopySnapshotLink:Be,hasDependencies:le=true}){let He=Ur(),$e=M||N||z||$||Y||A,Pe=!!t.glassToolbar,je=[{value:"day",label:He.toolbar.day},{value:"week",label:He.toolbar.week},{value:"month",label:He.toolbar.month}],tt=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}],ee=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxs("div",{className:"flex items-center gap-2",children:[jsx(zm,{value:a,onChange:r,theme:t}),v&&jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h}),y,jsx(Gm,{theme:t,showCriticalPath:Se,onShowCriticalPathChange:W,showBaseline:Ve,onShowBaselineChange:oe,highlightWeekends:we,onHighlightWeekendsChange:G,showDependencies:Ce,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:l,hasDependencies:le}),jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:z,onExportMSProject:A,onCopySnapshotLink:Be}),(O||w)&&jsxs(Hv,{theme:t,etiqueta:He.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[O&&jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(Ae=>jsxs("button",{type:"button",onClick:()=>O(Ae),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:P===Ae?ee?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[Ae==="execution"?He.toolbar.viewExecution:He.toolbar.viewOracle,P===Ae&&jsx(Check,{className:"w-3.5 h-3.5"})]},Ae))}),w&&jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C})})]})]});if(Pe){let Ae=ee?"rgba(255,255,255,0.08)":t.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:t.glassToolbar,borderColor:t.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:O&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:ee?"#000000":t.bgSecondary,border:`1px solid ${ee?"rgba(255,255,255,0.08)":t.border}`},children:[jsx(motion.button,{onClick:()=>O("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:P==="execution"?ee?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:P==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:P!=="execution"?{color:t.textSecondary}:{},children:He.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>O("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:P==="oracle"?ee?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:P==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:P!=="oracle"?{color:t.textSecondary}:{},children:He.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(zm,{value:a,onChange:r,theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:Ae}}),w&&jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C}),v&&jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h}),y&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:Ae}}),y]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:Ae}}),jsx(Gm,{theme:t,showCriticalPath:Se,onShowCriticalPathChange:W,showBaseline:Ve,onShowBaselineChange:oe,highlightWeekends:we,onHighlightWeekendsChange:G,showDependencies:Ce,onShowDependenciesChange:R,rowDensity:c,onRowDensityChange:l,hasDependencies:le}),jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:z,onExportMSProject:A,onCopySnapshotLink:Be}),u&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${t.accent} 0%, ${t.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${ee?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${ee?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||He.toolbar.createTask})]})]})]}),T&&!D&&jsx(Ov,{theme:t,forecast:T})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx($v,{options:je,value:a,onChange:Ae=>r(Ae),theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>s(Math.max(.5,n-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:t.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(n*100),"%"]}),jsx(motion.button,{onClick:()=>s(Math.min(2,n+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),w&&jsx(yd,{theme:t,value:x??"all",onChange:w,maxDepth:C}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsx(xd,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:h})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[y&&jsxs(Fragment,{children:[y,jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}})]}),u&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||He.toolbar.createTask})]}),($e||p)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsx(hd,{theme:t,onExportPNG:M,onExportPDF:N,onExportExcel:z,onExportMSProject:A,onCopySnapshotLink:Be}),p&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),p&&jsx(Bv,{options:tt,value:o,onChange:Ae=>i(Ae),theme:t})]})]})}function fl({columns:e,onToggleColumn:t,theme:a}){let r=Ur(),[n,s]=useState(false),[o,i]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!n)return;let u=d=>{c.current&&!c.current.contains(d.target)&&s(false);};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[n]);let p=e.filter(u=>u.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!n&&l.current){let u=l.current.getBoundingClientRect();i({x:u.left,y:u.bottom+4});}s(!n);},className:"p-2 rounded-md transition-colors flex items-center gap-1",title:r.toolbar.columns||"Columns","aria-label":r.toolbar.columns||"Columns",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Columns3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:n&&jsx(ga,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${o.x}px`,top:`${o.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),p.map(u=>jsxs("button",{onClick:()=>{t(u.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:u.label}),u.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},u.id))]})})})})]})}function ys({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let p=200,u=r.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,b=a;t+p+d>m&&(v=t-p,v<d&&(v=d)),a+u+d>f&&(b=f-u-d,b<d&&(b=d)),c({x:v,y:b});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let p=d=>{o.current&&!o.current.contains(d.target)&&n();},u=d=>{d.key==="Escape"&&n();};return document.addEventListener("mousedown",p),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",u);}},[e,n]),!e)return null;let l=p=>p.startsWith("#")&&(p.length===7||p.length===4)?p:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(p=>jsxs("div",{children:[p.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{p.disabled||(p.onClick(),n());},disabled:p.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:p.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:p.disabled?"not-allowed":"pointer",opacity:p.disabled?.5:1},onMouseEnter:u=>{p.disabled||(u.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:u=>{u.currentTarget.style.backgroundColor="transparent";},children:[p.icon&&jsx("span",{style:{color:s.textSecondary},children:p.icon}),jsx("span",{className:"flex-1",children:p.label}),p.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},p.id))})})})}var ua={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function tg({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:p,onOpenTaskModal:u,enableKeyboard:d=true}){let m=useRef(false),f=useCallback(x=>{m.current=x;},[]),v=useCallback(x=>{let w=[],C=P=>{for(let O of P)w.push(O),O.subtasks&&O.subtasks.length>0&&O.isExpanded&&C(O.subtasks);};return C(x),w},[]),b=useCallback(()=>{let x=v(e);for(let w of x)if(t.has(w.id))return w;return null},[e,t,v]),h=useCallback((x,w)=>{let C=v(e);if(C.length===0)return;let P=b();if(!P){a(C[0].id,false);return}let O=C.findIndex(M=>M.id===P.id);if(O===-1)return;let T=x==="up"?O-1:O+1;if(T<0||T>=C.length)return;let D=C[T];a(D.id,w);},[e,b,v,a]),y=useCallback(x=>{if(!d)return;let w=x.target;if(w.tagName==="INPUT"||w.tagName==="TEXTAREA"||w.isContentEditable||m.current){x.key==="Escape"&&(w.blur(),m.current=false);return}let O=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,T=Array.from(t),D=b();if(x.key==="ArrowUp"){x.preventDefault(),h("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),h("down",x.shiftKey);return}if(D&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){D.subtasks&&D.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!D.isExpanded||x.key==="ArrowLeft"&&D.isExpanded)&&p(D.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){T.length>0&&(x.preventDefault(),o(T,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){T.length>0&&(x.preventDefault(),i(T));return}if(x.key==="Tab"&&x.shiftKey){T.length>0&&(x.preventDefault(),c(T));return}if(x.key==="Enter"&&!x.shiftKey&&!O){D&&(x.preventDefault(),r(D.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!O){D&&(x.preventDefault(),r(D.id,"above"));return}if(x.key==="Enter"&&O){D&&(x.preventDefault(),u(D.id));return}if(x.key==="F2"){D&&(x.preventDefault(),l(D.id));return}if(x.key==="Delete"||x.key==="Backspace"&&O){T.length>0&&(x.preventDefault(),n(T));return}if(x.key==="d"&&O&&!x.shiftKey){T.length>0&&(x.preventDefault(),s(T));return}},[d,t,b,h,r,n,s,o,i,c,l,p,u]);return useEffect(()=>{if(d)return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y);}},[d,y]),{setIsEditing:f}}function rg(e){let[t,a]=useState(new Set),[r,n]=useState(null);useEffect(()=>{e&&(a(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=useCallback(d=>{a(new Set([d])),n(d);},[]),o=useCallback(d=>{a(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),i=useCallback((d,m)=>{if(!r){s(d);return}let f=m.indexOf(r),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let b=Math.min(f,v),h=Math.max(f,v),y=m.slice(b,h+1);a(new Set(y)),n(d);},[r,s]),c=useCallback((d,m,f,v)=>{v?i(d,m):f?o(d):s(d);},[s,o,i]),l=useCallback((d,m)=>{m?a(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),p=useCallback(()=>{a(new Set),n(null);},[]),u=useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:i,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:p,isTaskSelected:u}}function Td(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?Td(t.subtasks):t.subtasks}))}function Uo(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<o.length;i++){let c={...o[i],parentId:n,level:s,position:o[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function xs(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=xs(a.subtasks,t);if(r)return r}}return null}function Cd(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=Cd(a.subtasks,t);if(r)return r}return null}function Nd(e,t){if(t.length===0)return e;let a=Uo(e),r=t[0],n=a.findIndex(d=>d.id===r);if(n<=0)return e;let s=a[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(b=>{if(m.has(b.id))return f.push(b),false;if(b.subtasks){let h=o(b.subtasks,m);b.subtasks=h.tasks,f.push(...h.removed);}return true}),removed:f}},i=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:i(v.subtasks,m,f)}:v),c=new Set(t),{tasks:l,removed:p}=o(e,c),u=i(l,s.id,p);return Td(u)}function Dd(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=Cd(a,r);if(!n)continue;let s=Cd(a,n.id),o=(l,p,u)=>{for(let d=0;d<l.length;d++){let m=l[d];if(m.id===p&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===u);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,p,u);if(f)return f}}return null},i=(l,p,u)=>{let d=l.findIndex(m=>m.id===p);if(d!==-1)return l.splice(d+1,0,u),l;for(let m of l)m.subtasks&&i(m.subtasks,p,u);return l},c=o(a,n.id,r);c&&(s&&s.subtasks?i(s.subtasks,n.id,c):i(a,n.id,c));}return Td(a)}function Sd(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,i,c)=>{let l=o.findIndex(u=>u.id===i);if(l===-1){for(let u of o)if(u.subtasks&&s(u.subtasks,i,c))return true;return false}let p=c==="up"?l-1:l+1;return p<0||p>=o.length?false:([o[l],o[p]]=[o[p],o[l]],o[l]={...o[l],position:l},o[p]={...o[p],position:p},true)};return s(r,n,a),r}function Ed(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function ci(e,t){let a=[...e],r=[];for(let n of t){let s=(c,l)=>c.map((p,u)=>({...p,id:`${p.id}-copy-${Date.now()}-${u}`,parentId:l,subtasks:p.subtasks?s(p.subtasks,`${p.id}-copy-${Date.now()}-${u}`):void 0})),o=c=>{let l=c.findIndex(m=>m.id===n);if(l===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let p=c[l],u=`${p.id}-copy-${Date.now()}`,d={...p,id:u,name:`${p.name} (Copy)`,subtasks:p.subtasks?s(p.subtasks,u):void 0};return c.splice(l+1,0,d),d},i=o(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function ng(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},i=c=>{let l=c.findIndex(u=>u.id===t);if(l===-1){for(let u of c)if(u.subtasks&&i(u.subtasks))return true;return false}let p=a==="above"?l:l+1;return c.splice(p,0,o),true};return i(r),{tasks:r,newTask:o}}function Md(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:Md(r.subtasks,t,a)}:r)}function Pd(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Pd(a.subtasks,t)}:a)}function Fd(e,t){let a=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=a(m.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,i=r?.endDate||s,c=d=>{for(let m of d){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=c(m.subtasks);if(f>=0)return f}}return 0},l=c(e),p={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(i),color:r?.color||"#00E5CC",position:l,parentId:t},u=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,p],isExpanded:true}}return m.subtasks?{...m,subtasks:u(m.subtasks)}:m});return {tasks:u(e),newTask:p}}function og(e,t,a,r){if(t===a)return e;let n=xs(e,t);if(!n)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let p of c.subtasks)if(p.id===l||i(p,l))return true;return false};if(i(n,a))return e}let s=i=>{let c=i.filter(p=>p.id!==t),l=c.length<i.length;return c.map((p,u)=>{let d=l?{...p,position:u}:p;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let i=r!==void 0?r:o.length;o.splice(i,0,{...n,parentId:void 0}),o=o.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let p=l.subtasks||[],u=r!==void 0?r:p.length,d=[...p];d.splice(u,0,{...n,parentId:a});let m=d.map((f,v)=>({...f,position:v}));return {...l,subtasks:m,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});o=i(o);}return o}function tn(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=tn(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?Math.round(r.progresses.reduce((i,c)=>i+c,0)/r.progresses.length):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function hl({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:i,onTaskDblClick:c,onTaskContextMenu:l,onTaskToggle:p,scrollTop:u,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:b,onTaskIndent:h,onTaskOutdent:y,onTaskMove:x,onMultiTaskDelete:w,onTaskDuplicate:C,onTaskCreate:P,onTaskRename:O,addTaskRow:T,onCreateSubtask:D,onOpenTaskModal:M,onDeleteRequest:N,onTaskReparent:z,allTasks:$,scrollContainerRef:Y,showCriticalPath:A=false}){let Se=useContext(hs),[W,Ce]=useState(null),[R,we]=useState(null),[G,Ve]=useState(""),oe=useRef(null),[Be,le]=useState(null),[He,$e]=useState(0),[Pe,je]=useState(0),[tt,ee]=useState({isOpen:false,x:0,y:0,type:"header"}),[Ae,ot]=useState(null),[Ie,zt]=useState(null),[st,bt]=useState(null),Ee=useRef(0),Dt=5,ht=useRef(false),[_e,dt]=useState(null),[L,J]=useState(false),xe=useRef(null),[I,j]=useState(null),[ke,Ue]=useState(null),[ue,at]=useState(false),yt=useRef(null);useEffect(()=>{function se(me){yt.current&&!yt.current.contains(me.target)&&at(false);}if(ue)return document.addEventListener("mousedown",se),()=>document.removeEventListener("mousedown",se)},[ue]),useEffect(()=>{R&&oe.current&&(oe.current.focus(),oe.current.select());},[R]),useEffect(()=>{if(!Be)return;let se=q=>{let pe=q.clientX-He,ce=Pe+pe;f?.(Be,ce);},me=()=>{le(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",se),document.addEventListener("mouseup",me),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",me),document.body.style.cursor="",document.body.style.userSelect="";}},[Be,He,Pe,f]);let{selectedTaskIds:Ye,handleTaskClick:vt,isTaskSelected:Xt}=rg(i),{setIsEditing:wt}=tg({tasks:e,selectedTaskIds:Ye,onTaskSelect:(se,me)=>{let pe=Uo(e).map(ce=>ce.id);vt(se,pe,me||false,false),o?.(se);},onTaskCreate:P||(()=>{}),onTaskDelete:w||(()=>{}),onTaskDuplicate:C||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:h||(()=>{}),onTaskOutdent:y||(()=>{}),onTaskRename:se=>{let me=Uo(e).find(q=>q.id===se);me&&kt(me);},onTaskToggleExpand:p||(()=>{}),onOpenTaskModal:se=>{let me=Uo(e).find(q=>q.id===se);me&&M&&M(me);},enableKeyboard:true}),Ut=(se,me=0,q="")=>{let pe=[],ce=[...se].sort((B,re)=>(B.position??0)-(re.position??0));for(let B=0;B<ce.length;B++){let re=ce[B],be=B+1,S=q?`${q}.${be}`:`${be}.0`,H=re.wbsCode||S;if(re.wbsCode=H,pe.push({task:re,level:me}),re.subtasks&&re.subtasks.length>0&&re.isExpanded){let Te=re.wbsCode?.replace(/\.0$/,"")||(q?`${q}.${be}`:`${be}`);pe.push(...Ut(re.subtasks,me+1,Te));}}return pe},Ht=Ut(e),he=48,Fe=Math.max(Ht.length*a,600-he),Qe=(se,me)=>me==="assignees"?se.assignees:me==="startDate"?se.startDate:se.endDate,rt=(se,me,q,pe)=>{se.preventDefault(),se.stopPropagation(),j({sourceTaskId:me,column:q,sourceIndex:pe,targetIndex:pe}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ce=se.currentTarget.closest("[data-grid-body]"),B=fe=>{let Ne=ce?.getBoundingClientRect().top??0,ye=Math.floor((fe-Ne)/a);return ye=Math.max(0,Math.min(Ht.length-1,ye)),ye<pe&&(ye=pe),ye},re=se.clientY,be=Y?.current??null,S=()=>{xe.current&&(cancelAnimationFrame(xe.current),xe.current=null);},H=()=>{let fe=B(re);j(Ne=>Ne&&{...Ne,targetIndex:fe});},Z=()=>{if(S(),!be)return;let fe=be.getBoundingClientRect(),Ne=60,ye=12,lt=re-fe.top,Et=fe.bottom-re;if(Et<Ne&&be.scrollTop<be.scrollHeight-be.clientHeight){let Qt=Math.max(1,Math.round(ye*(1-Math.max(0,Et)/Ne))),ja=()=>{be.scrollTop+=Qt,H(),be.scrollTop<be.scrollHeight-be.clientHeight&&(xe.current=requestAnimationFrame(ja));};xe.current=requestAnimationFrame(ja);}else if(lt<Ne&&be.scrollTop>0){let Qt=Math.max(1,Math.round(ye*(1-Math.max(0,lt)/Ne))),ja=()=>{be.scrollTop-=Qt,H(),be.scrollTop>0&&(xe.current=requestAnimationFrame(ja));};xe.current=requestAnimationFrame(ja);}},Te=fe=>{re=fe.clientY,H(),Z();},gt=fe=>{window.removeEventListener("mousemove",Te),window.removeEventListener("mouseup",gt),S(),document.body.style.cursor="",document.body.style.userSelect="",j(null);let Ne=B(fe.clientY),ye=Ht.find(Er=>Er.task.id===me)?.task;if(!ye)return;let lt=Qe(ye,q),Et=Math.min(pe,Ne),Qt=Math.max(pe,Ne),ja=[];for(let Er=Et;Er<=Qt;Er++){if(Er===pe)continue;let _a=Ht[Er]?.task;!_a||_a.subtasks&&_a.subtasks.length>0||ja.push(_a.id);}ja.length!==0&&b?.(ja,q,lt);};window.addEventListener("mousemove",Te),window.addEventListener("mouseup",gt);},Tt=se=>{if(!I)return false;let me=Math.min(I.sourceIndex,I.targetIndex),q=Math.max(I.sourceIndex,I.targetIndex);return se>=me&&se<=q},Ft=se=>!se.startDate||!se.endDate?"-":`${Math.ceil((se.endDate.getTime()-se.startDate.getTime())/(1e3*60*60*24))}d`,kt=se=>{we(se.id),Ve(se.name),wt(true);},Da=se=>{G.trim()&&G!==e.find(me=>me.id===se)?.name&&O?.(se,G.trim()),we(null),Ve(""),wt(false);},aa=()=>{we(null),Ve(""),wt(false);},cr=(se,me)=>{me.stopPropagation(),D?.(se.id);},Xe=(se,me)=>{me.preventDefault(),Ee.current=me.clientY,ot(se),ht.current=false,J(false),dt({x:me.clientX,y:me.clientY});},et=se=>{if(!Ae||(Math.abs(se.clientY-Ee.current)>Dt&&!ht.current&&(ht.current=true,J(true)),dt({x:se.clientX,y:se.clientY}),!ht.current))return;if(Y?.current){let B=Y.current,re=B.getBoundingClientRect(),be=60,S=12;xe.current&&(cancelAnimationFrame(xe.current),xe.current=null);let H=se.clientY-re.top,Z=re.bottom-se.clientY;if(H<be&&B.scrollTop>0){let Te=Math.round(S*(1-H/be)),gt=()=>{B.scrollTop-=Te,ht.current&&B.scrollTop>0&&(xe.current=requestAnimationFrame(gt));};xe.current=requestAnimationFrame(gt);}else if(Z<be&&B.scrollTop<B.scrollHeight-B.clientHeight){let Te=Math.round(S*(1-Z/be)),gt=()=>{B.scrollTop+=Te,ht.current&&B.scrollTop<B.scrollHeight-B.clientHeight&&(xe.current=requestAnimationFrame(gt));};xe.current=requestAnimationFrame(gt);}}let q=document.querySelectorAll("[data-task-row]"),pe=null,ce=null;q.forEach(B=>{let re=B.getBoundingClientRect(),be=B.getAttribute("data-task-row");if(be&&be!==Ae&&se.clientY>=re.top&&se.clientY<=re.bottom){pe=be;let S=se.clientY-re.top,H=re.height;S<H*.25?ce="above":S>H*.75?ce="below":ce="child";}}),zt(pe),bt(ce);},Sa=()=>{if(ht.current&&Ae&&Ie&&st){if(st==="child")z?.(Ae,Ie);else if(st==="above"||st==="below"){let se=(B,re,be=null)=>{for(let S of B){if(S.id===re)return be;if(S.subtasks){let H=se(S.subtasks,re,S.id);if(H!==void 0)return H}}},me=$&&$.length>0?$:e,q=se(me,Ae,null),pe=se(me,Ie,null),ce=(B,re,be,S)=>{let H=B.findIndex(gt=>gt.id===re),Z=S?B.findIndex(gt=>gt.id===be):-1,Te=st==="below"?H+1:H;return S&&Z!==-1&&Z<H&&(Te-=1),Math.max(0,Te)};if(pe===null){let re=ce(me,Ie,Ae,q===null);z?.(Ae,null,re);}else {let B=xs(me,pe);if(B?.subtasks){let re=q===pe,be=ce(B.subtasks,Ie,Ae,re);z?.(Ae,pe,be);}}}}xe.current&&(cancelAnimationFrame(xe.current),xe.current=null),ot(null),zt(null),bt(null),dt(null),ht.current=false,J(false);};useEffect(()=>{if(Ae)return document.addEventListener("mousemove",et),document.addEventListener("mouseup",Sa),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",Sa),document.body.style.cursor="",document.body.style.userSelect="";}},[Ae,Ie,st]);let Ia=(se,me,q)=>{let pe=me.subtasks&&me.subtasks.length>0;switch(se.id){case "name":let ce=R===me.id,B=W===me.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${q*20}px`},children:[z&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:B?1:.3},onMouseDown:ye=>Xe(me.id,ye),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),me.subtasks&&me.subtasks.length>0?jsx("button",{onClick:ye=>{ye.stopPropagation(),p?.(me.id);},className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:me.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),ce?jsx("input",{ref:oe,type:"text",value:G,onChange:ye=>Ve(ye.target.value),onKeyDown:ye=>{ye.key==="Enter"?Da(me.id):ye.key==="Escape"&&aa();},onBlur:()=>Da(me.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:ye=>ye.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:me.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:me.parentId?"13px":"14px",fontWeight:me.isMilestone?600:me.parentId?400:600,letterSpacing:me.parentId?"0":"-0.01em"},title:me.name,children:[me.wbsCode&&jsx("span",{style:{color:t.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,opacity:.65,flexShrink:0},children:me.wbsCode}),me.isHighlighted&&me.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:me.name}),me.subtasks&&me.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(me.progress||0),"%"]}),A&&me.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),A&&me.cpmData&&jsxs("span",{style:{color:me.cpmData.totalFloat<=0?"#EF4444":me.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:["TF: ",Math.round(me.cpmData.totalFloat),"d"]})]}),B&&!ce&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:ye=>ye.stopPropagation(),children:[jsx("button",{onClick:ye=>cr(me,ye),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:ye=>{ye.stopPropagation(),kt(me);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let be=se.id==="startDate"?"startDate":"endDate",S=me[be],H=ke?.taskId===me.id&&ke?.field===be,Z=ye=>ye?(typeof ye=="string"?new Date(ye):ye).toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"}):"-";return jsxs("div",{className:"flex items-center justify-center w-full relative",onClick:ye=>ye.stopPropagation(),children:[jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:{color:t.textSecondary,opacity:pe?.5:1,cursor:pe?"default":"pointer"},title:pe?"Auto-calculated from subtasks":void 0,onClick:ye=>{if(!pe)if(H)Ue(null);else {let lt=ye.currentTarget.getBoundingClientRect();Ue({taskId:me.id,field:be,month:S?typeof S=="string"?new Date(S):S:new Date,position:{top:lt.bottom+4,left:lt.left}});}},children:[jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Z(S)}),pe&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),H&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ue(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:ke?.position.top,left:ke?.position.left},onClick:ye=>ye.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let ye=new Date,lt=new Date(ye);lt.setDate(ye.getDate()+1);let Et=new Date(ye);Et.setDate(ye.getDate()+7);let Qt=new Date(ye);return Qt.setDate(ye.getDate()+14),[{label:"Hoy",date:ye},{label:"Ma\xF1ana",date:lt},{label:"Pr\xF3xima semana",date:Et},{label:"2 semanas",date:Qt}].map((Er,_a)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:Mr=>Mr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:Mr=>Mr.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(me.id,{[be]:Er.date}),Ue(null);},children:Er.label},_a))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:ye=>ye.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:ye=>ye.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(me.id,{[be]:void 0}),Ue(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>Ue(ye=>ye?{...ye,month:new Date(ye.month.getFullYear(),ye.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:ke?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Ue(ye=>ye?{...ye,month:new Date(ye.month.getFullYear(),ye.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["D","L","M","M","J","V","S"].map((ye,lt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:ye},lt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let ye=ke?.month||new Date,lt=ye.getFullYear(),Et=ye.getMonth(),Qt=new Date(lt,Et,1).getDay(),ja=new Date(lt,Et+1,0).getDate(),Er=new Date,_a=[];for(let xa=Qt-1;xa>=0;xa--)_a.push({day:new Date(lt,Et,-xa).getDate(),date:new Date(lt,Et-1,new Date(lt,Et,-xa).getDate()),isCurrentMonth:false});for(let xa=1;xa<=ja;xa++)_a.push({day:xa,date:new Date(lt,Et,xa),isCurrentMonth:true});let Mr=42-_a.length;for(let xa=1;xa<=Mr;xa++)_a.push({day:xa,date:new Date(lt,Et+1,xa),isCurrentMonth:false});return _a.map((xa,On)=>{let Vr=xa.date.toDateString()===Er.toDateString(),Xr=(S?typeof S=="string"?new Date(S):S:null)?.toDateString()===xa.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:xa.isCurrentMonth?Xr?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:Xr?"#00E5CC":"transparent",boxShadow:Vr&&!Xr?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(me.id,{[be]:xa.date}),Ue(null);},children:xa.day},On)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:Ft(me)})});case "assignees":if(pe)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let Te=r.filter(ye=>me.assignees?.some(lt=>lt.id?lt.id===ye.id:lt.name===ye.name||lt.initials===ye.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsx(Fo,{assignedUsers:Te,availableUsers:r,onChange:ye=>{let lt=ye.map(Et=>({id:Et.id,name:Et.name,initials:Et.initials,color:Et.color}));v?.(me.id,{assignees:lt});}})});case "status":if(pe){let ye=me.progress===100?"\u2713":me.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:ye})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsx(Mp,{status:me.status||"todo",onChange:ye=>{v?.(me.id,{status:ye,progress:ye==="completed"?100:me.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:pe?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${me.progress}%`,backgroundColor:me.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[me.progress,"%"]})]});case "priority":let gt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},fe={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},Ne=gt[me.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:ye=>ye.stopPropagation(),children:jsx(Mo,{priority:Ne,onChange:ye=>{ye&&v?.(me.id,{priority:fe[ye]||"medium"});}})});default:return null}},dr=se=>[{id:"hide",label:"Hide Column",icon:ua.Hide,onClick:()=>m(se),disabled:se==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ua.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ua.SortDesc,onClick:()=>{}}],xr=se=>{let me=se.subtasks&&se.subtasks.length>0,q=Uo(e),pe=Ye.size>1&&Ye.has(se.id),ce=pe?q.filter(H=>Ye.has(H.id)):[se],B=ce.map(H=>H.id),re=ce.filter(H=>!(H.subtasks&&H.subtasks.length>0)),be=pe?` (${B.length})`:"",S=()=>{N?N(B,se.name):w?.(B);};return me?[{id:"addSubtask",label:Se?.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{D?.(se.id);}},{id:"duplicate",label:(Se?.contextMenu?.duplicateTask||"Duplicate Task")+be,icon:ua.Duplicate,onClick:()=>{C?.(B);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(Se?.contextMenu?.deleteTask||"Delete Task")+be,icon:ua.Delete,onClick:S}]:[{id:"edit",label:Se?.contextMenu?.editTask||"Edit Task",icon:ua.Pencil,onClick:()=>{c?.(se);}},{id:"addSubtask",label:Se?.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{D?.(se.id);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(Se?.contextMenu?.markIncomplete||"Mark Incomplete")+be,icon:ua.MarkIncomplete,onClick:()=>{re.forEach(H=>v?.(H.id,{status:"todo",progress:0}));},disabled:re.length===0||re.every(H=>H.status==="todo")},{id:"setInProgress",label:(Se?.contextMenu?.setInProgress||"Set In Progress")+be,icon:ua.SetInProgress,onClick:()=>{re.forEach(H=>v?.(H.id,{status:"in-progress"}));},disabled:re.length===0||re.every(H=>H.status==="in-progress")},{id:"markComplete",label:(Se?.contextMenu?.markComplete||"Mark Complete")+be,icon:ua.MarkComplete,onClick:()=>{re.forEach(H=>v?.(H.id,{status:"completed",progress:100}));},disabled:re.length===0||re.every(H=>H.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(Se?.contextMenu?.duplicateTask||"Duplicate Task")+be,icon:ua.Duplicate,onClick:()=>{C?.(B);}},{id:"split",label:Se?.contextMenu?.splitTask||"Split Task",icon:ua.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(Se?.contextMenu?.deleteTask||"Delete Task")+be,icon:ua.Delete,onClick:S}]},Ra=d.filter(se=>se.visible),Ja=Ra.reduce((se,me)=>se+me.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:Ja},children:[jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${he}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:Ra.map((se,me)=>{let q=me===Ra.length-1,pe=se.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${pe?"":"justify-center"}`,style:{width:`${se.width}px`,minWidth:`${se.minWidth??(pe?200:60)}px`,maxWidth:`${se.maxWidth??2e3}px`,flexShrink:pe&&Ra.length===1?1:0,flexGrow:pe&&Ra.length===1?1:0,borderRight:q?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:ce=>{ce.preventDefault(),ee({isOpen:true,x:ce.clientX,y:ce.clientY,type:"header",columnId:se.id});},onMouseEnter:ce=>{ce.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:ce=>{ce.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:se.label,children:se.label}),se.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:Be===se.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:ce=>{ce.preventDefault(),ce.stopPropagation(),le(se.id),$e(ce.clientX),je(se.width);},title:"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:Be===se.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},se.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(fl,{columns:d,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>at(!ue),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),ue&&jsxs("div",{ref:yt,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:se=>se.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>at(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxs("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:Fe},children:[Ht.map(({task:se,level:me},q)=>{let pe=Xt(se.id),ce=Tt(q),B=Ie===se.id,re=B&&st==="above",be=B&&st==="below",S=B&&st==="child",H={};return S&&(H.backgroundColor=`${t.accent}15`,H.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":se.id,className:`flex items-center cursor-pointer group ${Ae===se.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,borderLeft:pe?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:pe?t.accentLight:S?`${t.accent}15`:q%2===0?t.bgPrimary:t.bgGrid,opacity:A?se.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...H},onMouseEnter:()=>Ce(se.id),onMouseLeave:()=>Ce(null),onClick:Z=>{let gt=Uo(e).map(ye=>ye.id),Ne=navigator.platform.toUpperCase().indexOf("MAC")>=0?Z.metaKey:Z.ctrlKey;vt(se.id,gt,Ne,Z.shiftKey),o?.(se.id),!Ne&&!Z.shiftKey&&s?.(se);},onDoubleClick:Z=>{Z.stopPropagation(),c?.(se);},onContextMenu:Z=>{Z.preventDefault(),ee({isOpen:true,x:Z.clientX,y:Z.clientY,type:"task",task:se}),l?.(se,Z);},whileHover:{backgroundColor:pe?t.accentLight:t.hoverBg},children:[re&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),be&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),Ra.map((Z,Te)=>{let gt=Te===Ra.length-1,fe=Z.id==="name",Ne=!!(se.subtasks&&se.subtasks.length>0),ye=Z.id==="assignees"||Z.id==="startDate"||Z.id==="endDate"?Z.id:null,Et=!!ye&&!Ne&&W===se.id&&!I,Qt=ce&&!!I&&I.column===Z.id;return jsxs("div",{className:`px-4 flex items-center ${fe?"justify-start":"justify-center"}`,style:{position:"relative",width:`${Z.width}px`,minWidth:`${Z.minWidth??(fe?200:60)}px`,maxWidth:`${Z.maxWidth??2e3}px`,flexShrink:fe&&Ra.length===1?1:0,flexGrow:fe&&Ra.length===1?1:0,borderRight:gt?"none":`1px solid ${W===se.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:Qt?`${t.accent}22`:void 0,boxShadow:Qt?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[Ia(Z,se,fe?me:0),Et&&ye&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:ja=>rt(ja,se.id,ye,q),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${se.id}-${Z.id}`)})]},se.id)}),T&&jsxs("button",{type:"button","data-anadir-tarea":true,onClick:T.onClick,className:"w-full flex items-center gap-2 px-3 text-left text-[13px] transition-colors",style:{height:`${a}px`,color:t.textTertiary,borderBottom:`1px solid ${t.borderLight}`},onMouseEnter:se=>{se.currentTarget.style.color=t.textPrimary;},onMouseLeave:se=>{se.currentTarget.style.color=t.textTertiary;},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),T.label]})]}),jsx(ys,{isOpen:tt.isOpen,x:tt.x,y:tt.y,items:tt.type==="header"&&tt.columnId?dr(tt.columnId):tt.type==="task"&&tt.task?xr(tt.task):[],onClose:()=>ee({...tt,isOpen:false}),theme:t}),L&&_e&&Ae&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:_e.x+12,top:_e.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let se=Ht.find(me=>me.task.id===Ae)?.task;return se?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:se.name})}):null})()}),document.body)]})}function ug(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,i]=useState(e),[c,l]=useState(t),[p,u]=useState(null),[d,m]=useState(null),[f,v]=useState(null),[b,h]=useState(null),[y,x]=useState(0),[w,C]=useState(0),[P,O]=useState(null),[T,D]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:p,setConnectionLine:u,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:b,setDraggedSegmentIndex:h,draggedSegmentStartX:y,setDraggedSegmentStartX:x,segmentDragOffsetX:w,setSegmentDragOffsetX:C,hoveredSegmentIndex:P,setHoveredSegmentIndex:O,isHovered:T,setIsHovered:D,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(Y,A)=>{r("none"),u(null),m(null),i(Y),l(A),C(0),h(null),x(0);}}}function yl({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:i,onClick:c,onDoubleClick:l,onContextMenu:p,onDateChange:u,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:b,showTaskBarLabels:h=true,showCriticalPath:y=true,readOnly:x=false,onProgressChange:w}){let C=ug(t,r),P=useRef(null),O=useRef(false),T=useRef(null),D=useRef(null),{dragMode:M,setDragMode:N,dragOffset:z,setDragOffset:$,ghostX:Y,setGhostX:A,ghostWidth:Se,setGhostWidth:W,connectionLine:Ce,setConnectionLine:R,hoveredTaskId:we,setHoveredTaskId:G,activeZone:Ve,setActiveZone:oe,draggedSegmentIndex:Be,setDraggedSegmentIndex:le,draggedSegmentStartX:He,setDraggedSegmentStartX:$e,segmentDragOffsetX:Pe,setSegmentDragOffsetX:je,hoveredSegmentIndex:tt,setHoveredSegmentIndex:ee,isHovered:Ae,setIsHovered:ot,isDragging:Ie,isResizing:zt,isConnecting:st,resetDragState:bt}=C,Ee=18,Dt=!!n.executionBarBg,ht=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",_e=Dt?3:6,dt=e.subtasks&&e.subtasks.length>0,L=useRef(null),[J,xe]=(()=>{let q=useRef(null),[,pe]=useState(0);return [q.current,ce=>{q.current=ce,pe(B=>B+1);}]})(),I=!!w&&!x&&!dt&&!e.segments&&!!e.startDate&&!!e.endDate,j=e.endDate&&(()=>{let q=new Date;q.setHours(0,0,0,0);let pe=new Date(e.endDate);return pe.setHours(0,0,0,0),pe<q})()&&e.progress<100,ke=y&&e.isCriticalPath,Ue=n.name==="neutral"||n.today==="#1C1917",ue=e.status==="completed"||e.progress===100,at={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},Ye=y&&e.isCriticalPath||j?"#EF4444":e.color?e.color:e.priority&&at[e.priority]?at[e.priority]:n.taskBarPrimary,vt=x?"default":Ie?st?"crosshair":zt?"ew-resize":"grabbing":"grab",Xt=x?"default":"ew-resize",Ut=(q=>q>=80?20:q>=60?15:q>=50?12:10)(r),Ht=r<50,he=r<40;useEffect(()=>{v&&(!Ae||Ie||e.segments)&&v(null);},[Ae,Ie,e.segments,v]);let Fe=q=>q.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),Qe=()=>{let q=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return `${q} day${q!==1?"s":""}`},rt=q=>Math.round(q/s)*s,Tt=q=>{let pe=Math.round(q/s),ce=new Date(o);return ce.setDate(ce.getDate()+pe),ce},Ft=(q,pe)=>{for(let ce of m){if(ce.id===e.id)continue;let B=5;if(q>=ce.x-B&&q<=ce.x+ce.width+B&&pe>=ce.y-B&&pe<=ce.y+ce.height+B)return ce.id}return null},kt=useCallback((q,pe,ce)=>{if(x)return;q.preventDefault(),q.stopPropagation();let B=P.current?.ownerSVGElement;if(!B)return;let re=B.createSVGPoint();re.x=q.clientX,re.y=q.clientY;let be=re.matrixTransform(B.getScreenCTM()?.inverse()),S=ce!==void 0?ce:t,H=pe;if(!H){let Z=be.x-S;q.shiftKey?(H="connect",R({x:t+r,y:a+Ee/2})):q.ctrlKey||q.metaKey?H="move":q.altKey?H=Z<r/2?"resize-start":"resize-end":he?Z<r/2?H="move":H="resize-end":Ht?Z<=Ut/2?H="resize-start":Z>=r-Ut/2?H="resize-end":H="move":Z<=Ut?H="resize-start":Z>=r-Ut?H="resize-end":H="move";}O.current=false,N(H),ot(false),oe(null),H==="move"?$(be.x-S):H==="connect"?R({x:t+r,y:a+Ee/2}):$(0),A(S),W(r);},[t,r,a,Ee,x]),Da=useCallback(q=>{let pe=P.current?.ownerSVGElement;if(!pe)return;let ce=pe.closest(".gantt-timeline-scroll");if(!ce)return;let B=ce.getBoundingClientRect(),re=60,be=15,S=0;if(q.clientX<B.left+re){let H=B.left+re-q.clientX;S=-Math.min(be,H/2);}else if(q.clientX>B.right-re){let H=q.clientX-(B.right-re);S=Math.min(be,H/2);}return S!==0&&(ce.scrollLeft+=S),S!==0},[]),aa=useCallback(q=>{if(M==="none")return;O.current=true,D.current=q;let pe=P.current?.ownerSVGElement;if(!pe)return;if(M==="move"||M==="resize-start"||M==="resize-end"){let re=Da(q);re&&!T.current?T.current=window.setInterval(()=>{D.current&&(Da(D.current),aa(D.current));},16):!re&&T.current&&(window.clearInterval(T.current),T.current=null);}let ce=pe.createSVGPoint();ce.x=q.clientX,ce.y=q.clientY;let B=ce.matrixTransform(pe.getScreenCTM()?.inverse());if(M==="connect"){R({x:B.x,y:B.y});let re=Ft(B.x,B.y);G(re);}else if(M==="move"){let re=B.x-z,be=rt(re);A(be),W(r);let S=Math.round((be-t)/s);if(f?.(e.id,S,true),e.segments&&e.segments.length>0&&Be!==null){let H=be-He;je(H);}}else if(M==="resize-start"){let re=B.x,be=rt(re),S=t+r-be;S>=s&&(A(be),W(S));}else if(M==="resize-end"){let re=B.x,S=rt(re)-t;S>=s&&W(S);}},[M,t,r,s,z,e,rt,Be,He,Ft,G,R,A,W,je,f,Da]),cr=useCallback(()=>{if(T.current&&(window.clearInterval(T.current),T.current=null),D.current=null,M!=="none"){if(M==="connect")we&&d&&d(e,we),R(null),G(null);else {let q=e.endDate.getTime()-e.startDate.getTime(),pe,ce,B=true;if(M==="move"){if(pe=Tt(Y),ce=new Date(pe.getTime()+q),e.segments&&e.segments.length>0&&Be!==null){let re=Math.round(Pe/s),be=e.segments.map((Te,gt)=>{if(gt===Be){let fe=new Date(Te.startDate),Ne=new Date(Te.endDate);return fe.setDate(fe.getDate()+re),Ne.setDate(Ne.getDate()+re),{startDate:fe,endDate:Ne}}return Te}),S=be.flatMap(Te=>[Te.startDate,Te.endDate]),H=new Date(Math.min(...S.map(Te=>Te.getTime()))),Z=new Date(Math.max(...S.map(Te=>Te.getTime())));u?.({...e,segments:be},H,Z),bt(t,r);return}}else M==="resize-start"?(pe=Tt(Y),ce=e.endDate,pe>ce&&(console.warn("Invalid date range: start date must be before or equal to end date"),B=false)):M==="resize-end"?(pe=e.startDate,ce=Tt(Y+Se),ce.setDate(ce.getDate()-1),ce<pe&&(console.warn("Invalid date range: end date must be after or equal to start date"),B=false)):B=false;B&&pe&&ce&&(ce.getTime()<pe.getTime()?console.warn("Invalid date range: end date cannot be before start date"):u?.(e,pe,ce));}f?.(e.id,0,false),bt(t,r);}},[M,Y,Se,e,u,we,d,t,r,s,Tt,Pe,Be,bt,f]);useEffect(()=>{if(M==="none")return;let q=ce=>{aa(ce);},pe=()=>{cr();};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",pe),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",pe),T.current&&(window.clearInterval(T.current),T.current=null);}},[M,aa,cr]);let Xe=Ie&&!st?Y:t,et=Ie&&!st?Se:r,Sa=i.taskClass(e),Ia=24,dr=y?e.isCriticalPath?1:.25:1,xr=useCallback(q=>{if(!I)return;q.stopPropagation(),q.preventDefault();let ce=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;L.current={barRect:ce,initialPct:e.progress||0},q.currentTarget.setPointerCapture(q.pointerId),xe(e.progress||0);},[I,e.progress,xe]),Ra=useCallback(q=>{let pe=L.current;if(!pe)return;let B=P.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??pe.barRect;if(!B||B.width<=0)return;let re=(q.clientX-B.left)/B.width,be=Math.round(Math.max(0,Math.min(1,re))*100);q.shiftKey&&(be=Math.round(be/25)*25),xe(be);},[xe]),Ja=useCallback(q=>{let pe=L.current;if(!pe)return;q.stopPropagation(),q.preventDefault();try{q.currentTarget.releasePointerCapture(q.pointerId);}catch{}let ce=J;L.current=null,xe(null),ce!=null&&ce!==pe.initialPct&&w&&w(e,ce);},[J,w,e,xe]),se=useCallback(q=>{q.stopPropagation(),q.preventDefault();},[]),me=J??(e.progress||0);return jsxs("g",{ref:P,"data-task-bar":"true","data-estado":ue?"completed":j?"overdue":"planned","data-resumen":dt?"true":void 0,style:{opacity:dr,transition:"opacity 300ms ease"},onClick:()=>{!Ie&&!O.current&&c?.(e),O.current=false;},onDoubleClick:q=>{!Ie&&!O.current&&(q.stopPropagation(),l?.(e));},onContextMenu:q=>{q.preventDefault(),p?.(e,q);},onMouseEnter:()=>!Ie&&ot(true),onMouseMove:q=>{v&&Ae&&!Ie&&!e.segments&&v({task:e,x:t,y:a,width:r,height:Ee,showBelow:false,mouseX:q.clientX,mouseY:q.clientY});},onMouseLeave:()=>{Ie||(ot(false),oe(null));},children:[jsx("rect",{x:t,y:a,width:r+Ia,height:Ee,fill:"transparent",style:{pointerEvents:"all"}}),Ae&&!Ie&&!Ht&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ut,height:Ee,fill:Ve==="resize-start"?n.accent:"transparent",opacity:Ve==="resize-start"?.15:0,style:{cursor:Xt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-start"),onMouseDown:q=>kt(q,"resize-start")}),jsx("rect",{x:t+Ut,y:a,width:r-Ut*2,height:Ee,fill:Ve==="move"?n.accent:"transparent",opacity:Ve==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:q=>kt(q,"move")}),jsx("rect",{x:t+r-Ut,y:a,width:Ut,height:Ee,fill:Ve==="resize-end"?n.accent:"transparent",opacity:Ve==="resize-end"?.15:0,style:{cursor:Xt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:q=>kt(q,"resize-end")})]}),Ae&&!Ie&&he&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:Ee,fill:Ve==="move"?n.accent:"transparent",opacity:Ve==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>oe("move"),onMouseDown:q=>kt(q,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:Ee,fill:Ve==="resize-end"?n.accent:"transparent",opacity:Ve==="resize-end"?.2:0,style:{cursor:Xt,pointerEvents:"all"},onMouseEnter:()=>oe("resize-end"),onMouseDown:q=>kt(q,"resize-end")}),Ae&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+Ee-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),Ie&&!st&&!e.segments&&jsx(motion.rect,{x:Y,y:a,width:Se,height:Ee,rx:_e,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),b&&e.baselineStartDate&&e.baselineEndDate&&!Ie&&(()=>{let q=e.baselineStartDate.getTime(),pe=e.baselineEndDate.getTime(),ce=o.getTime(),B=864e5,re=(q-ce)/B,be=(pe-q)/B,S=re*s,H=Math.max(be*s,s),Z=Xe+et,Te=S+H,gt=e.endDate?.getTime()??0,fe=Math.ceil((gt-pe)/B),Ne=fe>0,ye=fe<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:S,y:a,width:H,height:Ee,rx:_e,fill:"none",stroke:ht?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),Ne&&Z>Te&&jsx("rect",{x:Te,y:a,width:Z-Te,height:Ee,rx:0,fill:"#EF4444",opacity:.2}),Ne&&jsxs("text",{x:Math.max(Z,Te)+6,y:a+Ee/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",fe,"d"]}),ye&&jsxs("text",{x:Z+6,y:a+Ee/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[fe,"d"]})]})})(),!e.segments&&Dt&&dt&&(()=>{let pe=a+(Ee-8)/2,ce=4,B=e.progress||0,re=new Date;re.setHours(0,0,0,0);let be=e.startDate&&re>=e.startDate,S=e.endDate&&(()=>{let Ne=new Date(e.endDate);return Ne.setHours(0,0,0,0),re>Ne})(),H=e.startDate&&re<e.startDate,Z=1;if(be&&e.startDate&&e.endDate&&!H){let Ne=new Date(e.startDate);Ne.setHours(0,0,0,0);let ye=new Date(e.endDate);ye.setHours(0,0,0,0);let lt=Math.max(1,(ye.getTime()-Ne.getTime())/(1e3*60*60*24)),Qt=Math.min((re.getTime()-Ne.getTime())/(1e3*60*60*24),lt)/lt*100;Z=Qt>0?B/Qt:1;}let Te;B>=100?Te="#00E5CC":H?Te="#4B5563":S&&B<100?Te="#EF4444":Z>=.95?Te="#22C55E":Z>=.8?Te="#F59E0B":Te="#EF4444";let gt=Math.max(B/100*et,B>0?ce*2:0),fe=et>100&&B>0;return jsxs("g",{"data-task-class":Sa,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{"data-parte":"pista",x:Xe,y:pe,width:et,height:8,rx:ce,fill:"rgba(255,255,255,0.10)"}),B>0&&jsx("rect",{"data-parte":"avance",x:Xe,y:pe,width:gt,height:8,rx:ce,fill:Te}),fe&&jsxs("text",{x:Xe+gt+6,y:pe+8/2,dominantBaseline:"central",fill:"rgba(255,255,255,0.7)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(B),"%"]})]})})(),!e.segments&&Dt&&!dt&&jsx(motion.rect,{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":Sa,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!st?.15:e.parentId?.6:1,scale:Ae&&!Ie?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:q=>kt(q),style:{cursor:vt,pointerEvents:"all"}}),!e.segments&&!Dt&&jsx(motion.rect,{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:Ye,"data-task-class":Sa,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:Ie&&!st?.15:e.parentId?.6:Ae?.9:.8,scale:Ae&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:dt?void 0:q=>kt(q),style:{cursor:dt?"default":vt,pointerEvents:"all"}}),Dt&&(j||ke)&&!e.segments&&jsx("rect",{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:"none",stroke:n.criticalPath,strokeWidth:2,"data-parte":"alerta",style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),j&&!ue&&!e.segments&&!dt&&jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${Xe+et+4}, ${a+Ee/2-6})`,children:[jsx("circle",{cx:6,cy:6,r:5.25,fill:"none",stroke:"currentColor",strokeWidth:1.5}),jsx("line",{x1:6,y1:3.5,x2:6,y2:6.5,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}),jsx("circle",{cx:6,cy:8.6,r:.8,fill:"currentColor"})]}),!e.segments&&me>0&&!dt&&jsx("rect",{x:Xe,y:a,width:Math.max(et*(me/100),_e*2),height:Ee,rx:_e,fill:Ye,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!e.segments&&!dt&&e.progress<100&&(()=>{let q=e.progress>0?et*(e.progress/100):0,pe=Xe+q,ce=et-q,B=e.progress===0?_e:0,re=e.progress===0?Xe:pe,be=e.progress===0?et:ce;return jsxs(Fragment,{children:[jsx("rect",{x:re,y:a,width:be,height:Ee,rx:B,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsx("rect",{x:re,y:a,width:be,height:Ee,rx:B,fill:"none",stroke:Ye,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),Dt&&!e.segments&&e.progress>0&&e.progress<100&&!dt&&!Ie&&J===null&&(()=>{let q=Xe+et*(e.progress/100),pe=8,ce=e.assignees?.[0];return jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsx("circle",{cx:q,cy:a+Ee/2,r:pe,fill:ce?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:q,y:a+Ee/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:ce?.initials||ce?.name?.charAt(0)?.toUpperCase()||""})]})})(),I&&!Ie&&et>=40&&(J!==null||me<88)&&(()=>{let q=Xe+et*(me/100),pe=a+Ee/2,ce=J!==null,B=ce?7:Ae?6:5,re=ce||Ae?1:.35,be=Xe+et-q,S=Math.max(4,Math.min(12,be-10)),H=12;return jsxs("g",{children:[jsx("rect",{x:q-H,y:pe-12,width:H+S,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:xr,onPointerMove:Ra,onPointerUp:Ja,onPointerCancel:Ja,onClick:se,onDoubleClick:se,onMouseDown:Z=>Z.stopPropagation()}),jsx("circle",{"data-parte":"asa-avance",cx:q,cy:pe,r:B,fill:"#FFFFFF",stroke:Ye,strokeWidth:2,opacity:re,style:{pointerEvents:"none",filter:ce?`drop-shadow(0 0 4px ${Ye})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),ce&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:q-20,y:pe-28,width:40,height:18,rx:4,fill:ht?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:Ye,strokeWidth:1}),jsxs("text",{x:q,y:pe-16,textAnchor:"middle",dominantBaseline:"central",fill:ht?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[J,"%"]})]})]})})(),e.segments&&e.segments.map((q,pe)=>{let ce=(q.startDate.getTime()-o.getTime())/864e5*s,re=(q.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-ce+s,be=Ie&&M==="move"&&Be===pe,S=tt===pe,H=be?ce+Pe:ce;return jsxs("g",{onMouseEnter:()=>!Ie&&ee(pe),onMouseLeave:()=>!Ie&&ee(null),children:[jsx(motion.rect,{x:H,y:a,width:re,height:Ee,rx:_e,fill:Ye,initial:{opacity:0,scale:.95},animate:{opacity:be||e.parentId?.6:S?.9:.8,scale:S&&!Ie?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:Z=>{Z.stopPropagation(),le(pe),$e(ce),kt(Z,void 0,ce);},style:{cursor:vt,pointerEvents:"all"}}),jsx("rect",{x:H,y:a,width:re*(e.progress/100),height:Ee,rx:_e,fill:Ye,opacity:1,style:{pointerEvents:"none"}})]},`segment-${pe}`)}),Ue&&(j||ke)&&!e.segments&&jsxs(Fragment,{children:[ke&&!j&&jsx("rect",{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),j&&jsx("rect",{x:Xe,y:a,width:et,height:Ee,rx:_e,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),h&&et>60&&!e.segments&&!(Dt&&dt)&&(()=>{let q=i.taskLabel(e),pe=typeof q=="string"?q:e.name,ce=pe.length>Math.floor(et/8)?`${pe.substring(0,Math.floor(et/8))}...`:pe;return jsx("text",{"data-parte":"etiqueta",x:Xe+8,y:a+Ee/2,dominantBaseline:"middle",fill:ue?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:ue?"line-through":"none"},children:ce})})(),!Ie&&!e.segments&&!dt&&e.progress>0&&e.progress<100&&(Dt?jsxs("text",{x:Xe+et+6,y:a+Ee/2,dominantBaseline:"middle",fill:"#FFFFFF",fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):et>100?jsxs("text",{x:Xe+et-12,y:a+Ee/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),e.status&&et>80&&!Ie&&!e.segments&&!(Dt&&dt)&&jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Xe+et-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Xe+et-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Ae||zt)&&!st&&!e.segments&&!dt&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Xe-2,y:a,width:16,height:Ee,fill:"transparent",style:{cursor:Xt},onMouseEnter:()=>oe("resize-start"),onMouseLeave:()=>oe(null),onMouseDown:q=>{q.stopPropagation(),kt(q,"resize-start");}}),jsx(motion.rect,{x:Xe+4,y:a+8,width:3,height:Ee-16,rx:1.5,fill:Ve==="resize-start"||M==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Xe+et-14,y:a,width:16,height:Ee,fill:"transparent",style:{cursor:Xt},onMouseEnter:()=>oe("resize-end"),onMouseLeave:()=>oe(null),onMouseDown:q=>{q.stopPropagation(),kt(q,"resize-end");}}),jsx(motion.rect,{x:Xe+et-7,y:a+8,width:3,height:Ee-16,rx:1.5,fill:Ve==="resize-end"||M==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Ae&&!Ie&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t+r+10,cy:a+Ee/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>oe("connect"),onMouseLeave:()=>oe(null),onMouseDown:q=>{q.stopPropagation(),kt(q,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+Ee/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Ve==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),st&&Ce&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:t+r,y1:a+Ee/2,x2:Ce.x,y2:Ce.y,stroke:we?n.statusCompleted:n.accent,strokeWidth:we?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:we?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:Ce.x,cy:Ce.y,r:we?8:6,fill:we?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),we&&jsx(motion.text,{x:Ce.x+15,y:Ce.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:Ce.x+10},animate:{opacity:1,x:Ce.x+15},transition:{duration:.2},children:"Connect"})]}),(Ae||Ie)&&!st&&!e.segments&&jsx(motion.rect,{x:Xe-1,y:a-1,width:et+2,height:Ee+2,rx:_e+1,fill:"none",stroke:Ie?n.accent:Dt?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:Dt?1:2,opacity:Ie||Dt?.6:.4,initial:{opacity:0},animate:{opacity:Ie||Dt?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),zt&&jsxs(Fragment,{children:[jsx("line",{x1:Y,y1:0,x2:Y,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:Y+Se,y1:0,x2:Y+Se,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Ae&&!Ie&&!e.segments&&!v&&(()=>{let ce=a<100,B=ce?a+Ee+13:a-82-13,re=ce?`M ${Xe+et/2-6} ${a+Ee+3} L ${Xe+et/2} ${a+Ee+13} L ${Xe+et/2+6} ${a+Ee+3}`:`M ${Xe+et/2-6} ${a-13} L ${Xe+et/2} ${a-3} L ${Xe+et/2+6} ${a-13}`,be=B+22,S=B+40,H=B+55,Z=B+70,Te=ce?B+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:ce?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:ce?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:re,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:Xe+et/2-120,y:B,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Xe+et/2,y:be,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Xe+et/2-110,y:S,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Start:"}),jsx("text",{x:Xe+et/2-70,y:S,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe(e.startDate)}),jsx("text",{x:Xe+et/2-110,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"End:"}),jsx("text",{x:Xe+et/2-70,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Fe(e.endDate)}),jsx("text",{x:Xe+et/2+10,y:S,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Duration:"}),jsx("text",{x:Xe+et/2+65,y:S,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Qe()}),jsx("text",{x:Xe+et/2+10,y:H,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Progress:"}),jsxs("text",{x:Xe+et/2+65,y:H,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Xe+et/2-110,y:Z,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:"Assignees:"}),jsxs("text",{x:Xe+et/2-50,y:Z,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(gt=>gt.name).join(", ").substring(0,30),e.assignees.map(gt=>gt.name).join(", ").length>30?"...":""]})]}),!ce&&jsx("text",{x:Xe+et/2,y:Te,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:he?"Left: move \u2022 Right: resize":Ht?"Drag to move \u2022 Hold ALT + drag edge to resize":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Ld=260,ws=8,gg=16,Sw=-12;function fg({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:w,mouseY:C}=e,P=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,O=x.lastActivity!=null,T=(P?155:105)+(O?28:0),D=w+gg,M=C+Sw-T;D+Ld>window.innerWidth-ws&&(D=w-Ld-gg),D<ws&&(D=ws);let N=M<ws;N&&(M=C+20),M+T>window.innerHeight-ws&&(M=window.innerHeight-ws-T),s({left:D,top:M,showBelow:N});},[e]),!e||!n)return null;let{task:o}=e,i=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted",tags:a==="es"?"Etiqueta":"Tag"},l=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),p=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let M=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${M} d\xEDa${M!==1?"s":""}`:`${M} day${M!==1?"s":""}`}let x=r.enabledWeekdays,w=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),C=M=>`${M.getFullYear()}-${String(M.getMonth()+1).padStart(2,"0")}-${String(M.getDate()).padStart(2,"0")}`,P=0,O=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),T=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;O.getTime()<=T.getTime();){let M=O.getDay();x[M]&&!w.has(C(O))&&P++,O.setDate(O.getDate()+1);}let D=Math.max(0,P);return a==="es"?`${D} d\xEDa${D!==1?"s":""}`:`${D} day${D!==1?"s":""}`},u=x=>{if(x==null||x===0)return "N/A";let w=Math.floor(x/60),C=x%60;return w===0?`${C}m`:C===0?`${w}h`:`${w}h ${C}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",b=t.bgSecondary||"#1F2937",h=t.border||"#374151",y=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Ld,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${h}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(xl,{label:c.start,value:o.startDate?l(o.startDate):"N/A",labelColor:d,valueColor:m}),jsx(xl,{label:c.duration,value:p(),labelColor:d,valueColor:m}),jsx(xl,{label:c.end,value:o.endDate?l(o.endDate):"N/A",labelColor:d,valueColor:m}),jsx(xl,{label:c.progress,value:`${o.progress}%`,labelColor:d,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[c.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxs("span",{style:{color:d},children:[c.tags,": "]}),jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(x=>jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${x.color}22`,color:x.color,border:`1px solid ${x.color}55`,whiteSpace:"nowrap"},children:x.name},x.id))})]}),i&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.logged,":"]})," ",jsx("span",{style:{color:v,fontWeight:600},children:u(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:u(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
125
|
+
- [ ] `,priority:"MEDIUM",labels:["meeting"]}}];function eu({templates:e,onSelectTemplate:t,className:a}){let[r,n]=useState(false),s=useRef(null),o=useRef(null);useEffect(()=>{function l(u){s.current&&!s.current.contains(u.target)&&o.current&&!o.current.contains(u.target)&&n(false);}if(r)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[r]);let i=l=>{t(l),n(false);},c=e.reduce((l,u)=>{let p=u.category||"Other";return l[p]||(l[p]=[]),l[p].push(u),l},{});return jsxs("div",{className:g("relative inline-block",a),children:[jsxs("button",{ref:o,onClick:()=>n(!r),className:"flex items-center gap-2 px-3 py-2 rounded-lg border transition-all text-sm font-medium shadow-lg",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-primary)"},onMouseEnter:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",l.currentTarget.style.borderColor="var(--theme-border-secondary)";},onMouseLeave:l=>{l.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",l.currentTarget.style.borderColor="var(--theme-border-primary)";},title:"Create from template",children:[jsx("span",{className:"text-base leading-none",children:"\u{1F4CB}"}),jsx("span",{children:"Templates"}),jsx("svg",{className:g("w-4 h-4 transition-transform",r&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),r&&jsxs("div",{ref:s,className:"absolute top-full left-0 mt-2 min-w-[320px] max-w-[400px] rounded-xl backdrop-blur-xl border shadow-2xl z-50 overflow-hidden max-h-[500px] overflow-y-auto",style:{backgroundColor:"var(--theme-bg-primary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-4 py-3 border-b sticky top-0 backdrop-blur-sm",style:{borderColor:"var(--theme-border-primary)",backgroundColor:"var(--theme-bg-secondary)"},children:[jsx("span",{className:"text-sm font-bold uppercase tracking-wider",style:{color:"var(--theme-text-primary)"},children:"Card Templates"}),jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:"Quick start with pre-configured cards"})]}),Object.entries(c).map(([l,u])=>jsxs("div",{className:"py-2",children:[jsx("div",{className:"px-4 py-2",children:jsx("h4",{className:"text-xs font-semibold uppercase tracking-wider",style:{color:"var(--theme-text-secondary)"},children:l})}),jsx("div",{children:u.map(p=>jsxs("button",{onClick:()=>i(p),className:"w-full px-4 py-3 flex items-start gap-3 text-left transition-all active:scale-[0.98]",style:{color:"var(--theme-text-primary)"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-2xl leading-none mt-0.5",children:p.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"font-semibold text-sm",style:{color:"var(--theme-text-primary)"},children:p.name}),p.description&&jsx("p",{className:"text-xs mt-0.5",style:{color:"var(--theme-text-tertiary)"},children:p.description})]})]},p.id))})]},l)),e.length===0&&jsx("div",{className:"px-4 py-8 text-center",style:{color:"var(--theme-text-tertiary)"},children:jsx("p",{className:"text-sm",children:"No templates available"})})]})]})}function au({board:e,isOpen:t,onClose:a,onImport:r,boardElementRef:n,className:s}){let[o,i]=useState("export"),[c,l]=useState("json"),[u,p]=useState(null),d=useRef(null);if(!t)return null;let m=async()=>{let v=n?.current||void 0,b=await xm(e,c,v);vm(b,c);},f=async v=>{let b=v.target.files?.[0];if(b){try{let w=await Cm(b),h=b.name.endsWith(".json")?"json":"csv",x=km(w,h);p(x),x.success&&r&&r(x,w);}catch(w){p({success:false,errors:[`Failed to read file: ${w instanceof Error?w.message:"Unknown error"}`]});}d.current&&(d.current.value="");}};return jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",s),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:a}),jsxs("div",{className:"relative bg-gradient-to-br from-gray-900/95 to-gray-800/95 backdrop-blur-xl rounded-2xl border border-white/20 shadow-2xl max-w-2xl w-full mx-4",children:[jsxs("div",{className:"px-6 py-5 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-2xl font-bold text-white flex items-center gap-3",children:[jsx("span",{className:"text-3xl",children:"\u{1F4E6}"}),"Export / Import"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Transfer your board data"})]}),jsx("button",{onClick:a,className:"text-white/50 hover:text-white transition-colors text-2xl leading-none p-2 hover:bg-white/10 rounded-lg","aria-label":"Close",children:"\xD7"})]}),jsxs("div",{className:"flex border-b border-white/10",children:[jsx("button",{onClick:()=>i("export"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="export"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Export"}),jsx("button",{onClick:()=>i("import"),className:g("flex-1 px-6 py-4 font-semibold transition-colors",o==="import"?"text-white border-b-2 border-[#00E5CC]":"text-white/50 hover:text-white/80"),children:"Import"})]}),jsxs("div",{className:"p-6",children:[o==="export"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Select format"}),jsx("div",{className:"grid grid-cols-3 gap-3",children:["json","csv","pdf"].map(v=>jsxs("button",{onClick:()=>l(v),className:g("p-4 rounded-lg border-2 transition-all text-center",c===v?"border-[#00E5CC] bg-[#00E5CC]/20 text-white":"border-white/20 hover:border-white/40 text-white/70 hover:text-white"),children:[jsxs("div",{className:"text-2xl mb-2",children:[v==="json"&&"\u{1F4C4}",v==="csv"&&"\u{1F4CA}",v==="pdf"&&"\u{1F4DD}"]}),jsx("div",{className:"font-semibold uppercase text-xs",children:v})]},v))})]}),jsxs("div",{className:"bg-white/5 rounded-lg p-4",children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:"Preview"}),jsxs("div",{className:"text-xs text-white/60",children:[jsxs("div",{children:["Board: ",jsx("span",{className:"text-white/90",children:e.title||"Untitled"})]}),jsxs("div",{children:["Columns: ",jsx("span",{className:"text-white/90",children:e.columns.length})]}),jsxs("div",{children:["Cards: ",jsx("span",{className:"text-white/90",children:e.cards.length})]})]})]}),jsx("button",{onClick:m,className:"w-full py-3 px-4 bg-gradient-to-r from-[#00C4AE] to-[#00C4AE] hover:from-[#00E5CC] hover:to-[#00C4AE] text-white font-semibold rounded-lg transition-all shadow-lg shadow-[#00E5CC]/20",children:"Export Board"})]}),o==="import"&&jsxs("div",{className:"space-y-6",children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-3",children:"Upload file"}),jsx("input",{ref:d,type:"file",accept:".json,.csv",onChange:f,className:"hidden"}),jsxs("button",{onClick:()=>d.current?.click(),className:"w-full py-12 px-4 border-2 border-dashed border-white/30 hover:border-white/50 rounded-lg transition-colors text-white/70 hover:text-white",children:[jsx("div",{className:"text-5xl mb-3",children:"\u{1F4C1}"}),jsx("div",{className:"font-semibold mb-1",children:"Click to select file"}),jsx("div",{className:"text-xs text-white/50",children:"Supports JSON and CSV files"})]})]}),u&&jsxs("div",{className:g("p-4 rounded-lg",u.success?"bg-green-500/20 border border-green-500/30":"bg-red-500/20 border border-red-500/30"),children:[jsx("h3",{className:g("font-semibold mb-2",u.success?"text-green-400":"text-red-400"),children:u.success?"\u2713 Import Successful":"\u2717 Import Failed"}),u.success&&jsxs("div",{className:"text-sm text-white/80",children:[jsxs("div",{children:["Cards imported: ",u.cardsImported]}),jsxs("div",{children:["Columns imported: ",u.columnsImported]})]}),u.errors&&u.errors.length>0&&jsx("div",{className:"mt-2 text-sm",children:u.errors.map((v,b)=>jsxs("div",{className:"text-red-300",children:["\u2022 ",v]},b))})]})]})]})]})]})}var Pw=["URGENT","HIGH","MEDIUM","LOW"],Fw=[{value:"none",label:"None"},{value:"created",label:"Date Created"},{value:"priority",label:"Priority"},{value:"dueDate",label:"Due Date"},{value:"title",label:"Title"},{value:"estimate",label:"Estimate"}],Lw=[{value:"none",label:"No Grouping"},{value:"priority",label:"By Priority"},{value:"assignee",label:"By Assignee"},{value:"label",label:"By Label"}];function ru({filters:e,sort:t,onFiltersChange:a,onSortChange:r,onReset:n,onFilterMyTasks:s,onFilterOverdue:o,onFilterHighPriority:i,availableUsers:c=[],availableLabels:l=[],availableColumns:u=[],showQuickFilters:p=true,compact:d=false,groupBy:m="none",onGroupByChange:f}){let[v,b]=useState(true),w=useCallback(M=>{a({search:M.target.value});},[a]),h=useCallback(M=>{a({dateFilter:M.target.value});},[a]),x=useCallback(M=>{r({by:M.target.value});},[r]),y=useCallback(()=>{r({order:t.order==="asc"?"desc":"asc"});},[t.order,r]),k=e.search||e.dateFilter!=="all"||e.priorities.length>0||e.assignees.length>0||e.labels.length>0||t.by!=="none";return jsxs("div",{className:`filter-bar ${d?"filter-bar--compact":""} ${v?"filter-bar--collapsed":""}`,children:[jsxs("div",{className:"filter-bar__header",onClick:()=>b(!v),style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"8px",marginBottom:v?"0":"12px",padding:"4px 6px",borderRadius:"6px",transition:"all 0.2s ease"},onMouseEnter:M=>{M.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:M=>{M.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:v?"rotate(-90deg)":"rotate(0deg)",transition:"transform 0.2s",color:"var(--theme-text-secondary)"},children:jsx("polyline",{points:"6 9 12 15 18 9"})}),jsx("span",{className:"filter-bar__label",style:{fontWeight:500,fontSize:"0.875rem",color:"var(--theme-text-primary)"},children:"Filters & Grouping"}),k&&jsxs("span",{style:{color:"var(--theme-accent-primary)",fontSize:"0.75rem",fontWeight:600},children:["(",[e.search&&"search",e.dateFilter!=="all"&&"date",e.priorities.length>0&&"priority",e.assignees.length>0&&"assignee",e.labels.length>0&&"label",t.by!=="none"&&"sort"].filter(Boolean).length," active)"]})]}),!v&&jsxs("div",{className:"filter-bar__content",children:[p&&jsxs("div",{className:"filter-bar__quick",style:{marginBottom:"12px"},children:[jsx("span",{className:"filter-bar__label",children:"Quick:"}),s&&jsx("button",{onClick:s,className:"filter-bar__quick-btn",title:"Show only my tasks",children:"My Tasks"}),o&&jsx("button",{onClick:o,className:"filter-bar__quick-btn",title:"Show overdue tasks",children:"Overdue"}),i&&jsx("button",{onClick:i,className:"filter-bar__quick-btn",title:"Show high priority tasks",children:"High Priority"})]}),jsxs("div",{className:"filter-bar__main",children:[jsx("div",{className:"filter-bar__field",children:jsx("input",{type:"text",placeholder:"Search tasks...",value:e.search,onChange:w,className:"filter-bar__search"})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.dateFilter,onChange:h,className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Dates"}),jsx("option",{value:"overdue",children:"Overdue"}),jsx("option",{value:"today",children:"Today"}),jsx("option",{value:"this-week",children:"This Week"})]})}),jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.priorities[0]||"all",onChange:M=>{let H=M.target.value;a({priorities:H==="all"?[]:[H]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Priorities"}),Pw.map(M=>jsx("option",{value:M,children:M},M))]})}),c.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.assignees[0]||"all",onChange:M=>{let H=M.target.value;a({assignees:H==="all"?[]:[H]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Assignees"}),c.map(M=>jsx("option",{value:M.id,children:M.name},M.id))]})}),l.length>0&&jsx("div",{className:"filter-bar__field",children:jsxs("select",{value:e.labels[0]||"all",onChange:M=>{let H=M.target.value;a({labels:H==="all"?[]:[H]});},className:"filter-bar__select",children:[jsx("option",{value:"all",children:"All Labels"}),l.map(M=>jsx("option",{value:M,children:M},M))]})}),jsxs("div",{className:"filter-bar__field filter-bar__sort",children:[jsx("span",{className:"filter-bar__label",style:{color:"var(--theme-text-secondary)"},children:"Sort:"}),jsx("select",{value:t.by,onChange:x,className:"filter-bar__select filter-bar__select--sm",children:Fw.map(M=>jsx("option",{value:M.value,children:M.label},M.value))}),t.by!=="none"&&jsx("button",{onClick:y,className:"filter-bar__sort-toggle",title:`Sort ${t.order==="asc"?"descending":"ascending"}`,children:t.order==="asc"?"\u2191":"\u2193"})]}),f&&jsx("div",{className:"filter-bar__field",children:jsx("select",{value:m,onChange:M=>f(M.target.value),className:"filter-bar__select",style:{fontWeight:500,borderWidth:"2px"},children:Lw.map(M=>jsx("option",{value:M.value,children:M.label},M.value))})}),k&&jsx("button",{onClick:n,className:"filter-bar__reset",title:"Clear all filters",children:"Clear"})]})]})]})}function nu({onOpenExport:e,onOpenThemes:t,onOpenShortcuts:a,className:r,viewMode:n="kanban",onExportGanttPDF:s,onExportGanttExcel:o,onExportGanttPNG:i,onExportGanttCSV:c}){let[l,u]=useState(false),p=useRef(null);useEffect(()=>{let m=f=>{p.current&&!p.current.contains(f.target)&&u(false);};return l&&document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m);}},[l]);let d=m=>{m(),u(false);};return jsxs("div",{className:g("relative",r),ref:p,children:[jsxs("button",{onClick:()=>u(!l),className:"flex items-center gap-2 px-3 py-2 rounded-lg text-sm font-medium transition-all border",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)",color:"var(--theme-text-secondary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)",m.currentTarget.style.color="var(--theme-text-primary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-secondary)",m.currentTarget.style.color="var(--theme-text-secondary)";},"aria-label":"Configuration Menu","aria-expanded":l,children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"3"}),jsx("path",{d:"M12 1v6m0 6v6M5.6 5.6l4.2 4.2m4.2 4.2l4.2 4.2M1 12h6m6 0h6M5.6 18.4l4.2-4.2m4.2-4.2l4.2-4.2"})]}),jsx("span",{children:"Config"})]}),l&&jsxs("div",{className:"absolute right-0 mt-2 w-48 rounded-lg border shadow-lg overflow-hidden z-50",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[n==="kanban"?jsxs("button",{onClick:()=>d(e),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"})}),"Export"]}):jsxs(Fragment,{children:[jsxs("button",{onClick:()=>d(async()=>await s?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),jsx("polyline",{points:"10 9 9 9 8 9"})]}),"Export PDF"]}),jsxs("button",{onClick:()=>d(async()=>await o?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"12",y1:"18",x2:"12",y2:"12"}),jsx("line",{x1:"9",y1:"15",x2:"15",y2:"15"})]}),"Export Excel"]}),jsxs("button",{onClick:()=>d(async()=>await i?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),jsx("polyline",{points:"21 15 16 10 5 21"})]}),"Export PNG"]}),jsxs("button",{onClick:()=>d(()=>c?.()),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),jsx("polyline",{points:"14 2 14 8 20 8"}),jsx("line",{x1:"8",y1:"13",x2:"16",y2:"13"}),jsx("line",{x1:"8",y1:"17",x2:"16",y2:"17"})]}),"Export CSV"]})]}),jsxs("button",{onClick:()=>d(t),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{cx:"12",cy:"12",r:"5"}),jsx("path",{d:"M12 1v6m0 6v6m8.5-8.5L17 15M7 9L3.5 5.5M7 15l-3.5 3.5M20.5 5.5L17 9m3.5 11.5L17 17"})]}),"Themes"]}),jsxs("button",{onClick:()=>d(a),className:"w-full px-4 py-3 text-left text-sm font-medium transition-colors flex items-center gap-3",style:{color:"var(--theme-text-primary)"},onMouseEnter:m=>{m.currentTarget.style.backgroundColor="var(--theme-bg-tertiary)";},onMouseLeave:m=>{m.currentTarget.style.backgroundColor="transparent";},children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),jsx("path",{d:"M6 8h.01M10 8h.01M14 8h.01M18 8h.01M8 12h.01M12 12h.01M16 12h.01M7 16h10"})]}),"Shortcuts"]})]})]})}var ou={name:"dark",displayName:"Dark (Enhanced)",emoji:"\u{1F319}",colors:{bgPrimary:"#222326",bgSecondary:"#2A2B2F",bgTertiary:"#33343A",bgCard:"#2d2d2d",bgHover:"#353535",bgActive:"#404040",bgInput:"#2a2a2a",textPrimary:"#F4F5F8",textSecondary:"#AEB6C0",textTertiary:"#7A7F8A",textDisabled:"#606060",textInverse:"#1a1a1a",borderPrimary:"rgba(255, 255, 255, 0.1)",borderSecondary:"rgba(255, 255, 255, 0.05)",borderDefault:"#404040",borderHover:"#505050",borderSubtle:"#2a2a2a",accentPrimary:"#5E6AD2",accentHover:"#7780DD",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.1)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.2)",success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#00E5CC",danger:"#ef4444",dangerBorder:"rgba(239, 68, 68, 0.3)",dangerBackground:"rgba(239, 68, 68, 0.1)",dangerBackgroundHover:"rgba(239, 68, 68, 0.2)"},shadows:{sm:"0 1px 2px rgba(0, 0, 0, 0.3)",md:"0 4px 12px rgba(0, 0, 0, 0.4)",lg:"0 12px 32px rgba(0, 0, 0, 0.5)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},su={name:"light",displayName:"Light (Standard)",emoji:"\u2600\uFE0F",colors:{bgPrimary:"#FFFFFF",bgSecondary:"#F7F7F8",bgTertiary:"#EEEFF1",bgCard:"#ffffff",bgHover:"#f3f4f6",bgActive:"#e5e7eb",bgInput:"#f9fafb",textPrimary:"#1A1A1A",textSecondary:"#5A5A5A",textTertiary:"#8A8A8A",textDisabled:"#d1d5db",textInverse:"#ffffff",borderPrimary:"rgba(0, 0, 0, 0.1)",borderSecondary:"rgba(0, 0, 0, 0.05)",borderDefault:"#e5e7eb",borderHover:"#d1d5db",borderSubtle:"#f3f4f6",accentPrimary:"#5E6AD2",accentHover:"#4A56B8",interactivePrimary:"#0ea5e9",interactivePrimaryHover:"#0284c7",interactivePrimaryBorder:"rgba(14, 165, 233, 0.3)",interactivePrimaryBackground:"rgba(14, 165, 233, 0.08)",interactivePrimaryBackgroundHover:"rgba(14, 165, 233, 0.15)",success:"#059669",warning:"#D97706",error:"#DC2626",info:"#00E5CC",danger:"#dc2626",dangerBorder:"rgba(220, 38, 38, 0.3)",dangerBackground:"rgba(220, 38, 38, 0.08)",dangerBackgroundHover:"rgba(220, 38, 38, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.12)",md:"0 4px 12px rgba(0, 0, 0, 0.15)",lg:"0 12px 32px rgba(0, 0, 0, 0.2)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},iu={name:"neutral",emoji:"\u26AA",displayName:"Neutral (Zen)",colors:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgTertiary:"#E7E5E4",bgCard:"#FEFEFE",bgHover:"#F0EFEE",bgActive:"#E7E5E4",bgInput:"#FAFAF9",textPrimary:"#1C1917",textSecondary:"#57534E",textTertiary:"#A8A29E",textDisabled:"#D6D3D1",textInverse:"#FAFAF9",borderPrimary:"#E7E5E4",borderSecondary:"#F0EFEE",borderDefault:"#E7E5E4",borderHover:"#D6D3D1",borderSubtle:"#F5F5F4",accentPrimary:"#292524",accentHover:"#44403C",interactivePrimary:"#292524",interactivePrimaryHover:"#44403C",interactivePrimaryBorder:"rgba(41, 37, 36, 0.3)",interactivePrimaryBackground:"rgba(41, 37, 36, 0.06)",interactivePrimaryBackgroundHover:"rgba(41, 37, 36, 0.12)",success:"#15803D",warning:"#CA8A04",error:"#B91C1C",info:"#1D4ED8",danger:"#B91C1C",dangerBorder:"rgba(185, 28, 28, 0.3)",dangerBackground:"rgba(185, 28, 28, 0.08)",dangerBackgroundHover:"rgba(185, 28, 28, 0.15)"},shadows:{sm:"0 1px 3px rgba(0, 0, 0, 0.1)",md:"0 4px 12px rgba(0, 0, 0, 0.12)",lg:"0 12px 32px rgba(0, 0, 0, 0.15)"},radii:{sm:"6px",md:"8px",lg:"12px",full:"9999px"},spacing:{xs:"4px",sm:"8px",md:"16px",lg:"24px",xl:"32px"}},ps={dark:ou,light:su,neutral:iu},Yl="dark";var Xl=createContext(void 0),Uw="asakaa-theme";function e0({children:e,defaultTheme:t=Yl,storageKey:a=Uw}){let[r,n]=useState(()=>{if(typeof window<"u"){let i=localStorage.getItem(a);if(i&&(i==="dark"||i==="light"||i==="neutral"))return i}return t}),s=useCallback(i=>{n(i),typeof window<"u"&&localStorage.setItem(a,i);},[a]);useEffect(()=>{if(typeof window>"u")return;let i=document.documentElement,c=ps[r];Object.entries(c.colors).forEach(([u,p])=>{p&&i.style.setProperty(`--theme-${jw(u)}`,p);}),Object.entries({bgPrimary:"--asakaa-color-background-primary",bgSecondary:"--asakaa-color-background-secondary",bgTertiary:"--asakaa-color-background-tertiary",bgCard:"--asakaa-color-background-card",bgHover:"--asakaa-color-background-hover",bgActive:"--asakaa-color-background-active",bgInput:"--asakaa-color-background-input",textPrimary:"--asakaa-color-text-primary",textSecondary:"--asakaa-color-text-secondary",textTertiary:"--asakaa-color-text-tertiary",textDisabled:"--asakaa-color-text-disabled",textInverse:"--asakaa-color-text-inverse",borderPrimary:"--asakaa-color-border-primary",borderSecondary:"--asakaa-color-border-secondary",borderDefault:"--asakaa-color-border-default",borderHover:"--asakaa-color-border-hover",borderSubtle:"--asakaa-color-border-subtle",accentPrimary:"--asakaa-color-accent-primary",accentHover:"--asakaa-color-accent-hover",interactivePrimary:"--asakaa-color-interactive-primary",interactivePrimaryHover:"--asakaa-color-interactive-primaryHover",interactivePrimaryBorder:"--asakaa-color-interactive-primaryBorder",interactivePrimaryBackground:"--asakaa-color-interactive-primaryBackground",interactivePrimaryBackgroundHover:"--asakaa-color-interactive-primaryBackgroundHover",success:"--asakaa-color-status-success",warning:"--asakaa-color-status-warning",error:"--asakaa-color-status-error",info:"--asakaa-color-status-info",danger:"--asakaa-color-danger",dangerBorder:"--asakaa-color-danger-border",dangerBackground:"--asakaa-color-danger-background",dangerBackgroundHover:"--asakaa-color-danger-backgroundHover"}).forEach(([u,p])=>{let d=c.colors[u];d&&i.style.setProperty(p,d);}),i.setAttribute("data-theme",r),i.classList.remove("theme-dark","theme-light","theme-neutral"),i.classList.add(`theme-${r}`);},[r]);let o={theme:r,setTheme:s,themes:ps};return jsx(Xl.Provider,{value:o,children:e})}function Vs(){let e=useContext(Xl);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function jw(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function lu({isOpen:e,onClose:t,className:a}){let{theme:r,setTheme:n}=Vs();return e?jsxs("div",{className:g("fixed inset-0 z-[9999] flex items-center justify-center",a),children:[jsx("div",{className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),jsxs("div",{className:"relative rounded-2xl border shadow-2xl max-w-md w-full mx-4",style:{backgroundColor:"var(--theme-bg-secondary)",borderColor:"var(--theme-border-primary)"},children:[jsxs("div",{className:"px-6 py-5 border-b flex items-center justify-between",style:{borderColor:"var(--theme-border-primary)"},children:[jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--theme-text-primary)"},children:"Select Theme"}),jsx("button",{onClick:t,className:"text-2xl leading-none p-2 hover:bg-white/10 rounded-lg transition-colors",style:{color:"var(--theme-text-secondary)"},"aria-label":"Close",children:"\xD7"})]}),jsx("div",{className:"p-6 space-y-3",children:Object.entries(ps).map(([s,o])=>jsxs("button",{onClick:()=>{n(s),t();},className:g("w-full p-4 rounded-lg border-2 transition-all flex items-center gap-4",r===s?"border-[#00E5CC] bg-[#00E5CC]/20":"border-white/20 hover:border-white/40"),style:{backgroundColor:r===s?"var(--theme-accent-primary)20":"transparent"},children:[jsx("div",{className:"text-3xl",children:o.emoji}),jsxs("div",{className:"text-left flex-1",children:[jsx("div",{className:"font-semibold",style:{color:"var(--theme-text-primary)"},children:o.displayName}),jsxs("div",{className:"text-xs",style:{color:"var(--theme-text-secondary)"},children:[s==="dark"&&"Default dark theme with Linear-inspired colors",s==="light"&&"Clean light theme with high contrast",s==="neutral"&&"Monochrome zen theme"]})]}),r===s&&jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:jsx("path",{d:"M20 6L9 17l-5-5"})})]},s))})]})]}):null}var Dt={dark:{bgPrimary:"#050505",bgSecondary:"#0A0A0A",bgGrid:"rgba(255, 255, 255, 0.02)",bgWeekend:"rgba(17, 17, 17, 0.4)",border:"rgba(255, 255, 255, 0.08)",borderLight:"rgba(255, 255, 255, 0.05)",textPrimary:"rgba(255, 255, 255, 0.92)",textSecondary:"rgba(255, 255, 255, 0.60)",textTertiary:"rgba(255, 255, 255, 0.35)",accent:"#00E5CC",accentHover:"#5AADFF",accentLight:"rgba(0, 229, 204, 0.12)",taskBarPrimary:"#00E5CC",taskBarProgress:"#5AADFF",taskBarHandle:"#FFFFFF",dependency:"#444444",dependencyHover:"#FFFFFF",criticalPath:"#EF4444",criticalPathLight:"rgba(239, 68, 68, 0.15)",today:"#EF4444",todayLight:"rgba(239, 68, 68, 0.08)",milestone:"#FFFFFF",milestoneLight:"rgba(255, 255, 255, 0.1)",statusTodo:"#666666",statusInProgress:"#00E5CC",statusCompleted:"#10B981",hoverBg:"rgba(255, 255, 255, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(255, 255, 255, 0.05)",glassHeader:"#0A0A0A",glassToolbar:"rgba(0, 0, 0, 0.4)",forecastHud:"rgba(15, 15, 15, 0.9)",neonRedGlow:"0 0 8px rgba(239, 68, 68, 0.25)",executionBarBg:"rgba(0, 229, 204, 0.12)"},light:{bgPrimary:"#FFFFFF",bgSecondary:"#F8FAFC",bgGrid:"#F1F5F9",bgWeekend:"rgba(0, 196, 174, 0.03)",border:"#CBD5E1",borderLight:"#E2E8F0",textPrimary:"#0F172A",textSecondary:"#334155",textTertiary:"#64748B",accent:"#00E5CC",accentHover:"#1D4ED8",accentLight:"rgba(0, 196, 174, 0.08)",taskBarPrimary:"#00E5CC",taskBarProgress:"#00A893",taskBarHandle:"#FFFFFF",dependency:"#6B7280",dependencyHover:"#00E5CC",criticalPath:"#DC2626",criticalPathLight:"rgba(220, 38, 38, 0.1)",today:"#D21E24",todayLight:"rgba(210, 30, 36, 0.1)",milestone:"#F59E0B",milestoneLight:"rgba(245, 158, 11, 0.08)",statusTodo:"#64748B",statusInProgress:"#00E5CC",statusCompleted:"#059669",hoverBg:"rgba(0, 0, 0, 0.04)",focusRing:"#00E5CC",dotGrid:"rgba(0, 0, 0, 0.04)",glassHeader:"#F8FAFC",glassToolbar:"rgba(255, 255, 255, 0.85)",forecastHud:"rgba(248, 250, 252, 0.95)",neonRedGlow:"0 0 10px rgba(220, 38, 38, 0.3)",executionBarBg:"rgba(0, 196, 174, 0.28)"},neutral:{bgPrimary:"#FAFAF9",bgSecondary:"#F5F5F4",bgGrid:"#EFEDEC",bgWeekend:"rgba(41, 37, 36, 0.02)",border:"#D6D3D1",borderLight:"#E7E5E4",textPrimary:"#0C0A09",textSecondary:"#44403C",textTertiary:"#78716C",accent:"#292524",accentHover:"#44403C",accentLight:"rgba(41, 37, 36, 0.08)",taskBarPrimary:"#292524",taskBarProgress:"#1C1917",taskBarHandle:"#FFFFFF",dependency:"#78716C",dependencyHover:"#A8A29E",criticalPath:"#44403C",criticalPathLight:"rgba(68, 64, 60, 0.08)",today:"#1C1917",todayLight:"rgba(28, 25, 23, 0.06)",milestone:"#57534E",milestoneLight:"rgba(87, 83, 78, 0.08)",statusTodo:"#78716C",statusInProgress:"#292524",statusCompleted:"#15803D",hoverBg:"rgba(0, 0, 0, 0.035)",focusRing:"#292524",dotGrid:"rgba(0, 0, 0, 0.03)",glassHeader:"#F5F5F4",glassToolbar:"rgba(250, 250, 249, 0.85)",forecastHud:"rgba(245, 245, 244, 0.95)",neonRedGlow:"0 0 10px rgba(68, 64, 60, 0.3)",executionBarBg:"rgba(41, 37, 36, 0.25)"}};function t0(e="dark"){if(typeof window>"u"||typeof getComputedStyle>"u")return Dt[e]||Dt.dark;let t=document.documentElement,a=getComputedStyle(t),r=(s,o)=>a.getPropertyValue(s).trim()||o;return {bgPrimary:r("--theme-bg-primary",Dt[e].bgPrimary),bgSecondary:r("--theme-bg-secondary",Dt[e].bgSecondary),bgGrid:r("--theme-bg-card",Dt[e].bgGrid),bgWeekend:r("--theme-bg-hover",Dt[e].bgWeekend),border:r("--theme-border-primary",Dt[e].border),borderLight:r("--theme-border-subtle",Dt[e].borderLight),textPrimary:r("--theme-text-primary",Dt[e].textPrimary),textSecondary:r("--theme-text-secondary",Dt[e].textSecondary),textTertiary:r("--theme-text-tertiary",Dt[e].textTertiary),accent:r("--theme-accent-primary",Dt[e].accent),accentHover:r("--theme-accent-hover",Dt[e].accentHover),accentLight:r("--theme-accent-primary",Dt[e].accentLight),taskBarPrimary:r("--theme-accent-primary",Dt[e].taskBarPrimary),taskBarProgress:r("--theme-accent-hover",Dt[e].taskBarProgress),taskBarHandle:r("--theme-text-inverse",Dt[e].taskBarHandle||"#FFFFFF"),dependency:r("--theme-border-secondary",Dt[e].dependency),dependencyHover:r("--theme-border-secondary",Dt[e].dependencyHover),criticalPath:r("--theme-error",Dt[e].criticalPath),criticalPathLight:r("--theme-error",Dt[e].criticalPathLight),today:e==="light"?r("--theme-accent-primary",Dt[e].today):e==="neutral"?r("--theme-text-primary",Dt[e].today):r("--theme-error",Dt[e].today),todayLight:e==="light"?r("--theme-accent-primary",Dt[e].todayLight):e==="neutral"?r("--theme-text-primary",Dt[e].todayLight):r("--theme-error",Dt[e].todayLight),milestone:r("--theme-warning",Dt[e].milestone),milestoneLight:r("--theme-warning",Dt[e].milestoneLight),statusTodo:r("--theme-text-tertiary",Dt[e].statusTodo),statusInProgress:r("--theme-accent-primary",Dt[e].statusInProgress),statusCompleted:r("--theme-success",Dt[e].statusCompleted),hoverBg:r("--theme-bg-hover",Dt[e].hoverBg),focusRing:r("--theme-accent-primary",Dt[e].focusRing),...Dt[e].dotGrid&&{dotGrid:Dt[e].dotGrid},...Dt[e].glassHeader&&{glassHeader:Dt[e].glassHeader},...Dt[e].glassToolbar&&{glassToolbar:Dt[e].glassToolbar},...Dt[e].forecastHud&&{forecastHud:Dt[e].forecastHud},...Dt[e].neonRedGlow&&{neonRedGlow:Dt[e].neonRedGlow},...Dt[e].executionBarBg&&{executionBarBg:Dt[e].executionBarBg}}}function Hi(e,t,a="left",r=208){let[n,s]=useState({top:0,left:0});return useEffect(()=>{if(!t||!e.current)return;let o=e.current.getBoundingClientRect(),i=o.bottom+4,c;a==="right"?c=o.right-r:c=o.left;let l=8;c+r>window.innerWidth-l&&(c=window.innerWidth-l-r),c<l&&(c=l),s({top:i,left:c});},[t,a,e,r]),n}function u0({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportCSV:n,onExportJSON:s,onExportMSProject:o}){let[i,c]=useState(false),[l,u]=useState(null),p=useRef(null),d=useRef(null),m=Rr(),f=Hi(p,i,"right",176);if(useEffect(()=>{if(!i)return;let h=x=>{let y=x.target;p.current&&!p.current.contains(y)&&d.current&&!d.current.contains(y)&&c(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[i]),!(t||a||r||n||s||o))return null;let b=[{id:"png",label:"PNG",description:"Image",icon:jsx(FileImage,{className:"w-4 h-4"}),handler:t},{id:"pdf",label:"PDF",description:"Document",icon:jsx(FileText,{className:"w-4 h-4"}),handler:a},{id:"excel",label:"Excel",description:"Spreadsheet",icon:jsx(FileSpreadsheet,{className:"w-4 h-4"}),handler:r},{id:"csv",label:"CSV",description:"Comma-separated",icon:jsx(FileText,{className:"w-4 h-4"}),handler:n},{id:"json",label:"JSON",description:"Data",icon:jsx(FileJson,{className:"w-4 h-4"}),handler:s},{id:"msproject",label:"MS Project",description:"XML",icon:jsx(FolderKanban,{className:"w-4 h-4"}),handler:o}].filter(h=>h.handler),w=async(h,x)=>{if(x){u(h);try{await x();}catch(y){console.error(`Export ${h} failed:`,y);}finally{u(null),c(false);}}};return jsxs(Fragment,{children:[jsxs(motion.button,{ref:p,onClick:()=>c(!i),className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:i?e.accent:e.bgSecondary,border:`1px solid ${i?e.accent:e.borderLight}`,color:i?"#FFFFFF":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{scale:1.02,backgroundColor:e.accent,color:"#FFFFFF"},whileTap:{scale:.98},children:[jsx(Download,{className:"w-3.5 h-3.5"}),jsx("span",{children:m.toolbar.export}),jsx(ChevronDown,{className:"w-3 h-3 transition-transform",style:{transform:i?"rotate(180deg)":"rotate(0deg)"}})]}),createPortal(jsx(AnimatePresence,{children:i&&jsx(motion.div,{ref:d,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-44 rounded-xl overflow-hidden",style:{top:f.top,left:f.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:b.map((h,x)=>jsxs(motion.button,{onClick:()=>w(h.id,h.handler),disabled:l!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-left transition-all",style:{backgroundColor:"transparent",borderBottom:x<b.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:x*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md",style:{backgroundColor:e.accentLight,color:e.accent},children:l===h.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):h.icon}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-[11px] font-medium truncate",style:{color:e.textPrimary},children:h.label}),jsx("div",{className:"text-[9px] truncate",style:{color:e.textTertiary},children:h.description})]})]},h.id))})})}),document.body)]})}function cu({theme:e,onExportPNG:t,onExportPDF:a,onExportExcel:r,onExportMSProject:n,onCopySnapshotLink:s}){let[o,i]=useState(false),[c,l]=useState(null),[u,p]=useState(false),d=useRef(null),m=useRef(null),f=Rr(),v=Hi(d,o,"right",224),b=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0",w=f.toolbar.visibility==="Visibilidad";useEffect(()=>{if(!o)return;let k=M=>{let H=M.target;d.current&&!d.current.contains(H)&&m.current&&!m.current.contains(H)&&i(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]);let h=[{id:"png",label:f.toolbar.exportPng,icon:jsx(FileImage,{className:"w-3.5 h-3.5"}),handler:t},{id:"pdf",label:f.toolbar.exportPdf,icon:jsx(FileText,{className:"w-3.5 h-3.5"}),handler:a},{id:"excel",label:f.toolbar.exportExcel,icon:jsx(FileSpreadsheet,{className:"w-3.5 h-3.5"}),handler:r},{id:"msproject",label:f.toolbar.exportMsProject,icon:jsx(FolderKanban,{className:"w-3.5 h-3.5"}),handler:n}].filter(k=>k.handler),x=async(k,M)=>{if(M){l(k);try{await M();}catch(H){console.error(`Export ${k} failed:`,H);}finally{l(null),i(false);}}},y=()=>{s?.(),p(true),setTimeout(()=>p(false),2e3);};return jsxs(Fragment,{children:[jsx(motion.button,{ref:d,onClick:()=>i(!o),className:"flex items-center justify-center w-8 h-8 rounded-lg",style:{color:o?e.accent:e.textTertiary,backgroundColor:o?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:f.toolbar.share,children:jsx(Share2,{className:"w-4 h-4"})}),createPortal(jsx(AnimatePresence,{children:o&&jsxs(motion.div,{ref:m,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:v.top,left:v.left,zIndex:99999,backgroundColor:b?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${b?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:b?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[h.length>0&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:w?"EXPORTAR":"EXPORT"})}),jsx("div",{className:"py-0.5",children:h.map((k,M)=>jsxs(motion.button,{onClick:()=>x(k.id,k.handler),disabled:c!==null,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:M*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:e.accentLight,color:e.accent},children:c===k.id?jsx(motion.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},children:jsx(Download,{className:"w-3.5 h-3.5"})}):k.icon}),jsx("span",{className:"flex-1 text-left",children:k.label})]},k.id))})]}),h.length>0&&s&&jsx("div",{className:"mx-3 h-px",style:{backgroundColor:b?"rgba(255,255,255,0.06)":e.borderLight}}),s&&jsxs(Fragment,{children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:b?"rgba(255,255,255,0.35)":e.textTertiary},children:w?"COMPARTIR":"SHARE"})}),jsx("div",{className:"py-0.5 pb-1.5",children:jsxs(motion.button,{onClick:y,className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:b?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:h.length*.03},children:[jsx("div",{className:"flex items-center justify-center w-7 h-7 rounded-md flex-shrink-0",style:{backgroundColor:u?"rgba(34,197,94,0.15)":e.accentLight,color:u?"#22C55E":e.accent},children:u?jsx(Check,{className:"w-3.5 h-3.5"}):jsx(Link2,{className:"w-3.5 h-3.5"})}),jsx("span",{className:"flex-1 text-left",children:u?f.toolbar.copied:f.toolbar.copySnapshotLink})]})})]})]})}),document.body)]})}function u1({options:e,value:t,onChange:a,theme:r,layoutId:n="activeSegment"}){return jsx("div",{className:"inline-flex p-1 rounded-lg relative",style:{backgroundColor:r.bgSecondary,border:`1px solid ${r.borderLight}`},children:e.map(s=>{let o=t===s.value;return jsxs(motion.button,{onClick:()=>a(s.value),className:"relative px-3 py-1.5 rounded-md text-[11px] transition-all flex items-center gap-1.5 min-w-[70px] justify-center",style:{color:o?r.textPrimary:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:o?600:500,zIndex:o?2:1},whileHover:{scale:1.02},whileTap:{scale:.98},children:[o&&jsx(motion.div,{layoutId:n,className:"absolute inset-0 rounded-md",style:{backgroundColor:r.accent,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)"},transition:{type:"spring",stiffness:400,damping:30}}),s.icon&&jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.icon}),jsx("span",{className:"relative z-10",style:{color:o?"#FFFFFF":r.textTertiary},children:s.label})]},s.value)})})}function p1({options:e,value:t,onChange:a,theme:r}){return jsx("div",{className:"inline-flex items-center gap-1",children:e.map(n=>{let s=t===n.value;return jsxs(motion.button,{onClick:()=>a(n.value),className:"relative px-3 py-1.5 text-[11px] transition-all",style:{color:s?r.accent:r.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:s?600:500},whileHover:{color:s?r.accent:r.textSecondary},whileTap:{scale:.98},children:[jsx("span",{children:n.label}),s&&jsx(motion.div,{layoutId:"timeScaleUnderline",className:"absolute bottom-0 left-1 right-1 h-0.5 rounded-full",style:{backgroundColor:r.accent},transition:{type:"spring",stiffness:400,damping:30}})]},n.value)})})}function du({theme:e,value:t,onChange:a,maxDepth:r}){let[n,s]=useState(false),o=useRef(null),i=useRef(null),c=Rr(),l=Hi(o,n,"left");useEffect(()=>{if(!n)return;let d=m=>{let f=m.target;o.current&&!o.current.contains(f)&&i.current&&!i.current.contains(f)&&s(false);};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[n]);let u=[{value:"all",label:c.toolbar.wbsAllLevels||"All"},...Array.from({length:Math.min(r,5)},(d,m)=>({value:m+1,label:c.toolbar.wbsLevel==="Nivel"?`Nivel ${m+1}`:`L${m+1}`}))],p=t==="all"?c.toolbar.wbsAllLevels||"All":c.toolbar.wbsLevel==="Nivel"?`Nivel ${t}`:`L${t}`;return jsxs(Fragment,{children:[jsxs(motion.button,{ref:o,onClick:()=>s(!n),className:"flex items-center gap-1.5 px-2 py-1.5 rounded-lg transition-all",style:{backgroundColor:n?e.accentLight:e.bgSecondary,border:`1px solid ${n?e.accent:e.borderLight}`,color:n?e.accent:e.textSecondary},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},title:`${c.toolbar.wbsLevel||"Level"}: ${p}`,children:[jsx(Layers,{className:"w-3.5 h-3.5"}),jsx("span",{className:"text-[11px] font-medium",style:{fontFamily:"'JetBrains Mono', monospace"},children:p})]}),createPortal(jsx(AnimatePresence,{children:n&&jsx(motion.div,{ref:i,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-24 rounded-xl overflow-hidden",style:{top:l.top,left:l.left,zIndex:99999,backgroundColor:e.bgPrimary==="#050505"?"rgba(10, 10, 10, 0.95)":e.bgSecondary,border:`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.08)":e.border}`,boxShadow:e.bgPrimary==="#050505"?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:jsx("div",{className:"py-1",children:u.map((d,m)=>{let f=t===d.value;return jsxs(motion.button,{onClick:()=>{a(d.value),s(false);},className:"w-full flex items-center justify-between px-3 py-2 text-left transition-all",style:{backgroundColor:f?e.accentLight:"transparent",borderBottom:m<u.length-1?`1px solid ${e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.borderLight}`:"none"},whileHover:{backgroundColor:f?e.accentLight:e.bgPrimary==="#050505"?"rgba(255,255,255,0.06)":e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:m*.03},children:[jsx("span",{className:"text-[11px]",style:{color:f?e.accent:e.textPrimary,fontFamily:"'JetBrains Mono', monospace",fontWeight:f?600:500},children:d.label}),f&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent}})]},String(d.value))})})})}),document.body)]})}function uu({theme:e,value:t,onChange:a,hideCompleted:r=false,onHideCompletedChange:n}){let[s,o]=useState(false),i=useRef(null),c=useRef(null),l=Rr(),u=Hi(i,s,"left");useEffect(()=>{if(!s)return;let v=setTimeout(()=>{let b=h=>{let x=h.target;i.current&&!i.current.contains(x)&&c.current&&!c.current.contains(x)&&o(false);},w=h=>{h.key==="Escape"&&o(false);};document.addEventListener("mousedown",b),document.addEventListener("keydown",w),c._cleanup=()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",w);};},100);return ()=>{clearTimeout(v),c._cleanup&&c._cleanup();}},[s]);let p=[{value:"all",label:l.toolbar.filterAll||"Show All",icon:jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:l.toolbar.filterCompleted||"Completed",icon:jsx(CheckCircle2,{className:"w-3.5 h-3.5"}),color:"text-green-500"},{value:"in_progress",label:l.toolbar.filterInProgress||"In Progress",icon:jsx(PlayCircle,{className:"w-3.5 h-3.5"}),color:"text-[#00E5CC]"},{value:"incomplete",label:l.toolbar.toDo||"To Do / Pending",icon:jsx(Circle,{className:"w-3.5 h-3.5"}),color:"text-gray-400"}],d=t!=="all"||r,m=(t!=="all"?1:0)+(r?1:0),f=e.bgPrimary==="#0F1117"||e.bgPrimary==="#0a0a0a"||e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF";return jsxs(Fragment,{children:[jsxs(motion.button,{ref:i,onClick:v=>{v.stopPropagation(),o(b=>!b);},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{backgroundColor:d?f?"rgba(0, 229, 204, 0.2)":"rgb(239 246 255)":s?e.hoverBg:e.bgSecondary,border:`1px solid ${d?f?"rgba(0, 229, 204, 0.5)":"rgb(191 219 254)":e.borderLight}`,color:d?"#00E5CC":e.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:500},whileHover:{backgroundColor:e.hoverBg,scale:1.02},whileTap:{scale:.98},children:[jsx(Filter,{className:"w-4 h-4"}),jsx("span",{children:m===0?l.toolbar.filter||"Filters":[t!=="all"?p.find(v=>v.value===t)?.label:null,r?l.toolbar.visibility==="Visibilidad"?"sin completadas":"no completed":null].filter(Boolean).join(" \xB7 ")})]}),createPortal(jsx(AnimatePresence,{children:s&&jsxs(motion.div,{ref:c,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-56 rounded-xl overflow-hidden",style:{top:u.top,left:u.left,zIndex:99999,backgroundColor:f?"rgba(10, 10, 10, 0.95)":"#FFFFFF",border:`1px solid ${f?"rgba(255,255,255,0.08)":"rgb(229 231 235)"}`,boxShadow:f?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 py-2 border-b",style:{borderColor:f?"rgba(255,255,255,0.06)":"rgb(229 231 235)"},children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:f?"rgba(255,255,255,0.35)":"#9CA3AF",fontFamily:"Inter, sans-serif"},children:l.toolbar.filterBy||"FILTER BY STATUS"})}),jsx("div",{className:"py-1",children:p.map(v=>{let b=t===v.value&&!r,w=()=>v.value==="all"?b?jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}):jsx("div",{className:"w-3.5 h-3.5 rounded-full border-2 border-gray-400"}):v.icon;return jsxs(motion.button,{onClick:()=>{a(v.value),n&&n(false),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:b?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx("span",{className:`${b?v.color:"text-gray-400"} flex-shrink-0`,children:w()}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:v.label}),b&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]},v.value)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(229 231 235)"}}),n&&jsx("div",{className:"py-1",children:jsxs(motion.button,{onClick:()=>{n(!r),r||a("all"),o(false);},className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{backgroundColor:r?f?"rgba(255,255,255,0.05)":"rgb(249 250 251)":"transparent",fontFamily:"Inter, sans-serif"},whileHover:{backgroundColor:f?"rgba(255,255,255,0.06)":"rgb(243 244 246)"},children:[jsx(EyeOff,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:r?"#00E5CC":f?"rgba(255,255,255,0.35)":"#9CA3AF"}}),jsx("span",{className:"flex-1 text-left whitespace-nowrap font-medium",style:{color:f?"rgba(255,255,255,0.85)":"#111827"},children:l.toolbar.hideCompleted||"Hide Completed Tasks"}),r&&jsx(Check,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:"#00E5CC"}})]})})]})}),document.body)]})}function r0({value:e,onChange:t,theme:a}){let r=Rr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=r.toolbar.visibility==="Visibilidad",o=[{value:"compact",label:r.toolbar.compact||"Compact",Icono:Rows4},{value:"comfortable",label:r.toolbar.normal||"Normal",Icono:Rows3},{value:"spacious",label:r.toolbar.spacious||"Spacious",Icono:Rows2}];return jsx("div",{role:"group","aria-label":s?"Densidad de las filas":"Row density","data-densidad-a-la-vista":true,className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:o.map(({value:i,label:c,Icono:l})=>{let u=e===i;return jsx("button",{type:"button",onClick:()=>t(i),"aria-pressed":u,"aria-label":(s?"Densidad: ":"Density: ")+c,title:(s?"Densidad: ":"Density: ")+c,className:"relative px-2 py-1 rounded-full transition-colors",style:{color:u?n?"#FFFFFF":a.textPrimary:a.textTertiary,backgroundColor:u?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},children:jsx(l,{className:"w-3.5 h-3.5"})},i)})})}function n0({value:e,onChange:t,theme:a}){let r=Rr(),n=a.bgPrimary==="#050505"||a.textPrimary==="#FFFFFF",s=[{value:"day",label:r.toolbar.day.charAt(0).toUpperCase()},{value:"week",label:r.toolbar.week.charAt(0).toUpperCase()},{value:"month",label:r.toolbar.month.charAt(0).toUpperCase()}];return jsx("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:n?"#000000":a.bgSecondary,border:`1px solid ${n?"rgba(255,255,255,0.1)":a.border}`},children:s.map(o=>{let i=e===o.value;return jsx(motion.button,{onClick:()=>t(o.value),className:"relative px-3 py-1 text-[11px] font-medium rounded-full transition-colors",style:{color:i?n?"#FFFFFF":a.textPrimary:a.textTertiary,fontFamily:"Inter, sans-serif",backgroundColor:i?n?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent"},whileHover:{color:n?"#FFFFFF":a.textPrimary},whileTap:{scale:.95},children:o.label},o.value)})})}function m1({theme:e,forecast:t,currencyCode:a}){let r=Rr(),n=e.bgPrimary==="#050505"||e.textPrimary==="#FFFFFF",s=r.toolbar.visibility==="Visibilidad"?"es":"en",o=t?.expectedFinish?zr(t.expectedFinish,s):"\u2014",i=t?.delayDays,c=i!=null,l=i!=null?i>0?`+${i}d ${r.toolbar.delayLabel}`:i<0?`${i}d ${r.toolbar.earlyLabel}`:r.toolbar.onTimeLabel:null,u=i!=null&&i>0?{bg:n?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:n?"#EF4444":"#DC2626"}:i!=null&&i<0?{bg:n?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:n?"#22C55E":"#16A34A"}:{bg:n?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",text:e.textTertiary},p=t?.confidencePercent,d=p!=null?p>=75?"#22C55E":p>=40?"#F59E0B":"#EF4444":e.textTertiary,m=t?.costAtCompletion,f=t?.currency||"$",v=m!=null?(()=>{let y=Qa(m,a,s,{compacto:true});return f!=="$"?y.replace("$",f):y})():"\u2014",b=t?.budgetVariancePercent,w=b!=null&&b!==0,h=b!=null?b>0?`+${Wr(b,s)} ${r.toolbar.budgetOver}`:`${Wr(b,s)} ${r.toolbar.budgetUnder}`:null,x=b!=null&&b>0?{bg:n?"rgba(239,68,68,0.15)":"rgba(220,38,38,0.1)",text:n?"#EF4444":"#DC2626"}:b!=null&&b<0?{bg:n?"rgba(34,197,94,0.15)":"rgba(22,163,74,0.1)",text:n?"#22C55E":"#16A34A"}:{bg:"transparent",text:e.textTertiary};return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:e.forecastHud||(n?"rgba(15,15,15,0.9)":"rgba(248,250,252,0.95)"),borderColor:e.borderLight,backdropFilter:"blur(12px)"},children:[jsxs("div",{className:"flex items-center gap-6",children:[jsx("span",{className:"text-[9px] uppercase tracking-[0.15em]",style:{color:e.textTertiary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:r.toolbar.projectForecast}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[13px] font-semibold",style:{color:e.textPrimary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.expectedFinish,": ",o]}),c&&l&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:u.bg,color:u.text,fontFamily:"'JetBrains Mono', monospace",cursor:t?.causaDelDesvio?"help":void 0},title:t?.causaDelDesvio||void 0,children:l})]})]}),jsxs("div",{className:"flex items-center gap-6",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.confidence,":"]}),jsx("span",{className:"text-[13px] font-semibold",style:{color:d,fontFamily:"'JetBrains Mono', monospace"},children:p!=null?Wr(p,s):"\u2014"})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:n?"rgba(255,255,255,0.08)":e.borderLight}}),jsxs("div",{className:"flex items-center gap-2",children:[jsxs("span",{className:"text-[11px]",style:{color:e.textTertiary,fontFamily:"Inter, sans-serif"},children:[r.toolbar.costAtCompletion,":"]}),jsx("span",{className:"text-[13px] font-bold",style:{color:e.textPrimary,fontFamily:"'JetBrains Mono', monospace"},children:v}),w&&h&&jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:x.bg,color:x.text,fontFamily:"'JetBrains Mono', monospace"},children:h})]})]})]})}var Jl={width:22,height:10,borderRadius:2,flexShrink:0,display:"inline-flex",alignItems:"center",justifyContent:"center"},g1=[{es:"Festivo (el d\xEDa en \xE1mbar)",en:"Holiday (amber day)",muestra:{...Jl,color:"#F59E0B",fontSize:10,fontWeight:700},texto:"12"},{es:"Vencida o en ruta cr\xEDtica",en:"Overdue or on the critical path",muestra:{...Jl,background:"#EF4444"}},{es:"Fin de semana o d\xEDa no laborable",en:"Weekend or non-working day",muestra:{...Jl,background:"repeating-linear-gradient(45deg, rgba(148,163,184,0.45) 0 2px, transparent 2px 5px)"}},{es:"Parte de la barra sin avanzar",en:"Unfinished part of the bar",muestra:{...Jl,background:"repeating-linear-gradient(45deg, rgba(0,229,204,0.55) 0 3px, rgba(148,163,184,0.25) 3px 6px)"}}];function o0({theme:e,showCriticalPath:t,onShowCriticalPathChange:a,showBaseline:r,onShowBaselineChange:n,highlightWeekends:s,onHighlightWeekendsChange:o,showDependencies:i,onShowDependenciesChange:c,rowDensity:l,onRowDensityChange:u,hasDependencies:p=true}){let[d,m]=useState(false),f=useRef(null),v=useRef(null),b=Rr(),w=Hi(f,d,"right",208),h=e.bgPrimary==="#050505"||(e.bgPrimary||"").charAt(1)==="0";useEffect(()=>{if(!d)return;let M=E=>{let N=E.target;f.current&&!f.current.contains(N)&&v.current&&!v.current.contains(N)&&m(false);},H=E=>{E.key==="Escape"&&m(false);};return document.addEventListener("mousedown",M),document.addEventListener("keydown",H),()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",H);}},[d]);let x=b.toolbar.visibility==="Visibilidad",y=[{key:"criticalPath",label:x?"Ruta Cr\xEDtica":"Critical Path",icon:Zap,active:t,onChange:a,disabled:!p,tooltip:p?void 0:x?"Agrega dependencias entre tareas para ver la ruta cr\xEDtica":"Add dependencies between tasks to see the critical path"},{key:"baselines",label:x?"L\xEDneas Base":"Baselines",icon:Layers,active:r,onChange:n},{key:"weekends",label:x?"Fines de Semana":"Weekends",icon:CalendarDays,active:s,onChange:o},{key:"dependencies",label:x?"Dependencias":"Dependencies",icon:GitBranch,active:i,onChange:c}],k=[{value:"compact",label:b.toolbar.visibility==="Visibilidad"?"Compacto":"Compact"},{value:"comfortable",label:"Normal"},{value:"spacious",label:b.toolbar.visibility==="Visibilidad"?"Amplio":"Spacious"}];return jsxs(Fragment,{children:[jsxs(motion.button,{ref:f,onClick:()=>m(!d),className:"flex items-center gap-1.5 h-8 px-2.5 rounded-lg text-xs font-medium",style:{color:d?e.accent:e.textSecondary,backgroundColor:d?e.accentLight:"transparent"},whileHover:{color:e.textPrimary,backgroundColor:e.hoverBg},title:x?"Opciones de vista, densidad y leyenda":"Display options, density and legend","aria-haspopup":"menu","aria-expanded":d,children:[jsx(Eye,{className:"w-4 h-4"}),jsx("span",{children:x?"Vista":"View"}),jsx(ChevronDown,{className:"w-3 h-3"})]}),createPortal(jsx(AnimatePresence,{children:d&&jsxs(motion.div,{ref:v,initial:{opacity:0,y:-8,scale:.95},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.95},transition:{duration:.15,ease:"easeOut"},className:"fixed w-52 rounded-xl overflow-hidden",style:{top:w.top,left:w.left,zIndex:99999,backgroundColor:h?"rgba(10, 10, 10, 0.95)":e.bgSecondary||"#F8FAFC",border:`1px solid ${h?"rgba(255,255,255,0.08)":e.border||"#CBD5E1"}`,boxShadow:h?"0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04)":"0 10px 40px rgba(0, 0, 0, 0.12)",backdropFilter:"blur(16px)"},children:[jsx("div",{className:"px-3 pt-2.5 pb-1.5",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"OPCIONES DE VISTA":"DISPLAY OPTIONS"})}),jsx("div",{className:"py-0.5",children:y.map((M,H)=>{let E=M.icon,N=M.disabled,D=M.tooltip;return jsxs(motion.button,{onClick:()=>!N&&M.onChange?.(!M.active),className:"w-full flex items-center gap-2.5 px-3 py-2 text-[11px] transition-colors",style:{color:N?h?"rgba(255,255,255,0.3)":"#9CA3AF":h?"rgba(255,255,255,0.85)":"#111827",cursor:N?"not-allowed":"pointer"},whileHover:N?{}:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:H*.03},title:D,children:[jsx(E,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:N?h?"rgba(255,255,255,0.2)":"#D1D5DB":M.active?e.accent||"#00E5CC":e.textTertiary}}),jsx("span",{className:"flex-1 text-left",children:M.label}),M.active&&!N&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.key)})}),jsx("div",{className:"mx-3 h-px",style:{backgroundColor:h?"rgba(255,255,255,0.06)":e.borderLight}}),jsxs("div",{className:"py-0.5",children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:b.toolbar.visibility==="Visibilidad"?"DENSIDAD":"DENSITY"})}),k.map((M,H)=>{let E=l===M.value;return jsxs(motion.button,{onClick:()=>u(M.value),className:"w-full flex items-center justify-between px-3 py-2 text-[11px] transition-colors",style:{color:h?"rgba(255,255,255,0.85)":"#111827"},whileHover:{backgroundColor:e.hoverBg},initial:{opacity:0,x:-10},animate:{opacity:1,x:0},transition:{delay:(y.length+H)*.03},children:[jsx("span",{style:{color:E?e.accent||"#00E5CC":h?"rgba(255,255,255,0.85)":e.textPrimary},children:M.label}),E&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:e.accent||"#00E5CC"}})]},M.value)})]}),jsxs("div",{className:"py-0.5",style:{borderTop:`1px solid ${h?"rgba(255,255,255,0.06)":e.border||"#E2E8F0"}`},children:[jsx("div",{className:"px-3 pt-2 pb-1",children:jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.1em]",style:{color:h?"rgba(255,255,255,0.35)":e.textTertiary},children:x?"LEYENDA":"LEGEND"})}),g1.map(M=>jsxs("div",{className:"flex items-center gap-2.5 px-3 py-1.5 text-[11px]",style:{color:h?"rgba(255,255,255,0.75)":e.textSecondary},children:[jsx("span",{"aria-hidden":true,style:M.muestra,children:M.texto??null}),jsx("span",{children:x?M.es:M.en})]},M.es))]})]})}),document.body)]})}function f1({theme:e,etiqueta:t,children:a}){let[r,n]=useState(false),s=useRef(null);return useEffect(()=>{if(!r)return;let o=c=>{s.current&&!s.current.contains(c.target)&&n(false);},i=c=>{c.key==="Escape"&&n(false);};return document.addEventListener("mousedown",o),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",i);}},[r]),jsxs("div",{ref:s,className:"relative",children:[jsx("button",{type:"button",onClick:()=>n(o=>!o),"aria-label":t,"aria-expanded":r,title:t,className:"flex items-center justify-center rounded-md",style:{width:32,height:32,color:e.textSecondary,border:`1px solid ${e.borderLight}`},children:"\u22EF"}),r&&jsx("div",{className:"absolute right-0 mt-1 p-1.5 rounded-lg shadow-lg",style:{top:"100%",minWidth:200,zIndex:300,backgroundColor:e.bgPrimary,border:`1px solid ${e.borderLight}`},children:a})]})}function Ql({enCabecera:e=false,theme:t,timeScale:a,onTimeScaleChange:r,zoom:n,onZoomChange:s,currentTheme:o,onThemeChange:i,rowDensity:c,onRowDensityChange:l,showThemeSelector:u=false,showCreateTaskButton:p=false,createTaskLabel:d,onCreateTask:m,taskFilter:f="all",onTaskFilterChange:v,hideCompleted:b=false,onHideCompletedChange:w,toolbarRightContent:h,wbsLevel:x,onWbsLevelChange:y,maxWbsDepth:k=4,viewMode:M="execution",onViewModeChange:H,projectForecast:E,hideForecastHud:N,currencyCode:D,onExportPNG:S,onExportPDF:V,onExportExcel:W,onExportCSV:R,onExportJSON:A,onExportMSProject:ve,showCriticalPath:q=true,onShowCriticalPathChange:le,showDependencies:B=true,onShowDependenciesChange:pe,highlightWeekends:nt=true,onHighlightWeekendsChange:Ue,showBaseline:$=false,onShowBaselineChange:fe,onCopySnapshotLink:ie,hasDependencies:et=true}){let Xe=Rr(),Qe=S||V||W||R||A||ve,ct=!!t.glassToolbar,Tt=[{value:"day",label:Xe.toolbar.day},{value:"week",label:Xe.toolbar.week},{value:"month",label:Xe.toolbar.month}],_t=[{value:"dark",label:"Dark",icon:jsx(Moon,{className:"w-3.5 h-3.5"})},{value:"light",label:"Light",icon:jsx(Sun,{className:"w-3.5 h-3.5"})},{value:"neutral",label:"Zen",icon:jsx(Palette,{className:"w-3.5 h-3.5"})}],tt=t.bgPrimary==="#050505"||t.textPrimary==="#FFFFFF";if(e)return jsxs("div",{className:"flex items-center gap-2",children:[jsx(n0,{value:a,onChange:r,theme:t}),jsx(r0,{value:c,onChange:l,theme:t}),v&&jsx(uu,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:w}),h,jsx(o0,{theme:t,showCriticalPath:q,onShowCriticalPathChange:le,showBaseline:$,onShowBaselineChange:fe,highlightWeekends:nt,onHighlightWeekendsChange:Ue,showDependencies:B,onShowDependenciesChange:pe,rowDensity:c,onRowDensityChange:l,hasDependencies:et}),jsx(cu,{theme:t,onExportPNG:S,onExportPDF:V,onExportExcel:W,onExportMSProject:ve,onCopySnapshotLink:ie}),(H||y)&&jsxs(f1,{theme:t,etiqueta:Xe.toolbar.today==="Hoy"?"M\xE1s opciones":"More options",children:[H&&jsx("div",{className:"flex flex-col gap-1",children:["execution","oracle"].map(xt=>jsxs("button",{type:"button",onClick:()=>H(xt),className:"flex items-center justify-between gap-3 px-2 py-1.5 rounded-md text-[12px] text-left",style:{color:t.textPrimary,backgroundColor:M===xt?tt?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.05)":"transparent"},children:[xt==="execution"?Xe.toolbar.viewExecution:Xe.toolbar.viewOracle,M===xt&&jsx(Check,{className:"w-3.5 h-3.5"})]},xt))}),y&&jsx("div",{className:"pt-1 mt-1",style:{borderTop:`1px solid ${t.borderLight}`},children:jsx(du,{theme:t,value:x??"all",onChange:y,maxDepth:k})})]})]});if(ct){let xt=tt?"rgba(255,255,255,0.08)":t.borderLight;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"h-[52px] px-4 flex items-center justify-between border-b",style:{backgroundColor:t.glassToolbar,borderColor:t.borderLight,backdropFilter:"blur(12px)"},children:[jsx("div",{className:"flex items-center gap-3",children:H&&jsxs("div",{className:"inline-flex items-center rounded-full p-0.5",style:{backgroundColor:tt?"#000000":t.bgSecondary,border:`1px solid ${tt?"rgba(255,255,255,0.08)":t.border}`},children:[jsx(motion.button,{onClick:()=>H("execution"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="execution"?tt?"rgba(255,255,255,0.1)":"rgba(0,0,0,0.06)":"transparent",color:M==="execution"?t.textPrimary:t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="execution"?{color:t.textSecondary}:{},children:Xe.toolbar.viewExecution}),jsx(motion.button,{onClick:()=>H("oracle"),className:"px-3 py-1.5 rounded-full text-[11px] font-medium transition-colors",style:{backgroundColor:M==="oracle"?tt?"rgba(0, 229, 204,0.15)":"rgba(0, 196, 174,0.08)":"transparent",color:M==="oracle"?"#00E5CC":t.textTertiary,fontFamily:"Inter, sans-serif"},whileHover:M!=="oracle"?{color:t.textSecondary}:{},children:Xe.toolbar.viewOracle})]})}),jsxs("div",{className:"flex items-center gap-3",children:[jsx(n0,{value:a,onChange:r,theme:t}),jsx(r0,{value:c,onChange:l,theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:xt}}),y&&jsx(du,{theme:t,value:x??"all",onChange:y,maxDepth:k}),v&&jsx(uu,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:w}),h&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:xt}}),h]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:xt}}),jsx(o0,{theme:t,showCriticalPath:q,onShowCriticalPathChange:le,showBaseline:$,onShowBaselineChange:fe,highlightWeekends:nt,onHighlightWeekendsChange:Ue,showDependencies:B,onShowDependenciesChange:pe,rowDensity:c,onRowDensityChange:l,hasDependencies:et}),jsx(cu,{theme:t,onExportPNG:S,onExportPDF:V,onExportExcel:W,onExportMSProject:ve,onCopySnapshotLink:ie}),p&&m&&jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px]",style:{background:`linear-gradient(135deg, ${t.accent} 0%, ${t.accentHover} 100%)`,color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:`0 2px 8px ${tt?"rgba(0, 229, 204,0.3)":"rgba(0, 196, 174,0.3)"}`},whileHover:{scale:1.02,boxShadow:`0 4px 12px ${tt?"rgba(0, 229, 204,0.4)":"rgba(0, 196, 174,0.4)"}`},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||Xe.toolbar.createTask})]})]})]}),E&&!N&&jsx(m1,{theme:t,forecast:E,currencyCode:D})]})}return jsxs("div",{className:"h-12 px-4 flex items-center justify-between border-b",style:{backgroundColor:t.bgGrid,borderColor:t.border},children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx(p1,{options:Tt,value:a,onChange:xt=>r(xt),theme:t}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(motion.button,{onClick:()=>s(Math.max(.5,n-.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomOut,{className:"w-3.5 h-3.5"})}),jsxs("div",{className:"px-2 py-0.5 rounded text-[11px] tabular-nums min-w-[42px] text-center",style:{color:t.textSecondary,fontFamily:"'JetBrains Mono', monospace",fontWeight:500},children:[Math.round(n*100),"%"]}),jsx(motion.button,{onClick:()=>s(Math.min(2,n+.1)),className:"p-1.5 rounded-md transition-all",style:{backgroundColor:"transparent",color:t.textSecondary},whileHover:{backgroundColor:t.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(ZoomIn,{className:"w-3.5 h-3.5"})})]}),jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),y&&jsx(du,{theme:t,value:x??"all",onChange:y,maxDepth:k}),v&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}}),jsx(uu,{theme:t,value:f,onChange:v,hideCompleted:b,onHideCompletedChange:w})]})]}),jsxs("div",{className:"flex items-center gap-3",children:[h&&jsxs(Fragment,{children:[h,jsx("div",{className:"w-px h-5",style:{backgroundColor:t.borderLight}})]}),p&&m&&jsxs(Fragment,{children:[jsxs(motion.button,{onClick:m,className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-[11px] transition-all",style:{background:"linear-gradient(135deg, #00E5CC 0%, #00E5CC 100%)",color:"#FFFFFF",fontFamily:"Inter, sans-serif",fontWeight:500,boxShadow:"0 2px 8px rgba(0, 229, 204, 0.3)"},whileHover:{scale:1.02,boxShadow:"0 4px 12px rgba(0, 229, 204, 0.4)"},whileTap:{scale:.98},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:d||Xe.toolbar.createTask})]}),(Qe||u)&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}})]}),jsx(cu,{theme:t,onExportPNG:S,onExportPDF:V,onExportExcel:W,onExportMSProject:ve,onCopySnapshotLink:ie}),u&&jsx("div",{className:"w-px h-6",style:{backgroundColor:t.borderLight}}),u&&jsx(u1,{options:_t,value:o,onChange:xt=>i(xt),theme:t})]})]})}var wa={texto:"var(--v6-texto, #0E1114)",texto2:"var(--v6-texto-2, #4D5761)",tenue:"var(--v6-tenue, #5F6972)",borde:"var(--v6-borde, #E2E5E9)",tarjeta:"var(--v6-tarjeta, #FFFFFF)",neutroFondo:"var(--v6-neutro-fondo, #E1E4E8)",segmentado:"var(--v6-segmentado, #E9ECEF)",acento:"var(--v6-acento, #0FA392)",acentoTexto:"var(--v6-acento-texto, #066A5F)",acentoFondo2:"var(--v6-acento-fondo-2, rgba(15,163,146,0.14))",acentoBordeSuave:"var(--v6-acento-borde-suave, rgba(8,127,114,0.55))",sobreAcento:"var(--v6-sobre-acento, #03231F)"},D1="'JetBrains Mono', ui-monospace, Menlo, monospace";function gu({boton:e,children:t,alinear:a="izquierda",ancho:r=220}){let[n,s]=useState(false),o=useRef(null),i=useRef(null),[c,l]=useState({top:0,left:0});return useEffect(()=>{if(!n||!o.current)return;let u=o.current.getBoundingClientRect(),p=a==="derecha"?Math.max(8,u.right-r):Math.min(u.left,window.innerWidth-r-8);l({top:u.bottom+6,left:p});let d=f=>{let v=f.target;!o.current?.contains(v)&&!i.current?.contains(v)&&s(false);},m=f=>{f.key==="Escape"&&(s(false),o.current?.focus());};return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n,a,r]),jsxs(Fragment,{children:[e(()=>s(u=>!u),n,o),n&&createPortal(jsx("div",{ref:i,role:"menu","data-menu-v6":true,style:{position:"fixed",top:c.top,left:c.left,width:r,zIndex:99999,padding:6,borderRadius:12,background:wa.tarjeta,border:`1px solid ${wa.borde}`,boxShadow:"0 12px 32px -8px rgba(14,17,20,0.25)",color:wa.texto,fontSize:13},children:t(()=>s(false))}),document.body)]})}function Wn({children:e,marcada:t,alPulsar:a,icono:r}){return jsxs("button",{type:"button",role:t===void 0?"menuitem":"menuitemcheckbox","aria-checked":t,onClick:a,className:"w-full flex items-center text-left",style:{gap:8,height:32,padding:"0 8px",borderRadius:8,background:"transparent",border:0,color:wa.texto,font:"inherit",cursor:"pointer"},onMouseEnter:n=>{n.currentTarget.style.background=wa.segmentado;},onMouseLeave:n=>{n.currentTarget.style.background="transparent";},children:[r&&jsx("span",{"aria-hidden":true,className:"flex items-center",style:{color:wa.texto2},children:r}),jsx("span",{className:"flex-1",children:e}),t&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:wa.acentoTexto},"aria-hidden":true})]})}function Wi({children:e}){return jsx("div",{style:{padding:"6px 8px 4px",fontSize:11,fontWeight:500,color:wa.tenue},children:e})}function zi(){return jsx("div",{"aria-hidden":true,style:{height:1,margin:"4px 2px",background:wa.borde}})}var Zl={height:36,boxSizing:"border-box",display:"flex",alignItems:"center",gap:6,borderRadius:10,font:"inherit",fontWeight:500,cursor:"pointer",whiteSpace:"nowrap"};function f0(e){let t=Rr(),a=t.toolbar.today==="Hoy",r=(l,u)=>a?l:u,n=[{valor:"all",etiqueta:r("Todas","All")},{valor:"incomplete",etiqueta:r("Por hacer","To do")},{valor:"in_progress",etiqueta:r("En progreso","In progress")},{valor:"completed",etiqueta:r("Completadas","Completed")}],s=(e.taskFilter!=="all"?1:0)+(e.hideCompleted?1:0),o=[{valor:"compact",etiqueta:r("Compacta","Compact")},{valor:"comfortable",etiqueta:r("Normal","Normal")},{valor:"spacious",etiqueta:r("C\xF3moda","Comfortable")}],i=o.find(l=>l.valor===e.rowDensity)??o[1],c=[e.onExportPNG&&{id:"png",etiqueta:r("Exportar imagen (PNG)","Export image (PNG)"),f:e.onExportPNG},e.onExportPDF&&{id:"pdf",etiqueta:r("Exportar PDF","Export PDF"),f:e.onExportPDF},e.onExportExcel&&{id:"xlsx",etiqueta:r("Exportar Excel","Export Excel"),f:e.onExportExcel},e.onExportMSProject&&{id:"msp",etiqueta:r("Exportar a MS Project","Export to MS Project"),f:e.onExportMSProject}].filter(Boolean);return jsxs("div",{"data-barra-v6":true,className:"flex flex-wrap items-center min-w-0",style:{gap:8,flex:"1 1 auto",fontSize:13,color:wa.texto},children:[e.onTaskFilterChange&&jsx(gu,{boton:(l,u,p)=>jsxs("button",{ref:p,type:"button","aria-haspopup":"menu","aria-expanded":u,onClick:l,style:{...Zl,padding:"0 8px 0 10px",background:wa.tarjeta,color:wa.texto,border:`1px solid ${s?wa.acentoBordeSuave:wa.borde}`},children:[jsx(Filter,{className:"w-[15px] h-[15px]",style:{color:s?wa.acentoTexto:wa.texto2},"aria-hidden":true}),r("Filtros","Filters"),s>0&&jsx("span",{style:{fontFamily:D1,fontSize:11,fontWeight:500,color:wa.acentoTexto,padding:"1px 6px",borderRadius:6,background:wa.acentoFondo2},children:s})]}),children:l=>jsxs(Fragment,{children:[jsx(Wi,{children:r("Estado de la tarea","Task status")}),n.map(u=>jsx(Wn,{marcada:e.taskFilter===u.valor&&!e.hideCompleted,alPulsar:()=>{e.onTaskFilterChange?.(u.valor),e.onHideCompletedChange?.(false),l();},children:u.etiqueta},u.valor)),e.onHideCompletedChange&&jsxs(Fragment,{children:[jsx(zi,{}),jsx(Wn,{marcada:e.hideCompleted,alPulsar:()=>{let u=!e.hideCompleted;e.onHideCompletedChange?.(u),u&&e.onTaskFilterChange?.("all"),l();},children:r("Ocultar completadas","Hide completed")})]})]})}),e.taskFilter!=="all"&&jsx(g0,{texto:n.find(l=>l.valor===e.taskFilter)?.etiqueta??e.taskFilter,quitar:r("Quitar filtro","Remove filter"),alQuitar:()=>e.onTaskFilterChange?.("all")}),e.hideCompleted&&jsx(g0,{texto:r("Ocultar completadas","Hide completed"),quitar:r("Quitar filtro","Remove filter"),alQuitar:()=>e.onHideCompletedChange?.(false)}),jsx("div",{"aria-hidden":true,style:{flex:"1 1 0",minWidth:0}}),jsx("div",{role:"group","aria-label":r("Escala de tiempo","Time scale"),className:"flex items-center",style:{height:36,boxSizing:"border-box",gap:2,padding:"0 2px",border:`1px solid ${wa.borde}`,borderRadius:10,background:wa.segmentado},children:[["day",r("D","D"),r("D\xEDa","Day")],["week",r("S","W"),r("Semana","Week")],["month",r("M","M"),r("Mes","Month")]].map(([l,u,p])=>{let d=e.timeScale===l;return jsx("button",{type:"button","aria-pressed":d,"aria-label":p,title:p,"data-escala-v6":l,onClick:()=>e.onTimeScaleChange(l),style:{width:32,height:30,padding:0,border:0,borderRadius:8,font:"inherit",fontWeight:500,cursor:"pointer",background:d?"var(--v6-escala-activa, #FFFFFF)":"transparent",boxShadow:d?"var(--v6-escala-sombra, 0 1px 2px rgba(14,17,20,0.14))":"none",color:d?wa.texto:wa.texto2},children:u},l)})}),e.toolbarRightContent,jsx(gu,{alinear:"derecha",ancho:200,boton:(l,u,p)=>jsxs("button",{ref:p,type:"button","aria-haspopup":"menu","aria-expanded":u,onClick:l,"aria-label":`${r("Densidad de filas","Row density")}: ${i.etiqueta}`,style:{...Zl,padding:"0 8px 0 10px",border:0,background:"transparent",color:wa.texto},children:[jsx(Rows3,{className:"w-[15px] h-[15px]",style:{color:wa.texto2},"aria-hidden":true}),i.etiqueta,jsx(ChevronDown,{className:"w-3.5 h-3.5",style:{color:wa.tenue},"aria-hidden":true})]}),children:l=>jsxs(Fragment,{children:[jsx(Wi,{children:r("Densidad de filas","Row density")}),o.map(u=>jsx(Wn,{marcada:e.rowDensity===u.valor,alPulsar:()=>{e.onRowDensityChange(u.valor),l();},children:u.etiqueta},u.valor))]})}),jsx(gu,{alinear:"derecha",ancho:248,boton:(l,u,p)=>jsx("button",{ref:p,type:"button","aria-haspopup":"menu","aria-expanded":u,onClick:l,"aria-label":r("M\xE1s opciones: vista, exportar, compartir","More options: view, export, share"),title:r("M\xE1s opciones","More options"),style:{...Zl,width:36,justifyContent:"center",padding:0,border:0,background:"transparent",color:wa.texto2},children:jsx(MoreHorizontal,{className:"w-4 h-4","aria-hidden":true})}),children:l=>jsxs(Fragment,{children:[jsx(Wi,{children:r("Ver","Show")}),e.onShowCriticalPathChange&&jsx(Wn,{marcada:e.showCriticalPath,alPulsar:()=>e.onShowCriticalPathChange?.(!e.showCriticalPath),children:r("Ruta cr\xEDtica","Critical path")}),e.onHighlightWeekendsChange&&jsx(Wn,{marcada:e.highlightWeekends,alPulsar:()=>e.onHighlightWeekendsChange?.(!e.highlightWeekends),children:r("Fines de semana y festivos","Weekends and holidays")}),e.onShowDependenciesChange&&e.hasDependencies!==false&&jsx(Wn,{marcada:e.showDependencies,alPulsar:()=>e.onShowDependenciesChange?.(!e.showDependencies),children:r("Dependencias","Dependencies")}),e.onWbsLevelChange&&jsxs(Fragment,{children:[jsx(zi,{}),jsx(Wi,{children:r("Nivel de la estructura","Structure level")}),["all",...Array.from({length:Math.max(1,e.maxWbsDepth??4)},(u,p)=>p+1)].map(u=>jsx(Wn,{marcada:(e.wbsLevel??"all")===u,alPulsar:()=>{e.onWbsLevelChange?.(u),l();},children:u==="all"?r("Todos los niveles","All levels"):`${r("Hasta el nivel","Up to level")} ${u}`},String(u)))]}),e.onViewModeChange&&jsxs(Fragment,{children:[jsx(zi,{}),jsx(Wi,{children:r("Modo","Mode")}),["execution","oracle"].map(u=>jsx(Wn,{marcada:e.viewMode===u,alPulsar:()=>{e.onViewModeChange?.(u),l();},children:u==="execution"?t.toolbar.viewExecution:t.toolbar.viewOracle},u))]}),(c.length>0||e.onCopySnapshotLink)&&jsx(zi,{}),c.map(u=>jsx(Wn,{alPulsar:()=>{l(),u.f();},children:u.etiqueta},u.id)),e.onCopySnapshotLink&&jsx(Wn,{alPulsar:()=>{l(),e.onCopySnapshotLink?.();},children:r("Copiar enlace","Copy link")}),(e.masOpciones?.length??0)>0&&jsx(zi,{}),e.masOpciones?.map(u=>jsx(Wn,{icono:u.icono,alPulsar:()=>{l(),u.alPulsar();},children:u.etiqueta},u.id))]})}),e.showCreateTaskButton&&e.onCreateTask&&jsxs("button",{type:"button","data-nueva-tarea-v6":true,onClick:e.onCreateTask,style:{...Zl,padding:"0 14px 0 11px",border:0,background:wa.acento,color:wa.sobreAcento,fontWeight:600},children:[jsx(Plus,{className:"w-[15px] h-[15px]",strokeWidth:2.2,"aria-hidden":true}),e.createTaskLabel||r("Nueva tarea","New task")]})]})}function g0({texto:e,quitar:t,alQuitar:a}){return jsxs("span",{"data-filtro-activo-v6":true,className:"flex items-center whitespace-nowrap",style:{height:28,boxSizing:"border-box",gap:2,padding:"0 3px 0 10px",borderRadius:8,background:wa.neutroFondo,color:wa.texto2,fontSize:12},children:[e,jsx("button",{type:"button","aria-label":`${t} ${e}`,onClick:a,className:"flex items-center justify-center",style:{width:22,height:22,padding:0,border:0,borderRadius:6,background:"transparent",color:wa.tenue,cursor:"pointer"},children:jsx(X,{className:"w-3 h-3",strokeWidth:2,"aria-hidden":true})})]})}function ec({columns:e,onToggleColumn:t,theme:a}){let r=Rr(),[n,s]=useState(false),[o,i]=useState({x:0,y:0}),c=useRef(null),l=useRef(null);useEffect(()=>{if(!n)return;let p=d=>{c.current&&!c.current.contains(d.target)&&s(false);};return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[n]);let u=e.filter(p=>p.id!=="name");return jsxs(Fragment,{children:[jsx(motion.button,{ref:l,onClick:()=>{if(!n&&l.current){let p=l.current.getBoundingClientRect();i({x:p.left,y:p.bottom+4});}s(!n);},className:"p-2 rounded-md transition-colors flex items-center gap-1",title:r.toolbar.columns||"Columns","aria-label":r.toolbar.columns||"Columns",style:{backgroundColor:a.bgSecondary,border:`1px solid ${a.borderLight}`,color:a.textSecondary},whileHover:{backgroundColor:a.hoverBg,scale:1.05},whileTap:{scale:.95},children:jsx(Columns3,{className:"w-4 h-4"})}),jsx(AnimatePresence,{children:n&&jsx(Pa,{children:jsx(motion.div,{ref:c,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:"column-manager-menu fixed min-w-[180px] rounded-lg shadow-xl z-[9999]",style:{left:`${o.x}px`,top:`${o.y}px`,backgroundColor:a.bgSecondary,border:`1px solid ${a.border}`},children:jsxs("div",{className:"py-1",children:[jsx("div",{className:"px-3 py-2 text-xs uppercase tracking-wider",style:{color:a.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:"Add Column"}),u.map(p=>jsxs("button",{onClick:()=>{t(p.id);},className:"w-full px-3 py-2 text-left flex items-center justify-between transition-colors text-sm",style:{color:a.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif"},onMouseEnter:d=>{d.currentTarget.style.backgroundColor=a.hoverBg;},onMouseLeave:d=>{d.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{children:p.label}),p.visible&&jsx(Check,{className:"w-4 h-4",style:{color:a.accent}})]},p.id))]})})})})]})}function _s({isOpen:e,x:t,y:a,items:r,onClose:n,theme:s}){let o=useRef(null),[i,c]=useState({x:t,y:a});if(useEffect(()=>{if(!e)return;let u=200,p=r.length*36+8,d=8,m=window.innerWidth,f=window.innerHeight,v=t,b=a;t+u+d>m&&(v=t-u,v<d&&(v=d)),a+p+d>f&&(b=f-p-d,b<d&&(b=d)),c({x:v,y:b});},[e,t,a,r.length]),useEffect(()=>{if(!e)return;let u=d=>{o.current&&!o.current.contains(d.target)&&n();},p=d=>{d.key==="Escape"&&n();};return document.addEventListener("mousedown",u),document.addEventListener("keydown",p),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",p);}},[e,n]),!e)return null;let l=u=>u.startsWith("#")&&(u.length===7||u.length===4)?u:s.bgPrimary?.includes("1")||s.bgPrimary?.includes("2")||s.textPrimary?.toLowerCase().includes("fff")||s.textPrimary?.toLowerCase().includes("white")?"#1E2128":"#FFFFFF";return jsx(AnimatePresence,{children:jsx(motion.div,{ref:o,initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed z-[9999] min-w-[200px] rounded-lg",style:{left:`${i.x}px`,top:`${i.y}px`,backgroundColor:l(s.bgSecondary),border:`1px solid ${s.border}`,boxShadow:"0 10px 40px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2)",backdropFilter:"none"},children:jsx("div",{className:"py-1",children:r.map(u=>jsxs("div",{children:[u.separator&&jsx("div",{className:"my-1 h-px",style:{backgroundColor:s.borderLight}}),jsxs("button",{onClick:()=>{u.disabled||(u.onClick(),n());},disabled:u.disabled,className:"w-full px-3 py-2 text-left flex items-center gap-2 transition-colors text-sm",style:{color:u.disabled?s.textTertiary:s.textPrimary,backgroundColor:"transparent",fontFamily:"Inter, sans-serif",cursor:u.disabled?"not-allowed":"pointer",opacity:u.disabled?.5:1},onMouseEnter:p=>{u.disabled||(p.currentTarget.style.backgroundColor=s.hoverBg);},onMouseLeave:p=>{p.currentTarget.style.backgroundColor="transparent";},children:[u.icon&&jsx("span",{style:{color:s.textSecondary},children:u.icon}),jsx("span",{className:"flex-1",children:u.label}),u.submenu&&jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:s.textTertiary}})]})]},u.id))})})})}var ha={Edit:jsx(Edit3,{className:"w-4 h-4"}),Pencil:jsx(Pencil,{className:"w-4 h-4"}),Delete:jsx(Trash2,{className:"w-4 h-4"}),Add:jsx(Plus,{className:"w-4 h-4"}),AddSubtask:jsx(Plus,{className:"w-4 h-4"}),Remove:jsx(Minus,{className:"w-4 h-4"}),Link:jsx(Link2,{className:"w-4 h-4"}),Progress:jsx(BarChart3,{className:"w-4 h-4"}),Sort:jsx(ArrowUpDown,{className:"w-4 h-4"}),SortAsc:jsx(ArrowUp,{className:"w-4 h-4"}),SortDesc:jsx(ArrowDown,{className:"w-4 h-4"}),Hide:jsx(EyeOff,{className:"w-4 h-4"}),Show:jsx(Eye,{className:"w-4 h-4"}),Settings:jsx(Settings,{className:"w-4 h-4"}),Split:jsx(Scissors,{className:"w-4 h-4"}),Duplicate:jsx(Copy,{className:"w-4 h-4"}),Milestone:jsx(Diamond,{className:"w-4 h-4"}),MarkIncomplete:jsx(Circle,{className:"w-4 h-4"}),SetInProgress:jsx(PlayCircle,{className:"w-4 h-4"}),MarkComplete:jsx(CheckCircle2,{className:"w-4 h-4"})};function k0({tasks:e,selectedTaskIds:t,onTaskSelect:a,onTaskCreate:r,onTaskDelete:n,onTaskDuplicate:s,onTaskMove:o,onTaskIndent:i,onTaskOutdent:c,onTaskRename:l,onTaskToggleExpand:u,onOpenTaskModal:p,enableKeyboard:d=true}){let m=useRef(false),f=useCallback(x=>{m.current=x;},[]),v=useCallback(x=>{let y=[],k=M=>{for(let H of M)y.push(H),H.subtasks&&H.subtasks.length>0&&H.isExpanded&&k(H.subtasks);};return k(x),y},[]),b=useCallback(()=>{let x=v(e);for(let y of x)if(t.has(y.id))return y;return null},[e,t,v]),w=useCallback((x,y)=>{let k=v(e);if(k.length===0)return;let M=b();if(!M){a(k[0].id,false);return}let H=k.findIndex(D=>D.id===M.id);if(H===-1)return;let E=x==="up"?H-1:H+1;if(E<0||E>=k.length)return;let N=k[E];a(N.id,y);},[e,b,v,a]),h=useCallback(x=>{if(!d)return;let y=x.target;if(y.tagName==="INPUT"||y.tagName==="TEXTAREA"||y.isContentEditable||m.current){x.key==="Escape"&&(y.blur(),m.current=false);return}let H=navigator.platform.toUpperCase().indexOf("MAC")>=0?x.metaKey:x.ctrlKey,E=Array.from(t),N=b();if(x.key==="ArrowUp"){x.preventDefault(),w("up",x.shiftKey);return}if(x.key==="ArrowDown"){x.preventDefault(),w("down",x.shiftKey);return}if(N&&(x.key==="ArrowRight"||x.key==="ArrowLeft")){N.subtasks&&N.subtasks.length>0&&(x.preventDefault(),(x.key==="ArrowRight"&&!N.isExpanded||x.key==="ArrowLeft"&&N.isExpanded)&&u(N.id));return}if(x.altKey&&(x.key==="ArrowUp"||x.key==="ArrowDown")){E.length>0&&(x.preventDefault(),o(E,x.key==="ArrowUp"?"up":"down"));return}if(x.key==="Tab"&&!x.shiftKey){E.length>0&&(x.preventDefault(),i(E));return}if(x.key==="Tab"&&x.shiftKey){E.length>0&&(x.preventDefault(),c(E));return}if(x.key==="Enter"&&!x.shiftKey&&!H){N&&(x.preventDefault(),r(N.id,"below"));return}if(x.key==="Enter"&&x.shiftKey&&!H){N&&(x.preventDefault(),r(N.id,"above"));return}if(x.key==="Enter"&&H){N&&(x.preventDefault(),p(N.id));return}if(x.key==="F2"){N&&(x.preventDefault(),l(N.id));return}if(x.key==="Delete"||x.key==="Backspace"&&H){E.length>0&&(x.preventDefault(),n(E));return}if(x.key==="d"&&H&&!x.shiftKey){E.length>0&&(x.preventDefault(),s(E));return}},[d,t,b,w,r,n,s,o,i,c,l,u,p]);return useEffect(()=>{if(d)return window.addEventListener("keydown",h),()=>{window.removeEventListener("keydown",h);}},[d,h]),{setIsEditing:f}}function T0(e){let[t,a]=useState(new Set),[r,n]=useState(null);useEffect(()=>{e&&(a(d=>d.size===1&&d.has(e)?d:new Set([e])),n(d=>d===e?d:e));},[e]);let s=useCallback(d=>{a(new Set([d])),n(d);},[]),o=useCallback(d=>{a(m=>{let f=new Set(m);return f.has(d)?f.delete(d):f.add(d),f}),n(d);},[]),i=useCallback((d,m)=>{if(!r){s(d);return}let f=m.indexOf(r),v=m.indexOf(d);if(f===-1||v===-1){s(d);return}let b=Math.min(f,v),w=Math.max(f,v),h=m.slice(b,w+1);a(new Set(h)),n(d);},[r,s]),c=useCallback((d,m,f,v)=>{v?i(d,m):f?o(d):s(d);},[s,o,i]),l=useCallback((d,m)=>{m?a(f=>{let v=new Set(f);return v.add(d),v}):s(d);},[s]),u=useCallback(()=>{a(new Set),n(null);},[]),p=useCallback(d=>t.has(d),[t]);return {selectedTaskIds:t,selectTask:s,toggleTaskSelection:o,selectTaskRange:i,handleTaskClick:c,handleKeyboardSelection:l,clearSelection:u,isTaskSelected:p}}function ji(e){if(e.length===0)return 0;let t=e.filter(s=>(s.weight||0)>0),a=t.reduce((s,o)=>s+o.weight,0);if(a>=99&&t.length/e.length>=.95)return Math.round(t.reduce((s,o)=>s+(o.progress||0)*o.weight,0)/a);let r=s=>s.effort_minutes??s.sold_effort_minutes??60,n=e.reduce((s,o)=>s+r(o),0);return n>0?Math.round(e.reduce((s,o)=>s+(o.progress||0)*r(o),0)/n):0}function hs(e,t=[]){for(let a of e)if(a.subtasks&&a.subtasks.length>0)hs(a.subtasks,t);else {let r=a;t.push({progress:a.progress||0,weight:r.weight||0,effort_minutes:r.effort_minutes??r.effortMinutes??null,sold_effort_minutes:r.sold_effort_minutes??r.soldEffortMinutes??null});}return t}function hu(e){return e.map((t,a)=>({...t,position:a,subtasks:t.subtasks?.length?hu(t.subtasks):t.subtasks}))}function ys(e){let t=[],a=(r,n,s=0)=>{let o=[...r].sort((i,c)=>(i.position??0)-(c.position??0));for(let i=0;i<o.length;i++){let c={...o[i],parentId:n,level:s,position:o[i].position??i};t.push(c),c.subtasks&&c.subtasks.length>0&&c.isExpanded&&a(c.subtasks,c.id,s+1);}};return a(e),t}function Ks(e,t){for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Ks(a.subtasks,t);if(r)return r}}return null}function bu(e,t){for(let a of e)if(a.subtasks){if(a.subtasks.some(n=>n.id===t))return a;let r=bu(a.subtasks,t);if(r)return r}return null}function yu(e,t){if(t.length===0)return e;let a=ys(e),r=t[0],n=a.findIndex(d=>d.id===r);if(n<=0)return e;let s=a[n-1],o=(d,m)=>{let f=[];return {tasks:d.filter(b=>{if(m.has(b.id))return f.push(b),false;if(b.subtasks){let w=o(b.subtasks,m);b.subtasks=w.tasks,f.push(...w.removed);}return true}),removed:f}},i=(d,m,f)=>d.map(v=>v.id===m?{...v,subtasks:[...v.subtasks||[],...f],isExpanded:true}:v.subtasks?{...v,subtasks:i(v.subtasks,m,f)}:v),c=new Set(t),{tasks:l,removed:u}=o(e,c),p=i(l,s.id,u);return hu(p)}function xu(e,t){if(t.length===0)return e;let a=[...e];for(let r of t){let n=bu(a,r);if(!n)continue;let s=bu(a,n.id),o=(l,u,p)=>{for(let d=0;d<l.length;d++){let m=l[d];if(m.id===u&&m.subtasks){let f=m.subtasks.findIndex(v=>v.id===p);if(f!==-1){let[v]=m.subtasks.splice(f,1);return v}}if(m.subtasks){let f=o(m.subtasks,u,p);if(f)return f}}return null},i=(l,u,p)=>{let d=l.findIndex(m=>m.id===u);if(d!==-1)return l.splice(d+1,0,p),l;for(let m of l)m.subtasks&&i(m.subtasks,u,p);return l},c=o(a,n.id,r);c&&(s&&s.subtasks?i(s.subtasks,n.id,c):i(a,n.id,c));}return hu(a)}function vu(e,t,a){if(t.length===0)return e;let r=[...e],n=t[0],s=(o,i,c)=>{let l=o.findIndex(p=>p.id===i);if(l===-1){for(let p of o)if(p.subtasks&&s(p.subtasks,i,c))return true;return false}let u=c==="up"?l-1:l+1;return u<0||u>=o.length?false:([o[l],o[u]]=[o[u],o[l]],o[l]={...o[l],position:l},o[u]={...o[u],position:u},true)};return s(r,n,a),r}function wu(e,t){let a=new Set(t),r=n=>n.filter(s=>!a.has(s.id)).map(s=>s.subtasks?{...s,subtasks:r(s.subtasks)}:s);return r(e)}function Vi(e,t){let a=[...e],r=[];for(let n of t){let s=(c,l)=>c.map((u,p)=>({...u,id:`${u.id}-copy-${Date.now()}-${p}`,parentId:l,subtasks:u.subtasks?s(u.subtasks,`${u.id}-copy-${Date.now()}-${p}`):void 0})),o=c=>{let l=c.findIndex(m=>m.id===n);if(l===-1){for(let m of c)if(m.subtasks){let f=o(m.subtasks);if(f)return f}return null}let u=c[l],p=`${u.id}-copy-${Date.now()}`,d={...u,id:p,name:`${u.name} (Copy)`,subtasks:u.subtasks?s(u.subtasks,p):void 0};return c.splice(l+1,0,d),d},i=o(a);i&&r.push(i);}return {tasks:a,duplicatedTasks:r}}function D0(e,t,a){let r=[...e],n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o={id:`task-${Date.now()}`,name:"New Task",progress:0,status:"todo",startDate:n,endDate:s,color:"#00E5CC"},i=c=>{let l=c.findIndex(p=>p.id===t);if(l===-1){for(let p of c)if(p.subtasks&&i(p.subtasks))return true;return false}let u=a==="above"?l:l+1;return c.splice(u,0,o),true};return i(r),{tasks:r,newTask:o}}function ku(e,t,a){return e.map(r=>r.id===t?{...r,name:a}:r.subtasks?{...r,subtasks:ku(r.subtasks,t,a)}:r)}function Cu(e,t){return e.map(a=>a.id===t?{...a,isExpanded:!a.isExpanded}:a.subtasks?{...a,subtasks:Cu(a.subtasks,t)}:a)}function Tu(e,t){let a=d=>{for(let m of d){if(m.id===t)return m;if(m.subtasks){let f=a(m.subtasks);if(f)return f}}return null},r=a(e),n=new Date,s=new Date(n);s.setDate(s.getDate()+7);let o=r?.startDate||n,i=r?.endDate||s,c=d=>{for(let m of d){if(m.id===t)return (m.subtasks||[]).length;if(m.subtasks){let f=c(m.subtasks);if(f>=0)return f}}return 0},l=c(e),u={id:`task-${Date.now()}`,name:"New Subtask",progress:0,status:"todo",startDate:new Date(o),endDate:new Date(i),color:r?.color||"#00E5CC",position:l,parentId:t},p=d=>d.map(m=>{if(m.id===t){let f=m.subtasks||[];return {...m,subtasks:[...f,u],isExpanded:true}}return m.subtasks?{...m,subtasks:p(m.subtasks)}:m});return {tasks:p(e),newTask:u}}function N0(e,t,a,r){if(t===a)return e;let n=Ks(e,t);if(!n)return e;if(a){let i=(c,l)=>{if(!c.subtasks)return false;for(let u of c.subtasks)if(u.id===l||i(u,l))return true;return false};if(i(n,a))return e}let s=i=>{let c=i.filter(u=>u.id!==t),l=c.length<i.length;return c.map((u,p)=>{let d=l?{...u,position:p}:u;return d.subtasks&&d.subtasks.length>0?{...d,subtasks:s(d.subtasks)}:d})},o=s(e);if(a===null){let i=r!==void 0?r:o.length;o.splice(i,0,{...n,parentId:void 0}),o=o.map((c,l)=>({...c,position:l}));}else {let i=c=>c.map(l=>{if(l.id===a){let u=l.subtasks||[],p=r!==void 0?r:u.length,d=[...u];d.splice(p,0,{...n,parentId:a});let m=d.map((f,v)=>({...f,position:v}));return {...l,subtasks:m,isExpanded:true}}return l.subtasks&&l.subtasks.length>0?{...l,subtasks:i(l.subtasks)}:l});o=i(o);}return o}function Cn(e){return e.map(t=>{if(!t.subtasks||t.subtasks.length===0)return t;let a=Cn(t.subtasks),r=a.reduce((i,c)=>(c.startDate&&i.starts.push(new Date(c.startDate).getTime()),c.endDate&&i.ends.push(new Date(c.endDate).getTime()),i.progresses.push(c.progress??0),i),{starts:[],ends:[],progresses:[]}),n=r.starts.length>0?new Date(Math.min(...r.starts)):t.startDate,s=r.ends.length>0?new Date(Math.max(...r.ends)):t.endDate,o=r.progresses.length>0?ji(hs(a)):t.progress;return {...t,subtasks:a,startDate:n,endDate:s,progress:o}})}function ac({tasks:e,theme:t,rowHeight:a,availableUsers:r=[],templates:n,onTaskClick:s,onTaskSelectionChange:o,selectedTaskId:i,onTaskDblClick:c,onTaskContextMenu:l,onTaskToggle:u,scrollTop:p,columns:d,onToggleColumn:m,onColumnResize:f,onTaskUpdate:v,onBulkFill:b,onTaskIndent:w,onTaskOutdent:h,onTaskMove:x,onMultiTaskDelete:y,onTaskDuplicate:k,onTaskCreate:M,onTaskRename:H,addTaskRow:E,onCreateSubtask:N,onTaskDependencies:D,onOpenTaskModal:S,onDeleteRequest:V,onTaskReparent:W,allTasks:R,scrollContainerRef:A,showCriticalPath:ve=false,v6:q=false,resumenV6:le,onContraerTodo:B}){let pe=bo(),nt=useContext(ls),[Ue,$]=useState(null),[fe,ie]=useState(null),[et,Xe]=useState(""),Qe=useRef(null),[ct,Tt]=useState(null),[_t,tt]=useState(0),[xt,Jt]=useState(0),[Wt,Qt]=useState({isOpen:false,x:0,y:0,type:"header"}),[Y,Le]=useState(null),[Ye,he]=useState(null),[dt,wt]=useState(null),ue=useRef(0),ce=5,Ae=useRef(false),[Et,Pe]=useState(null),[ut,O]=useState(false),re=useRef(null),[we,ot]=useState(null),[mt,Ht]=useState(null),[Zt,Oe]=useState(false),Wa=useRef(null);useEffect(()=>{function G(X){Wa.current&&!Wa.current.contains(X.target)&&Oe(false);}if(Zt)return document.addEventListener("mousedown",G),()=>document.removeEventListener("mousedown",G)},[Zt]),useEffect(()=>{fe&&Qe.current&&(Qe.current.focus(),Qe.current.select());},[fe]),useEffect(()=>{if(!ct)return;let G=F=>{let P=F.clientX-_t,z=xt+P;f?.(ct,z);},X=()=>{Tt(null),document.body.style.cursor="",document.body.style.userSelect="";};return document.addEventListener("mousemove",G),document.addEventListener("mouseup",X),document.body.style.cursor="col-resize",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",X),document.body.style.cursor="",document.body.style.userSelect="";}},[ct,_t,xt,f]);let{selectedTaskIds:la,handleTaskClick:da,isTaskSelected:ke}=T0(i),{setIsEditing:Te}=k0({tasks:e,selectedTaskIds:la,onTaskSelect:(G,X)=>{let P=ys(e).map(z=>z.id);da(G,P,X||false,false),o?.(G);},onTaskCreate:M||(()=>{}),onTaskDelete:y||(()=>{}),onTaskDuplicate:k||(()=>{}),onTaskMove:x||(()=>{}),onTaskIndent:w||(()=>{}),onTaskOutdent:h||(()=>{}),onTaskRename:G=>{let X=ys(e).find(F=>F.id===G);X&&it(X);},onTaskToggleExpand:u||(()=>{}),onOpenTaskModal:G=>{let X=ys(e).find(F=>F.id===G);X&&S&&S(X);},enableKeyboard:true}),gt=(G,X=0,F="")=>{let P=[],z=[...G].sort((j,J)=>(j.position??0)-(J.position??0));for(let j=0;j<z.length;j++){let J=z[j],be=j+1,Be=F?`${F}.${be}`:`${be}.0`,De=J.wbsCode||Be;if(J.wbsCode=De,P.push({task:J,level:X}),J.subtasks&&J.subtasks.length>0&&J.isExpanded){let lt=J.wbsCode?.replace(/\.0$/,"")||(F?`${F}.${be}`:`${be}`);P.push(...gt(J.subtasks,X+1,lt));}}return P},Ie=gt(e),Lt=q?60:48,I=Math.max(Ie.length*a,600-Lt),te=(G,X)=>X==="assignees"?G.assignees:X==="startDate"?G.startDate:G.endDate,Re=(G,X,F,P)=>{G.preventDefault(),G.stopPropagation(),ot({sourceTaskId:X,column:F,sourceIndex:P,targetIndex:P}),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let z=G.currentTarget.closest("[data-grid-body]"),j=Se=>{let je=z?.getBoundingClientRect().top??0,xe=Math.floor((Se-je)/a);return xe=Math.max(0,Math.min(Ie.length-1,xe)),xe<P&&(xe=P),xe},J=G.clientY,be=A?.current??null,Be=()=>{re.current&&(cancelAnimationFrame(re.current),re.current=null);},De=()=>{let Se=j(J);ot(je=>je&&{...je,targetIndex:Se});},Ne=()=>{if(Be(),!be)return;let Se=be.getBoundingClientRect(),je=60,xe=12,Kt=J-Se.top,ca=Se.bottom-J;if(ca<je&&be.scrollTop<be.scrollHeight-be.clientHeight){let pr=Math.max(1,Math.round(xe*(1-Math.max(0,ca)/je))),rr=()=>{be.scrollTop+=pr,De(),be.scrollTop<be.scrollHeight-be.clientHeight&&(re.current=requestAnimationFrame(rr));};re.current=requestAnimationFrame(rr);}else if(Kt<je&&be.scrollTop>0){let pr=Math.max(1,Math.round(xe*(1-Math.max(0,Kt)/je))),rr=()=>{be.scrollTop-=pr,De(),be.scrollTop>0&&(re.current=requestAnimationFrame(rr));};re.current=requestAnimationFrame(rr);}},lt=Se=>{J=Se.clientY,De(),Ne();},kt=Se=>{window.removeEventListener("mousemove",lt),window.removeEventListener("mouseup",kt),Be(),document.body.style.cursor="",document.body.style.userSelect="",ot(null);let je=j(Se.clientY),xe=Ie.find(Fr=>Fr.task.id===X)?.task;if(!xe)return;let Kt=te(xe,F),ca=Math.min(P,je),pr=Math.max(P,je),rr=[];for(let Fr=ca;Fr<=pr;Fr++){if(Fr===P)continue;let Lr=Ie[Fr]?.task;!Lr||Lr.subtasks&&Lr.subtasks.length>0||rr.push(Lr.id);}rr.length!==0&&b?.(rr,F,Kt);};window.addEventListener("mousemove",lt),window.addEventListener("mouseup",kt);},Ee=G=>{if(!we)return false;let X=Math.min(we.sourceIndex,we.targetIndex),F=Math.max(we.sourceIndex,we.targetIndex);return G>=X&&G<=F},_e=G=>!G.startDate||!G.endDate?"-":`${Math.ceil((G.endDate.getTime()-G.startDate.getTime())/(1e3*60*60*24))}d`,it=G=>{ie(G.id),Xe(G.name),Te(true);},qe=G=>{et.trim()&&et!==e.find(X=>X.id===G)?.name&&H?.(G,et.trim()),ie(null),Xe(""),Te(false);},Ze=()=>{ie(null),Xe(""),Te(false);},Ct=(G,X)=>{X.stopPropagation(),N?.(G.id);},At=(G,X)=>{X.preventDefault(),ue.current=X.clientY,Le(G),Ae.current=false,O(false),Pe({x:X.clientX,y:X.clientY});},It=G=>{if(!Y||(Math.abs(G.clientY-ue.current)>ce&&!Ae.current&&(Ae.current=true,O(true)),Pe({x:G.clientX,y:G.clientY}),!Ae.current))return;if(A?.current){let j=A.current,J=j.getBoundingClientRect(),be=60,Be=12;re.current&&(cancelAnimationFrame(re.current),re.current=null);let De=G.clientY-J.top,Ne=J.bottom-G.clientY;if(De<be&&j.scrollTop>0){let lt=Math.round(Be*(1-De/be)),kt=()=>{j.scrollTop-=lt,Ae.current&&j.scrollTop>0&&(re.current=requestAnimationFrame(kt));};re.current=requestAnimationFrame(kt);}else if(Ne<be&&j.scrollTop<j.scrollHeight-j.clientHeight){let lt=Math.round(Be*(1-Ne/be)),kt=()=>{j.scrollTop+=lt,Ae.current&&j.scrollTop<j.scrollHeight-j.clientHeight&&(re.current=requestAnimationFrame(kt));};re.current=requestAnimationFrame(kt);}}let F=document.querySelectorAll("[data-task-row]"),P=null,z=null;F.forEach(j=>{let J=j.getBoundingClientRect(),be=j.getAttribute("data-task-row");if(be&&be!==Y&&G.clientY>=J.top&&G.clientY<=J.bottom){P=be;let Be=G.clientY-J.top,De=J.height;Be<De*.25?z="above":Be>De*.75?z="below":z="child";}}),he(P),wt(z);},Ke=()=>{if(Ae.current&&Y&&Ye&&dt){if(dt==="child")W?.(Y,Ye);else if(dt==="above"||dt==="below"){let G=(j,J,be=null)=>{for(let Be of j){if(Be.id===J)return be;if(Be.subtasks){let De=G(Be.subtasks,J,Be.id);if(De!==void 0)return De}}},X=R&&R.length>0?R:e,F=G(X,Y,null),P=G(X,Ye,null),z=(j,J,be,Be)=>{let De=j.findIndex(kt=>kt.id===J),Ne=Be?j.findIndex(kt=>kt.id===be):-1,lt=dt==="below"?De+1:De;return Be&&Ne!==-1&&Ne<De&&(lt-=1),Math.max(0,lt)};if(P===null){let J=z(X,Ye,Y,F===null);W?.(Y,null,J);}else {let j=Ks(X,P);if(j?.subtasks){let J=F===P,be=z(j.subtasks,Ye,Y,J);W?.(Y,P,be);}}}}re.current&&(cancelAnimationFrame(re.current),re.current=null),Le(null),he(null),wt(null),Pe(null),Ae.current=false,O(false);};useEffect(()=>{if(Y)return document.addEventListener("mousemove",It),document.addEventListener("mouseup",Ke),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",It),document.removeEventListener("mouseup",Ke),document.body.style.cursor="",document.body.style.userSelect="";}},[Y,Ye,dt]);let Fe=(G,X,F,P)=>{if(G.id==="name"){let z=fe===X.id,j=Ue===X.id;return jsxs("div",{"data-celda-nombre-v6":true,className:"flex items-center min-w-0 relative",style:{gap:6,alignSelf:"stretch",width:"100%",paddingLeft:`${F*20}px`},children:[Array.from({length:F},(J,be)=>jsx("span",{"aria-hidden":true,style:{position:"absolute",left:8+be*20,top:0,bottom:0,width:1,background:"var(--v6-separador, #CDD2D8)"}},be)),W&&j&&!z&&jsx("div",{className:"cursor-grab active:cursor-grabbing flex items-center",style:{position:"absolute",left:-10,top:0,bottom:0,width:10,color:"var(--v6-tenue, #5F6972)"},onMouseDown:J=>At(X.id,J),title:pe?"Arrastrar para mover la tarea":"Drag to move the task",children:jsx(GripVertical,{style:{width:10,height:14}})}),P?jsx("button",{type:"button",onClick:J=>{J.stopPropagation(),u?.(X.id);},"aria-label":pe?X.isExpanded?`Contraer ${X.name}`:`Desplegar ${X.name}`:X.isExpanded?`Collapse ${X.name}`:`Expand ${X.name}`,"aria-expanded":!!X.isExpanded,style:{flex:"none",width:18,height:18,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:0,borderRadius:6,background:"transparent",color:"var(--v6-tenue, #5F6972)",cursor:"pointer"},children:X.isExpanded?jsx(ChevronDown,{style:{width:14,height:14},strokeWidth:2}):jsx(ChevronRight,{style:{width:14,height:14},strokeWidth:2})}):jsx("span",{"aria-hidden":true,style:{flex:"none",width:18}}),X.wbsCode&&jsx("span",{style:{flex:"none",minWidth:28,textAlign:"right",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontVariantNumeric:"tabular-nums",fontSize:11,color:"var(--v6-tenue, #5F6972)"},children:X.wbsCode}),z?jsx("input",{ref:Qe,type:"text",value:et,onChange:J=>Xe(J.target.value),onKeyDown:J=>{J.key==="Enter"?qe(X.id):J.key==="Escape"&&Ze();},onBlur:()=>qe(X.id),className:"flex-1 min-w-0 px-2 py-1 rounded border outline-none",style:{background:"var(--v6-tarjeta, #fff)",borderColor:"var(--v6-acento, #0FA392)",color:"var(--v6-texto, #0E1114)",font:"inherit",fontSize:13},onClick:J=>J.stopPropagation()}):jsx("span",{title:X.name,style:{marginLeft:2,flex:"1 1 auto",minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",fontSize:13,fontWeight:P||X.isMilestone?600:500,color:"var(--v6-texto, #0E1114)"},children:X.name}),ve&&X.isCriticalPath&&jsx("span",{"aria-label":pe?"En la ruta cr\xEDtica":"On the critical path",style:{flex:"none",width:6,height:6,borderRadius:"50%",background:"var(--v6-rojo-punto, #D13A40)"}}),j&&!z&&jsxs("div",{className:"flex items-center",style:{gap:2,flex:"none"},onClick:J=>J.stopPropagation(),children:[jsx("button",{type:"button",onClick:J=>Ct(X,J),"aria-label":pe?"Crear subtarea":"Create subtask",title:pe?"Crear subtarea":"Create subtask",style:{width:20,height:20,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:0,borderRadius:6,background:"transparent",color:"var(--v6-tenue, #5F6972)",cursor:"pointer"},children:jsx(Plus,{style:{width:13,height:13}})}),jsx("button",{type:"button",onClick:J=>{J.stopPropagation(),it(X);},"aria-label":pe?"Renombrar (F2)":"Rename (F2)",title:pe?"Renombrar (F2)":"Rename (F2)",style:{width:20,height:20,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:0,borderRadius:6,background:"transparent",color:"var(--v6-tenue, #5F6972)",cursor:"pointer"},children:jsx(Edit3,{style:{width:13,height:13}})})]})]})}if(G.id==="assignees"){if(P)return jsx("span",{"aria-hidden":true});let z=r.filter(j=>X.assignees?.some(J=>J.id?J.id===j.id:J.name===j.name||J.initials===j.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:j=>j.stopPropagation(),children:jsx(Po,{variante:"v6",es:pe,nombreDeLaTarea:X.name,assignedUsers:z,availableUsers:r,onChange:j=>v?.(X.id,{assignees:j.map(J=>({id:J.id,name:J.name,initials:J.initials,color:J.color}))})})})}if(G.id==="progress"){let z=Math.round(X.progress||0),j=!P&&z>0&&z<100;return jsxs("div",{className:"w-full",style:{textAlign:"right",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontVariantNumeric:"tabular-nums",fontSize:12,fontWeight:P||j?500:400,color:j?"var(--v6-acento-texto, #066A5F)":z===0?"var(--v6-tenue, #5F6972)":"var(--v6-texto, #0E1114)"},children:[z,"%"]})}},ft=(G,X,F)=>{let P=X.subtasks&&X.subtasks.length>0;if(q){let z=Fe(G,X,F,!!P);if(z!==void 0)return z}switch(G.id){case "name":let z=fe===X.id,j=Ue===X.id;return jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0 relative",style:{paddingLeft:`${F*20}px`},children:[W&&jsx("div",{className:"cursor-grab active:cursor-grabbing p-0.5 rounded hover:bg-white/10 transition-all flex-shrink-0",style:{color:t.textTertiary,opacity:j?1:.3},onMouseDown:xe=>At(X.id,xe),title:"Arrastrar para mover tarea",children:jsx(GripVertical,{className:"w-4 h-4"})}),X.subtasks&&X.subtasks.length>0?jsx("button",{onClick:xe=>{xe.stopPropagation(),u?.(X.id);},"aria-label":pe?X.isExpanded?`Contraer ${X.name}`:`Desplegar ${X.name}`:X.isExpanded?`Collapse ${X.name}`:`Expand ${X.name}`,"aria-expanded":!!X.isExpanded,className:"p-0.5 hover:bg-opacity-10 rounded transition-colors flex-shrink-0",style:{color:t.textSecondary},children:X.isExpanded?jsx(ChevronDown,{className:"w-4 h-4"}):jsx(ChevronRight,{className:"w-4 h-4"})}):jsx("div",{className:"w-5 h-5 flex-shrink-0"}),z?jsx("input",{ref:Qe,type:"text",value:et,onChange:xe=>Xe(xe.target.value),onKeyDown:xe=>{xe.key==="Enter"?qe(X.id):xe.key==="Escape"&&Ze();},onBlur:()=>qe(X.id),className:"flex-1 px-2 py-1 rounded border outline-none",style:{backgroundColor:t.bgPrimary,borderColor:t.accent,color:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:"13px",fontWeight:500},onClick:xe=>xe.stopPropagation()}):jsxs(Fragment,{children:[jsxs("span",{className:"flex-1 min-w-0",style:{display:"flex",alignItems:"baseline",gap:"6px",color:X.parentId?t.textSecondary:t.textPrimary,fontFamily:"Inter, sans-serif",fontSize:X.parentId?"13px":"14px",fontWeight:X.isMilestone?600:X.parentId?400:600,letterSpacing:X.parentId?"0":"-0.01em"},title:X.name,children:[X.wbsCode&&jsx("span",{style:{color:`var(--pj-texto-tenue, ${t.textTertiary})`,fontFamily:"'JetBrains Mono', monospace",fontSize:"11px",fontWeight:500,flexShrink:0},children:X.wbsCode}),X.isHighlighted&&X.status==="completed"&&jsx("span",{title:"\u2605",style:{color:"#F59E0B",fontSize:"10px",flexShrink:0,lineHeight:1},children:"\u2605"}),jsx("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:X.name}),X.subtasks&&X.subtasks.length>0&&jsxs("span",{style:{color:"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"12px",fontWeight:400,flexShrink:0,whiteSpace:"nowrap"},children:["\xB7 ",Math.round(X.progress||0),"%"]}),ve&&X.isCriticalPath&&jsx("span",{style:{display:"inline-block",width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#EF4444",flexShrink:0,marginLeft:"2px"}}),ve&&X.cpmData&&jsx("span",{title:pe?"D\xEDas que la tarea puede retrasarse sin mover el fin del proyecto":"Total float: days the task can slip without moving the project end",style:{color:X.cpmData.totalFloat<=0?"#EF4444":X.cpmData.totalFloat<=5?"#F59E0B":"#6B7280",fontFamily:"'JetBrains Mono', monospace",fontSize:"10px",fontWeight:500,flexShrink:0,whiteSpace:"nowrap",marginLeft:"4px"},children:pe?`Holgura: ${Math.round(X.cpmData.totalFloat)} d`:`TF: ${Math.round(X.cpmData.totalFloat)}d`})]}),j&&!z&&jsxs("div",{className:"flex items-center gap-1 ml-2",onClick:xe=>xe.stopPropagation(),children:[jsx("button",{onClick:xe=>Ct(X,xe),className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Create subtask",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx("button",{onClick:xe=>{xe.stopPropagation(),it(X);},className:"p-1 rounded hover:bg-opacity-20 transition-colors",style:{color:t.textTertiary,backgroundColor:"transparent"},title:"Rename (F2)",children:jsx(Edit3,{className:"w-3.5 h-3.5"})})]})]})]});case "startDate":case "endDate":let be=G.id==="startDate"?"startDate":"endDate",Be=X[be],De=mt?.taskId===X.id&&mt?.field===be,Ne=xe=>{if(!xe)return q?"\u2014":"-";let Kt=typeof xe=="string"?new Date(xe):xe;return q?Kt.toLocaleDateString(pe?"es-ES":"en-US",{day:"numeric",month:"short"}).replace(".",""):Kt.toLocaleDateString("es-ES",{day:"2-digit",month:"2-digit",year:"numeric"})};return jsxs("div",{className:`flex items-center w-full relative ${q?"justify-start":"justify-center"}`,onClick:xe=>xe.stopPropagation(),children:[jsxs("button",{type:"button",className:q?"flex items-center rounded":"flex items-center gap-1.5 px-2 py-1 rounded text-xs transition-colors hover:bg-white/5",style:q?{whiteSpace:"nowrap",padding:0,border:0,background:"transparent",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontVariantNumeric:"tabular-nums",fontSize:11,color:"var(--v6-texto-2, #4D5761)",cursor:P?"default":"pointer"}:{color:t.textSecondary,opacity:P?.5:1,cursor:P?"default":"pointer"},title:P?"Auto-calculated from subtasks":void 0,onClick:xe=>{if(!P)if(De)Ht(null);else {let Kt=xe.currentTarget.getBoundingClientRect();Ht({taskId:X.id,field:be,month:Be?typeof Be=="string"?new Date(Be):Be:new Date,position:{top:Kt.bottom+4,left:Kt.left}});}},children:[!q&&jsx(Calendar,{className:"w-3 h-3",style:{color:t.textTertiary}}),jsx("span",{children:Ne(Be)}),P&&!q&&jsx("span",{style:{fontSize:"9px",color:t.textTertiary,marginLeft:"2px"},children:"\u25BC"})]}),De&&typeof document<"u"&&createPortal(jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-[9998]",onClick:()=>Ht(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"fixed z-[9999] rounded-xl shadow-2xl overflow-visible flex",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,top:mt?.position.top,left:mt?.position.left},onClick:xe=>xe.stopPropagation(),children:[jsxs("div",{className:"w-36 py-2",style:{borderRight:`1px solid ${t.border}`},children:[(()=>{let xe=new Date,Kt=new Date(xe);Kt.setDate(xe.getDate()+1);let ca=new Date(xe);ca.setDate(xe.getDate()+7);let pr=new Date(xe);return pr.setDate(xe.getDate()+14),[{label:"Hoy",date:xe},{label:"Ma\xF1ana",date:Kt},{label:"Pr\xF3xima semana",date:ca},{label:"2 semanas",date:pr}].map((Fr,Lr)=>jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:t.textPrimary},onMouseEnter:jr=>jr.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:jr=>jr.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(X.id,{[be]:Fr.date}),Ht(null);},children:Fr.label},Lr))})(),jsx("div",{style:{borderTop:`1px solid ${t.border}`,margin:"0.25rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-1.5 text-xs text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=t.hoverBg||"rgba(255,255,255,0.05)",onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{v?.(X.id,{[be]:void 0}),Ht(null);},children:"Borrar"})]}),jsxs("div",{className:"p-2",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("button",{type:"button",onClick:()=>Ht(xe=>xe?{...xe,month:new Date(xe.month.getFullYear(),xe.month.getMonth()-1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronLeft,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})}),jsx("span",{className:"text-xs font-medium",style:{color:t.textPrimary},children:mt?.month.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>Ht(xe=>xe?{...xe,month:new Date(xe.month.getFullYear(),xe.month.getMonth()+1)}:null),className:"p-1 rounded hover:bg-white/10",children:jsx(ChevronRight,{className:"w-3.5 h-3.5",style:{color:t.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-0.5 mb-1",children:["L","M","X","J","V","S","D"].map((xe,Kt)=>jsx("div",{className:"w-6 h-6 flex items-center justify-center text-[10px]",style:{color:t.textTertiary},children:xe},Kt))}),jsx("div",{className:"grid grid-cols-7 gap-0.5",children:(()=>{let xe=mt?.month||new Date,Kt=xe.getFullYear(),ca=xe.getMonth(),pr=(new Date(Kt,ca,1).getDay()+6)%7,rr=new Date(Kt,ca+1,0).getDate(),Fr=new Date,Lr=[];for(let za=pr-1;za>=0;za--)Lr.push({day:new Date(Kt,ca,-za).getDate(),date:new Date(Kt,ca-1,new Date(Kt,ca,-za).getDate()),isCurrentMonth:false});for(let za=1;za<=rr;za++)Lr.push({day:za,date:new Date(Kt,ca,za),isCurrentMonth:true});let jr=42-Lr.length;for(let za=1;za<=jr;za++)Lr.push({day:za,date:new Date(Kt,ca+1,za),isCurrentMonth:false});return Lr.map((za,Eo)=>{let sn=za.date.toDateString()===Fr.toDateString(),fn=(Be?typeof Be=="string"?new Date(Be):Be:null)?.toDateString()===za.date.toDateString();return jsx("button",{type:"button",className:"w-6 h-6 rounded-full flex items-center justify-center text-[10px] transition-colors",style:{color:za.isCurrentMonth?fn?"#FFF":t.textPrimary:t.textTertiary,backgroundColor:fn?"#00E5CC":"transparent",boxShadow:sn&&!fn?"inset 0 0 0 1px #00E5CC":"none"},onClick:()=>{v?.(X.id,{[be]:za.date}),Ht(null);},children:za.day},Eo)})})()})]})]})]}),document.body)]});case "duration":return jsx("div",{className:"flex items-center justify-center w-full",children:jsx("span",{className:"text-xs tabular-nums",style:{color:t.textSecondary,fontFamily:"Inter, sans-serif",fontWeight:600},children:_e(X)})});case "assignees":if(P)return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.4},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:"\u2014"})});let lt=r.filter(xe=>X.assignees?.some(Kt=>Kt.id?Kt.id===xe.id:Kt.name===xe.name||Kt.initials===xe.initials));return jsx("div",{className:"flex items-center justify-center w-full",onClick:xe=>xe.stopPropagation(),children:jsx(Po,{assignedUsers:lt,availableUsers:r,onChange:xe=>{let Kt=xe.map(ca=>({id:ca.id,name:ca.name,initials:ca.initials,color:ca.color}));v?.(X.id,{assignees:Kt});}})});case "status":if(P){let xe=X.progress===100?"\u2713":X.progress>0?"\u25D0":"\u25CB";return jsx("div",{className:"flex items-center justify-center w-full",style:{opacity:.5},children:jsx("span",{className:"text-xs",style:{color:t.textTertiary},children:xe})})}return jsx("div",{className:"flex items-center justify-center w-full",onClick:xe=>xe.stopPropagation(),children:jsx(Gm,{status:X.status||"todo",onChange:xe=>{v?.(X.id,{status:xe,progress:xe==="completed"?100:X.progress});}})});case "progress":return jsxs("div",{className:"flex items-center justify-center gap-2 w-full",style:{opacity:P?.6:1},children:[jsx("div",{className:"flex-1 h-1.5 rounded-full overflow-hidden max-w-[60px]",style:{backgroundColor:t.bgSecondary},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${X.progress}%`,backgroundColor:X.progress===100?t.statusCompleted:t.accent}})}),jsxs("span",{className:"text-xs tabular-nums min-w-[35px] text-right",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600},children:[X.progress,"%"]})]});case "priority":let kt={low:"LOW",medium:"MEDIUM",high:"HIGH",urgent:"URGENT"},Se={LOW:"low",MEDIUM:"medium",HIGH:"high",URGENT:"urgent"},je=kt[X.priority||"medium"]||"MEDIUM";return jsx("div",{className:"flex items-center justify-center w-full",onClick:xe=>xe.stopPropagation(),children:jsx(os,{priority:je,onChange:xe=>{xe&&v?.(X.id,{priority:Se[xe]||"medium"});}})});default:return null}},_a=G=>[{id:"hide",label:"Hide Column",icon:ha.Hide,onClick:()=>m(G),disabled:G==="name"},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"sortAsc",label:"Sort Ascending",icon:ha.SortAsc,onClick:()=>{}},{id:"sortDesc",label:"Sort Descending",icon:ha.SortDesc,onClick:()=>{}}],ma=G=>{let X=G.subtasks&&G.subtasks.length>0,F=ys(e),P=la.size>1&&la.has(G.id),z=P?F.filter(De=>la.has(De.id)):[G],j=z.map(De=>De.id),J=z.filter(De=>!(De.subtasks&&De.subtasks.length>0)),be=P?` (${j.length})`:"",Be=()=>{V?V(j,G.name):y?.(j);};return X?[{id:"addSubtask",label:nt?.contextMenu?.addSubtask||"Add Subtask",icon:ha.Add,onClick:()=>{N?.(G.id);}},{id:"duplicate",label:(nt?.contextMenu?.duplicateTask||"Duplicate Task")+be,icon:ha.Duplicate,onClick:()=>{k?.(j);}},{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"delete",label:(nt?.contextMenu?.deleteTask||"Delete Task")+be,icon:ha.Delete,onClick:Be}]:[{id:"edit",label:nt?.contextMenu?.editTask||"Edit Task",icon:ha.Pencil,onClick:()=>{c?.(G);}},{id:"addSubtask",label:nt?.contextMenu?.addSubtask||"Add Subtask",icon:ha.Add,onClick:()=>{N?.(G.id);}},...D?[{id:"dependencies",label:nt?.contextMenu?.dependencies||"Dependencies\u2026",icon:ha.Link,onClick:()=>D(G)}]:[],...v&&!(G.subtasks&&G.subtasks.length>0)?[{id:"milestone",label:G.isMilestone?pe?"Quitar hito":"Remove milestone":pe?"Convertir en hito":"Convert to milestone",icon:ha.Milestone,onClick:()=>v(G.id,{isMilestone:!G.isMilestone})}]:[],{id:"sep1",label:"",onClick:()=>{},separator:true},{id:"markIncomplete",label:(nt?.contextMenu?.markIncomplete||"Mark Incomplete")+be,icon:ha.MarkIncomplete,onClick:()=>{J.forEach(De=>v?.(De.id,{status:"todo",progress:0}));},disabled:J.length===0||J.every(De=>De.status==="todo")},{id:"setInProgress",label:(nt?.contextMenu?.setInProgress||"Set In Progress")+be,icon:ha.SetInProgress,onClick:()=>{J.forEach(De=>v?.(De.id,{status:"in-progress"}));},disabled:J.length===0||J.every(De=>De.status==="in-progress")},{id:"markComplete",label:(nt?.contextMenu?.markComplete||"Mark Complete")+be,icon:ha.MarkComplete,onClick:()=>{J.forEach(De=>v?.(De.id,{status:"completed",progress:100}));},disabled:J.length===0||J.every(De=>De.status==="completed")},{id:"sep2",label:"",onClick:()=>{},separator:true},{id:"duplicate",label:(nt?.contextMenu?.duplicateTask||"Duplicate Task")+be,icon:ha.Duplicate,onClick:()=>{k?.(j);}},{id:"split",label:nt?.contextMenu?.splitTask||"Split Task",icon:ha.Split,onClick:()=>{},disabled:true},{id:"sep3",label:"",onClick:()=>{},separator:true},{id:"delete",label:(nt?.contextMenu?.deleteTask||"Delete Task")+be,icon:ha.Delete,onClick:Be}]},ta=d.filter(G=>G.visible),de=ta.reduce((G,X)=>G+X.width,0);return jsxs("div",{className:"gantt-taskgrid-content",style:{backgroundColor:t.bgPrimary,minWidth:de},children:[q?jsxs("div",{"data-cabecera-tabla-v6":true,className:"sticky top-0 z-10 flex flex-col",style:{height:`${Lt}px`,boxSizing:"border-box",background:"var(--v6-tarjeta, #FFFFFF)",borderBottom:"1px solid var(--v6-borde, #E2E5E9)"},children:[jsxs("div",{style:{height:24,boxSizing:"border-box",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 10px 0 14px",borderBottom:"1px solid var(--v6-linea, #EEF0F2)",fontSize:11,color:"var(--v6-tenue, #5F6972)"},children:[jsx("span",{className:"truncate",children:le}),B&&jsx("button",{type:"button",onClick:B,"aria-label":pe?"Contraer todos los grupos":"Collapse all groups",title:pe?"Contraer todos los grupos":"Collapse all groups",style:{width:20,height:20,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:0,borderRadius:6,background:"transparent",color:"var(--v6-tenue, #5F6972)",cursor:"pointer"},children:jsx(ChevronsDownUp,{style:{width:13,height:13},strokeWidth:2})})]}),jsx("div",{style:{flex:1,display:"flex",alignItems:"center",gap:10,padding:"0 14px 0 10px",fontSize:11,fontWeight:500,color:"var(--v6-tenue, #5F6972)"},children:ta.map(G=>jsx("div",{style:{width:G.id==="name"?void 0:G.width,flex:G.id==="name"?"1 1 0":"0 0 auto",minWidth:0,whiteSpace:"nowrap",overflow:"hidden",textAlign:G.id==="assignees"?"center":G.id==="progress"?"right":"left",paddingLeft:G.id==="name"?60:0},children:G.label},G.id))})]}):jsxs("div",{className:"sticky top-0 z-10 flex items-center",style:{backgroundColor:t.glassHeader||t.bgSecondary,height:`${Lt}px`,paddingLeft:"3px",borderBottom:`1px solid ${t.border}`,boxSizing:"border-box"},children:[jsx("div",{className:"flex items-center flex-1 min-w-0",children:ta.map((G,X)=>{let F=X===ta.length-1,P=G.id==="name";return jsxs("div",{className:`flex items-center px-4 cursor-pointer hover:bg-opacity-50 transition-colors relative ${P?"":"justify-center"}`,style:{width:`${G.width}px`,minWidth:`${G.minWidth??(P?200:60)}px`,maxWidth:`${G.maxWidth??2e3}px`,flexShrink:P&&ta.length===1?1:0,flexGrow:P&&ta.length===1?1:0,borderRight:F?"none":`1px solid ${t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"hidden"},onContextMenu:z=>{z.preventDefault(),Qt({isOpen:true,x:z.clientX,y:z.clientY,type:"header",columnId:G.id});},onMouseEnter:z=>{z.currentTarget.style.backgroundColor=t.hoverBg;},onMouseLeave:z=>{z.currentTarget.style.backgroundColor="transparent";},children:[jsx("span",{className:"text-xs uppercase tracking-wider",style:{color:t.textTertiary,fontFamily:"Inter, sans-serif",fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,paddingRight:"0"},title:G.label,children:G.label}),G.resizable&&jsx("div",{className:"absolute right-0 top-0 bottom-0 cursor-col-resize transition-colors group",style:{width:"12px",marginRight:"-6px",backgroundColor:ct===G.id?`${t.accent}30`:"transparent",zIndex:5},onMouseDown:z=>{z.preventDefault(),z.stopPropagation(),Tt(G.id),tt(z.clientX),Jt(G.width);},title:pe?"Arrastra para cambiar el ancho":"Drag to resize column",children:jsx("div",{className:"absolute top-0 bottom-0 transition-opacity",style:{left:"5px",width:"2px",backgroundColor:t.accent,borderRadius:"1px",opacity:ct===G.id?.8:void 0},children:jsx("div",{className:"absolute inset-0 opacity-20 group-hover:opacity-80 transition-opacity",style:{backgroundColor:t.accent}})})})]},G.id)})}),jsxs("div",{className:"flex items-center gap-1 px-2",style:{position:"sticky",right:0,height:"100%",backgroundColor:t.glassHeader||t.bgSecondary,zIndex:5},children:[jsx(ec,{columns:d,onToggleColumn:m,theme:t}),jsx("button",{onClick:()=>Oe(!Zt),className:"p-1.5 rounded hover:bg-opacity-10 transition-colors",style:{color:t.textTertiary},title:"Keyboard shortcuts",children:jsx(Keyboard,{className:"w-4 h-4"})}),Zt&&jsxs("div",{ref:Wa,className:"absolute top-full right-0 mt-2 p-4 rounded-lg shadow-2xl z-50 min-w-[400px]",style:{backgroundColor:t.bgPrimary,border:`1px solid ${t.border}`,color:t.textPrimary},onClick:G=>G.stopPropagation(),children:[jsxs("div",{className:"flex items-center justify-between mb-3 pb-2 border-b",style:{borderColor:t.border},children:[jsx("h3",{className:"font-semibold text-sm",style:{color:t.textPrimary},children:"Keyboard Shortcuts"}),jsx("button",{onClick:()=>Oe(false),className:"text-xs px-2 py-1 rounded hover:bg-opacity-10",style:{color:t.textTertiary},children:"Close"})]}),jsxs("div",{className:"space-y-3 text-xs",children:[jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Navigation"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move focus up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Select range"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Toggle selection"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Click"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Hierarchy"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Indent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Outdent task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Tab"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Expand/Collapse"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"\u2192 / \u2190"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Editing"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task below"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Create task above"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Shift + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Open task modal"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + Enter"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Rename task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"F2"})]})]})]}),jsxs("div",{children:[jsx("div",{className:"font-semibold mb-1.5",style:{color:t.textSecondary},children:"Actions"}),jsxs("div",{className:"space-y-1",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Move task up/down"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Alt + \u2191 / \u2193"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Delete task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Delete"})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{style:{color:t.textTertiary},children:"Duplicate task"}),jsx("kbd",{className:"px-2 py-0.5 rounded font-mono text-xs",style:{backgroundColor:t.bgGrid,color:t.textPrimary},children:"Cmd/Ctrl + D"})]})]})]})]})]})]})]}),jsxs("div",{className:"gantt-taskgrid-content","data-grid-body":true,style:{minHeight:I},children:[Ie.map(({task:G,level:X},F)=>{let P=ke(G.id),z=Ee(F),j=Ye===G.id,J=j&&dt==="above",be=j&&dt==="below",Be=j&&dt==="child",De={};return Be&&(De.backgroundColor=`${t.accent}15`,De.boxShadow=`inset 0 0 0 2px ${t.accent}`),jsxs(motion.div,{"data-task-row":G.id,className:`flex items-center cursor-pointer group ${Y===G.id?"opacity-50":""}`,style:{position:"relative",height:`${a}px`,...q?{boxSizing:"border-box",padding:"0 14px 0 10px",gap:10,borderBottom:"1px solid var(--v6-linea, #EEF0F2)",boxShadow:P?"inset 2px 0 0 var(--v6-acento, #0FA392)":void 0,backgroundColor:P?"var(--v6-fila-seleccionada, rgba(15,163,146,0.08))":Be?`${t.accent}15`:"transparent"}:{borderLeft:P?`3px solid ${t.accent}`:"3px solid transparent",backgroundColor:P?t.accentLight:Be?`${t.accent}15`:F%2===0?t.bgPrimary:t.bgGrid},opacity:ve?G.isCriticalPath?1:.4:void 0,transition:"opacity 300ms ease",...De},onMouseEnter:()=>$(G.id),onMouseLeave:()=>$(null),onClick:Ne=>{let kt=ys(e).map(xe=>xe.id),je=navigator.platform.toUpperCase().indexOf("MAC")>=0?Ne.metaKey:Ne.ctrlKey;da(G.id,kt,je,Ne.shiftKey),o?.(G.id),!je&&!Ne.shiftKey&&s?.(G);},onDoubleClick:Ne=>{Ne.stopPropagation(),c?.(G);},onContextMenu:Ne=>{Ne.preventDefault(),Qt({isOpen:true,x:Ne.clientX,y:Ne.clientY,type:"task",task:G}),l?.(G,Ne);},whileHover:{backgroundColor:q?P?"var(--v6-fila-seleccionada, rgba(15,163,146,0.08))":"var(--v6-fila-hover, rgba(14,17,20,0.025))":P?t.accentLight:t.hoverBg},children:[J&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),be&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:"2px",backgroundColor:t.accent,zIndex:10}}),ta.map((Ne,lt)=>{let kt=lt===ta.length-1,Se=Ne.id==="name",je=!!(G.subtasks&&G.subtasks.length>0),xe=Ne.id==="assignees"||Ne.id==="startDate"||Ne.id==="endDate"?Ne.id:null,ca=!!xe&&!je&&Ue===G.id&&!we,pr=z&&!!we&&we.column===Ne.id;return jsxs("div",{className:q?"flex items-center":`px-4 flex items-center ${Se?"justify-start":"justify-center"}`,style:q?{position:"relative",width:Se?void 0:`${Ne.width}px`,flex:Se?"1 1 0":"0 0 auto",minWidth:0,height:"100%",alignItems:"center",overflow:"visible",backgroundColor:pr?`${t.accent}22`:void 0}:{position:"relative",width:`${Ne.width}px`,minWidth:`${Ne.minWidth??(Se?200:60)}px`,maxWidth:`${Ne.maxWidth??2e3}px`,flexShrink:Se&&ta.length===1?1:0,flexGrow:Se&&ta.length===1?1:0,borderRight:kt?"none":`1px solid ${Ue===G.id?t.border:t.borderLight}`,height:"100%",boxSizing:"border-box",overflow:"visible",backgroundColor:pr?`${t.accent}22`:void 0,boxShadow:pr?`inset 0 0 0 1px ${t.accent}66`:void 0},children:[ft(Ne,G,Se?X:0),ca&&xe&&jsx("div",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:rr=>Re(rr,G.id,xe,F),style:{position:"absolute",right:2,bottom:2,width:8,height:8,borderRadius:2,background:t.accent,border:`1px solid ${t.bgPrimary}`,cursor:"crosshair",zIndex:5}})]},`${G.id}-${Ne.id}`)})]},G.id)}),E&&jsxs("button",{type:"button","data-anadir-tarea":true,onClick:E.onClick,className:q?"w-full flex items-center text-left":"w-full flex items-center gap-2 px-3 text-left text-[13px] transition-colors",style:q?{height:36,gap:8,padding:"0 14px 0 34px",border:0,background:"transparent",color:"var(--v6-tenue, #5F6972)",font:"inherit",fontSize:13,cursor:"pointer"}:{height:`${a}px`,color:t.textTertiary,borderBottom:`1px solid ${t.borderLight}`},onMouseEnter:G=>{G.currentTarget.style.color=q?"var(--v6-texto, #0E1114)":t.textPrimary;},onMouseLeave:G=>{G.currentTarget.style.color=q?"var(--v6-tenue, #5F6972)":t.textTertiary;},children:[jsx(Plus,{className:"w-3.5 h-3.5"}),E.label]})]}),jsx(_s,{isOpen:Wt.isOpen,x:Wt.x,y:Wt.y,items:Wt.type==="header"&&Wt.columnId?_a(Wt.columnId):Wt.type==="task"&&Wt.task?ma(Wt.task):[],onClose:()=>Qt({...Wt,isOpen:false}),theme:t}),ut&&Et&&Y&&typeof document<"u"&&createPortal(jsx("div",{style:{position:"fixed",left:Et.x+12,top:Et.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let G=Ie.find(X=>X.task.id===Y)?.task;return G?jsx("div",{className:"flex items-center gap-2 px-2 py-1 rounded",style:{backgroundColor:"rgba(255, 255, 255, 0.08)",backdropFilter:"blur(4px)"},children:jsx("span",{className:"text-xs font-medium",style:{color:t.textSecondary,opacity:.9},children:G.name})}):null})()}),document.body)]})}function A0(e,t){let[a,r]=useState("none"),[n,s]=useState(0),[o,i]=useState(e),[c,l]=useState(t),[u,p]=useState(null),[d,m]=useState(null),[f,v]=useState(null),[b,w]=useState(null),[h,x]=useState(0),[y,k]=useState(0),[M,H]=useState(null),[E,N]=useState(false);return {dragMode:a,setDragMode:r,dragOffset:n,setDragOffset:s,ghostX:o,setGhostX:i,ghostWidth:c,setGhostWidth:l,connectionLine:u,setConnectionLine:p,hoveredTaskId:d,setHoveredTaskId:m,activeZone:f,setActiveZone:v,draggedSegmentIndex:b,setDraggedSegmentIndex:w,draggedSegmentStartX:h,setDraggedSegmentStartX:x,segmentDragOffsetX:y,setSegmentDragOffsetX:k,hoveredSegmentIndex:M,setHoveredSegmentIndex:H,isHovered:E,setIsHovered:N,isDragging:a!=="none",isResizing:a==="resize-start"||a==="resize-end",isConnecting:a==="connect",resetDragState:(R,A)=>{r("none"),p(null),m(null),i(R),l(A),k(0),w(null),x(0);}}}function rc({task:e,x:t,y:a,width:r,theme:n,dayWidth:s,startDate:o,templates:i,onClick:c,onDoubleClick:l,onContextMenu:u,onDateChange:p,onDependencyCreate:d,allTaskPositions:m=[],onDragMove:f,onHoverChange:v,showBaseline:b,showTaskBarLabels:w=true,showCriticalPath:h=true,readOnly:x=false,onProgressChange:y,v6:k=false,alturaBarra:M,duracionV6:H}){let E=bo(),N=A0(t,r),D=useRef(null),S=useRef(false),V=bo(),W=useRef(false),R=useRef(null),A=useRef(null),{dragMode:ve,setDragMode:q,dragOffset:le,setDragOffset:B,ghostX:pe,setGhostX:nt,ghostWidth:Ue,setGhostWidth:$,connectionLine:fe,setConnectionLine:ie,hoveredTaskId:et,setHoveredTaskId:Xe,activeZone:Qe,setActiveZone:ct,draggedSegmentIndex:Tt,setDraggedSegmentIndex:_t,draggedSegmentStartX:tt,setDraggedSegmentStartX:xt,segmentDragOffsetX:Jt,setSegmentDragOffsetX:Wt,hoveredSegmentIndex:Qt,setHoveredSegmentIndex:Y,isHovered:Le,setIsHovered:Ye,isDragging:he,isResizing:dt,isConnecting:wt,resetDragState:ue}=N,ce=M??18,Ae=!!n.executionBarBg,Et=n.textPrimary==="#FFFFFF"||n.bgPrimary==="#050505",Pe=Ae?3:6,ut=e.subtasks&&e.subtasks.length>0,O=useRef(null),[re,we]=(()=>{let P=useRef(null),[,z]=useState(0);return [P.current,j=>{P.current=j,z(J=>J+1);}]})(),ot=!!y&&!x&&!ut&&!e.segments&&!!e.startDate&&!!e.endDate,mt=e.endDate&&(()=>{let P=new Date;P.setHours(0,0,0,0);let z=new Date(e.endDate);return z.setHours(0,0,0,0),z<P})()&&e.progress<100,Ht=h&&e.isCriticalPath,Zt=n.name==="neutral"||n.today==="#1C1917",Oe=e.status==="completed"||e.progress===100,Wa={low:"#10B981",LOW:"#10B981",medium:"#F59E0B",MEDIUM:"#F59E0B",high:"#F97316",HIGH:"#F97316",urgent:"#EF4444",URGENT:"#EF4444"},da=h&&e.isCriticalPath||mt?"#EF4444":e.color?e.color:e.priority&&Wa[e.priority]?Wa[e.priority]:n.taskBarPrimary,ke=x?"default":he?wt?"crosshair":dt?"ew-resize":"grabbing":"grab",Te=x?"default":"ew-resize",Ie=(P=>P>=80?20:P>=60?15:P>=50?12:10)(r),Lt=r<50,I=r<40;useEffect(()=>{v&&(!Le||he||e.segments)&&v(null);},[Le,he,e.segments,v]);let te=P=>P.toLocaleDateString(E?"es-CO":"en-US",{month:"short",day:"numeric",year:"numeric"}),Re=()=>{let P=Math.ceil((e.endDate.getTime()-e.startDate.getTime())/864e5);return E?`${P} d\xEDa${P!==1?"s":""}`:`${P} day${P!==1?"s":""}`},Ee=P=>Math.round(P/s)*s,_e=P=>{let z=Math.round(P/s),j=new Date(o);return j.setDate(j.getDate()+z),j},it=P=>{let z=m.find(J=>J.id===P),j=!!z&&!!fe&&fe.x>z.x+z.width/2;return S.current?j?"SF":"SS":j?"FF":"FS"},qe=(P,z)=>{for(let j of m){if(j.id===e.id)continue;let J=5;if(P>=j.x-J&&P<=j.x+j.width+J&&z>=j.y-J&&z<=j.y+j.height+J)return j.id}return null},Ze=useCallback((P,z,j)=>{if(x)return;P.preventDefault(),P.stopPropagation();let J=D.current?.ownerSVGElement;if(!J)return;let be=J.createSVGPoint();be.x=P.clientX,be.y=P.clientY;let Be=be.matrixTransform(J.getScreenCTM()?.inverse()),De=j!==void 0?j:t,Ne=z;if(!Ne){let lt=Be.x-De;P.shiftKey?(Ne="connect",S.current=false,ie({x:t+r,y:a+ce/2})):P.ctrlKey||P.metaKey?Ne="move":P.altKey?Ne=lt<r/2?"resize-start":"resize-end":I?lt<r/2?Ne="move":Ne="resize-end":Lt?lt<=Ie/2?Ne="resize-start":lt>=r-Ie/2?Ne="resize-end":Ne="move":lt<=Ie?Ne="resize-start":lt>=r-Ie?Ne="resize-end":Ne="move";}W.current=false,q(Ne),Ye(false),ct(null),Ne==="move"?B(Be.x-De):Ne==="connect"?ie({x:S.current?t:t+r,y:a+ce/2}):B(0),nt(De),$(r);},[t,r,a,ce,x]),Ct=useCallback(P=>{let z=D.current?.ownerSVGElement;if(!z)return;let j=z.closest(".gantt-timeline-scroll");if(!j)return;let J=j.getBoundingClientRect(),be=60,Be=15,De=0;if(P.clientX<J.left+be){let Ne=J.left+be-P.clientX;De=-Math.min(Be,Ne/2);}else if(P.clientX>J.right-be){let Ne=P.clientX-(J.right-be);De=Math.min(Be,Ne/2);}return De!==0&&(j.scrollLeft+=De),De!==0},[]),At=useCallback(P=>{if(ve==="none")return;W.current=true,A.current=P;let z=D.current?.ownerSVGElement;if(!z)return;if(ve==="move"||ve==="resize-start"||ve==="resize-end"){let be=Ct(P);be&&!R.current?R.current=window.setInterval(()=>{A.current&&(Ct(A.current),At(A.current));},16):!be&&R.current&&(window.clearInterval(R.current),R.current=null);}let j=z.createSVGPoint();j.x=P.clientX,j.y=P.clientY;let J=j.matrixTransform(z.getScreenCTM()?.inverse());if(ve==="connect"){ie({x:J.x,y:J.y});let be=qe(J.x,J.y);Xe(be);}else if(ve==="move"){let be=J.x-le,Be=Ee(be);nt(Be),$(r);let De=Math.round((Be-t)/s);if(f?.(e.id,De,true),e.segments&&e.segments.length>0&&Tt!==null){let Ne=Be-tt;Wt(Ne);}}else if(ve==="resize-start"){let be=J.x,Be=Ee(be),De=t+r-Be;De>=s&&(nt(Be),$(De));}else if(ve==="resize-end"){let be=J.x,De=Ee(be)-t;De>=s&&$(De);}},[ve,t,r,s,le,e,Ee,Tt,tt,qe,Xe,ie,nt,$,Wt,f,Ct]),It=useCallback(()=>{if(R.current&&(window.clearInterval(R.current),R.current=null),A.current=null,ve!=="none"){if(ve==="connect")et&&d&&d(e,et,it(et)),ie(null),Xe(null);else {let P=e.endDate.getTime()-e.startDate.getTime(),z,j,J=true;if(ve==="move"){if(z=_e(pe),j=new Date(z.getTime()+P),e.segments&&e.segments.length>0&&Tt!==null){let be=Math.round(Jt/s),Be=e.segments.map((kt,Se)=>{if(Se===Tt){let je=new Date(kt.startDate),xe=new Date(kt.endDate);return je.setDate(je.getDate()+be),xe.setDate(xe.getDate()+be),{startDate:je,endDate:xe}}return kt}),De=Be.flatMap(kt=>[kt.startDate,kt.endDate]),Ne=new Date(Math.min(...De.map(kt=>kt.getTime()))),lt=new Date(Math.max(...De.map(kt=>kt.getTime())));p?.({...e,segments:Be},Ne,lt),ue(t,r);return}}else ve==="resize-start"?(z=_e(pe),j=e.endDate,z>j&&(console.warn("Invalid date range: start date must be before or equal to end date"),J=false)):ve==="resize-end"?(z=e.startDate,j=_e(pe+Ue),j.setDate(j.getDate()-1),j<z&&(console.warn("Invalid date range: end date must be after or equal to start date"),J=false)):J=false;J&&z&&j&&(j.getTime()<z.getTime()?console.warn("Invalid date range: end date cannot be before start date"):p?.(e,z,j));}f?.(e.id,0,false),ue(t,r);}},[ve,pe,Ue,e,p,et,d,t,r,s,_e,Jt,Tt,ue,f]);useEffect(()=>{if(ve==="none")return;let P=j=>{At(j);},z=()=>{It();};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",z),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",z),R.current&&(window.clearInterval(R.current),R.current=null);}},[ve,At,It]);let Ke=he&&!wt?pe:t,Fe=he&&!wt?Ue:r,ft=i.taskClass(e),_a=24,ma=h?e.isCriticalPath?1:.25:1,ta=useCallback(P=>{if(!ot)return;P.stopPropagation(),P.preventDefault();let j=D.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??null;O.current={barRect:j,initialPct:e.progress||0},P.currentTarget.setPointerCapture(P.pointerId),we(e.progress||0);},[ot,e.progress,we]),de=useCallback(P=>{let z=O.current;if(!z)return;let J=D.current?.querySelector('rect[data-bar-background="true"]')?.getBoundingClientRect()??z.barRect;if(!J||J.width<=0)return;let be=(P.clientX-J.left)/J.width,Be=Math.round(Math.max(0,Math.min(1,be))*100);P.shiftKey&&(Be=Math.round(Be/25)*25),we(Be);},[we]),G=useCallback(P=>{let z=O.current;if(!z)return;P.stopPropagation(),P.preventDefault();try{P.currentTarget.releasePointerCapture(P.pointerId);}catch{}let j=re;O.current=null,we(null),j!=null&&j!==z.initialPct&&y&&y(e,j);},[re,y,e,we]),X=useCallback(P=>{P.stopPropagation(),P.preventDefault();},[]),F=re??(e.progress||0);return jsxs("g",{ref:D,"data-task-bar":"true","data-estado":Oe?"completed":mt?"overdue":"planned","data-resumen":ut?"true":void 0,style:{opacity:ma,transition:"opacity 300ms ease"},onClick:()=>{!he&&!W.current&&c?.(e),W.current=false;},onDoubleClick:P=>{!he&&!W.current&&(P.stopPropagation(),l?.(e));},onContextMenu:P=>{P.preventDefault(),u?.(e,P);},onMouseEnter:()=>!he&&Ye(true),onMouseMove:P=>{v&&Le&&!he&&!e.segments&&v({task:e,x:t,y:a,width:r,height:ce,showBelow:false,mouseX:P.clientX,mouseY:P.clientY});},onMouseLeave:()=>{he||(Ye(false),ct(null));},children:[jsx("rect",{x:t,y:a,width:r+_a,height:ce,fill:"transparent",style:{pointerEvents:"all"}}),Le&&!he&&!Lt&&!e.segments&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:Ie,height:ce,fill:Qe==="resize-start"?n.accent:"transparent",opacity:Qe==="resize-start"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>ct("resize-start"),onMouseDown:P=>Ze(P,"resize-start")}),jsx("rect",{x:t+Ie,y:a,width:r-Ie*2,height:ce,fill:Qe==="move"?n.accent:"transparent",opacity:Qe==="move"?.1:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ct("move"),onMouseDown:P=>Ze(P,"move")}),jsx("rect",{x:t+r-Ie,y:a,width:Ie,height:ce,fill:Qe==="resize-end"?n.accent:"transparent",opacity:Qe==="resize-end"?.15:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>ct("resize-end"),onMouseDown:P=>Ze(P,"resize-end")})]}),Le&&!he&&I&&jsxs(Fragment,{children:[jsx("rect",{x:t,y:a,width:r/2,height:ce,fill:Qe==="move"?n.accent:"transparent",opacity:Qe==="move"?.2:0,style:{cursor:x?"default":"grab",pointerEvents:"all"},onMouseEnter:()=>ct("move"),onMouseDown:P=>Ze(P,"move")}),jsx("rect",{x:t+r/2,y:a,width:r/2,height:ce,fill:Qe==="resize-end"?n.accent:"transparent",opacity:Qe==="resize-end"?.2:0,style:{cursor:Te,pointerEvents:"all"},onMouseEnter:()=>ct("resize-end"),onMouseDown:P=>Ze(P,"resize-end")}),Le&&jsx(motion.line,{x1:t+r/2,y1:a+4,x2:t+r/2,y2:a+ce-4,stroke:n.textTertiary,strokeWidth:1,strokeDasharray:"2 2",opacity:.3,initial:{opacity:0},animate:{opacity:.3},transition:{duration:.2},style:{pointerEvents:"none"}})]}),he&&!wt&&!e.segments&&jsx(motion.rect,{x:pe,y:a,width:Ue,height:ce,rx:Pe,fill:n.accent,opacity:.15,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 3",initial:{opacity:0},animate:{opacity:.25},transition:{duration:.15},style:{pointerEvents:"none"}}),b&&e.baselineStartDate&&e.baselineEndDate&&!he&&(()=>{let P=e.baselineStartDate.getTime(),z=e.baselineEndDate.getTime(),j=o.getTime(),J=864e5,be=(P-j)/J,Be=(z-P)/J,De=be*s,Ne=Math.max(Be*s,s),lt=Ke+Fe,kt=De+Ne,Se=e.endDate?.getTime()??0,je=Math.ceil((Se-z)/J),xe=je>0,Kt=je<-0;return jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:De,y:a,width:Ne,height:ce,rx:Pe,fill:"none",stroke:Et?"rgba(255,255,255,0.45)":"rgba(0,0,0,0.35)",strokeWidth:1.5,strokeDasharray:"6 4"}),xe&<>kt&&jsx("rect",{x:kt,y:a,width:lt-kt,height:ce,rx:0,fill:"#EF4444",opacity:.2}),xe&&jsxs("text",{x:Math.max(lt,kt)+6,y:a+ce/2+1,fill:"#EF4444",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:["+",je,"d"]}),Kt&&jsxs("text",{x:lt+6,y:a+ce/2+1,fill:"#10B981",fontSize:"10",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",dominantBaseline:"middle",children:[je,"d"]})]})})(),!e.segments&&Ae&&ut&&(()=>{let z=a+(ce-8)/2,j=4,J=e.progress||0,be=new Date;be.setHours(0,0,0,0);let Be=e.startDate&&be>=e.startDate,De=e.endDate&&(()=>{let xe=new Date(e.endDate);return xe.setHours(0,0,0,0),be>xe})(),Ne=e.startDate&&be<e.startDate,lt=1;if(Be&&e.startDate&&e.endDate&&!Ne){let xe=new Date(e.startDate);xe.setHours(0,0,0,0);let Kt=new Date(e.endDate);Kt.setHours(0,0,0,0);let ca=Math.max(1,(Kt.getTime()-xe.getTime())/(1e3*60*60*24)),rr=Math.min((be.getTime()-xe.getTime())/(1e3*60*60*24),ca)/ca*100;lt=rr>0?J/rr:1;}let kt;J>=100?kt="#00E5CC":Ne?kt="#4B5563":De&&J<100?kt="#EF4444":lt>=.95?kt="#22C55E":lt>=.8?kt="#F59E0B":kt="#EF4444";let Se=Math.max(J/100*Fe,J>0?j*2:0),je=Fe>100&&J>0;return jsxs("g",{"data-task-class":ft,style:{cursor:"default",pointerEvents:"all"},children:[jsx("rect",{"data-parte":"pista",x:Ke,y:z,width:Fe,height:8,rx:j,fill:"rgba(255,255,255,0.10)"}),J>0&&jsx("rect",{"data-parte":"avance",x:Ke,y:z,width:Se,height:8,rx:j,fill:kt}),je&&jsxs("text",{x:Ke+Se+6,y:z+8/2,dominantBaseline:"central",fill:n.textSecondary,fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(J),"%"]})]})})(),k&&!e.segments&&!ut&&(()=>{let P=`v6-barra-${String(e.id).replace(/[^A-Za-z0-9_-]/g,"")}`,z=!!mt&&!Oe,j=Math.max(0,Math.min(100,F));return jsxs(Fragment,{children:[jsx("defs",{children:jsx("clipPath",{id:P,children:jsx("rect",{x:Ke,y:a,width:Fe,height:ce,rx:6})})}),jsx("rect",{x:Ke+.5,y:a+.5,width:Math.max(0,Fe-1),height:ce-1,rx:6,"data-parte":"pista","data-bar-background":"true","data-task-class":ft,fill:j>0?"var(--v6-acento-fondo-3, rgba(15,163,146,0.16))":"var(--v6-acento-fondo, rgba(15,163,146,0.1))",stroke:z?"var(--v6-rojo-borde, rgba(192,48,58,0.75))":"var(--v6-acento-borde, rgba(8,127,114,0.85))",strokeWidth:1,onMouseDown:J=>Ze(J),style:{cursor:ke,pointerEvents:"all",opacity:he&&!wt?.25:1}}),j>0&&jsx("rect",{x:Ke,y:a,width:Fe*(j/100),height:ce,clipPath:`url(#${P})`,"data-parte":"avance",fill:"var(--v6-acento, #0FA392)",style:{pointerEvents:"none"}}),Ht&&jsx("rect",{x:Ke,y:a,width:Fe,height:ce,rx:6,fill:"none",stroke:"var(--v6-rojo-punto, #D13A40)",strokeWidth:1.5,"data-parte":"alerta",style:{pointerEvents:"none"}}),H&&!he&&jsx("text",{x:Ke+Fe+6,y:a+ce/2,dominantBaseline:"middle",fill:"var(--v6-tenue, #5F6972)",fontSize:11,fontFamily:"'JetBrains Mono', ui-monospace, monospace",style:{fontVariantNumeric:"tabular-nums",pointerEvents:"none",userSelect:"none"},children:H})]})})(),!k&&!e.segments&&Ae&&!ut&&jsx(motion.rect,{x:Ke,y:a,width:Fe,height:ce,rx:Pe,fill:n.executionBarBg||"rgba(255,255,255,0.06)",stroke:n.border||"rgba(255,255,255,0.1)",strokeWidth:1,"data-task-class":ft,"data-bar-background":"true","data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:he&&!wt?.15:e.parentId?.6:1,scale:Le&&!he?1.01:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:P=>Ze(P),style:{cursor:ke,pointerEvents:"all"}}),!k&&!e.segments&&!Ae&&jsx(motion.rect,{x:Ke,y:a,width:Fe,height:ce,rx:Pe,fill:da,"data-task-class":ft,"data-parte":"pista",initial:{opacity:0,scale:.95},animate:{opacity:he&&!wt?.15:e.parentId?.6:Le?.9:.8,scale:Le&&!he?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:ut?void 0:P=>Ze(P),style:{cursor:ut?"default":ke,pointerEvents:"all"}}),!k&&Ae&&(mt||Ht)&&!e.segments&&jsx("rect",{x:Ke,y:a,width:Fe,height:ce,rx:Pe,fill:"none",stroke:n.criticalPath,strokeWidth:2,"data-parte":"alerta",style:{pointerEvents:"none",filter:`drop-shadow(0 0 6px ${n.criticalPathLight||"rgba(255,46,46,0.4)"})`}}),mt&&!Oe&&!e.segments&&!ut&&jsxs("g",{"data-parte":"icono-vencida",display:"none",style:{pointerEvents:"none"},transform:`translate(${Ke+Fe+4}, ${a+ce/2-6})`,children:[jsx("circle",{cx:6,cy:6,r:5.25,fill:"none",stroke:"currentColor",strokeWidth:1.5}),jsx("line",{x1:6,y1:3.5,x2:6,y2:6.5,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round"}),jsx("circle",{cx:6,cy:8.6,r:.8,fill:"currentColor"})]}),!k&&!e.segments&&F>0&&!ut&&jsx("rect",{x:Ke,y:a,width:Math.max(Fe*(F/100),Pe*2),height:ce,rx:Pe,fill:da,opacity:1,"data-parte":"avance",style:{pointerEvents:"none"}}),!k&&!e.segments&&!ut&&e.progress<100&&(()=>{let P=e.progress>0?Fe*(e.progress/100):0,z=Ke+P,j=Fe-P,J=e.progress===0?Pe:0,be=e.progress===0?Ke:z,Be=e.progress===0?Fe:j;return jsxs(Fragment,{children:[jsx("rect",{x:be,y:a,width:Be,height:ce,rx:J,fill:"url(#bar-remaining-hatch)","data-parte":"trama",style:{pointerEvents:"none"}}),jsx("rect",{x:be,y:a,width:Be,height:ce,rx:J,fill:"none",stroke:da,strokeWidth:.8,strokeDasharray:"5 3","data-parte":"borde-restante",style:{pointerEvents:"none"}})]})})(),!k&&Ae&&!e.segments&&e.progress>0&&e.progress<100&&!ut&&!he&&re===null&&(()=>{let P=Ke+Fe*(e.progress/100),z=8,j=e.assignees?.[0];return jsxs("g",{"data-parte":"avatar",style:{pointerEvents:"none"},children:[jsx("circle",{cx:P,cy:a+ce/2,r:z,fill:j?.color||n.accent,stroke:"#000",strokeWidth:1.5}),jsx("text",{x:P,y:a+ce/2,textAnchor:"middle",dominantBaseline:"central",fill:"#FFF",fontSize:"8",fontWeight:"600",fontFamily:"Inter, sans-serif",children:j?.initials||(j?.name?ba(j.name):"")})]})})(),ot&&!he&&Fe>=40&&(re!==null||F<88)&&(()=>{let P=Ke+Fe*(F/100),z=a+ce/2,j=re!==null,J=j?7:Le?6:5,be=j||Le?1:k?0:.35,Be=Ke+Fe-P,De=Math.max(4,Math.min(12,Be-10)),Ne=12;return jsxs("g",{children:[jsx("rect",{x:P-Ne,y:z-12,width:Ne+De,height:24,fill:"transparent",style:{cursor:"ew-resize",touchAction:"none"},onPointerDown:ta,onPointerMove:de,onPointerUp:G,onPointerCancel:G,onClick:X,onDoubleClick:X,onMouseDown:lt=>lt.stopPropagation()}),jsx("circle",{"data-parte":"asa-avance",cx:P,cy:z,r:J,fill:"#FFFFFF",stroke:da,strokeWidth:2,opacity:be,style:{pointerEvents:"none",filter:j?`drop-shadow(0 0 4px ${da})`:void 0,transition:"r 120ms ease, opacity 120ms ease"}}),j&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:P-20,y:z-28,width:40,height:18,rx:4,fill:Et?"rgba(15, 15, 20, 0.95)":"rgba(255, 255, 255, 0.95)",stroke:da,strokeWidth:1}),jsxs("text",{x:P,y:z-16,textAnchor:"middle",dominantBaseline:"central",fill:Et?"#FFFFFF":"#111111",fontSize:"11",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",children:[re,"%"]})]})]})})(),e.segments&&e.segments.map((P,z)=>{let j=(P.startDate.getTime()-o.getTime())/864e5*s,be=(P.endDate.getTime()-o.getTime())/(1e3*60*60*24)*s-j+s,Be=he&&ve==="move"&&Tt===z,De=Qt===z,Ne=Be?j+Jt:j;return jsxs("g",{onMouseEnter:()=>!he&&Y(z),onMouseLeave:()=>!he&&Y(null),children:[jsx(motion.rect,{x:Ne,y:a,width:be,height:ce,rx:Pe,fill:da,initial:{opacity:0,scale:.95},animate:{opacity:Be||e.parentId?.6:De?.9:.8,scale:De&&!he?1.02:1},transition:{duration:.2,ease:[.4,0,.2,1]},onMouseDown:lt=>{lt.stopPropagation(),_t(z),xt(j),Ze(lt,void 0,j);},style:{cursor:ke,pointerEvents:"all"}}),jsx("rect",{x:Ne,y:a,width:be*(e.progress/100),height:ce,rx:Pe,fill:da,opacity:1,style:{pointerEvents:"none"}})]},`segment-${z}`)}),Zt&&(mt||Ht)&&!e.segments&&jsxs(Fragment,{children:[Ht&&!mt&&jsx("rect",{x:Ke,y:a,width:Fe,height:ce,rx:Pe,fill:"none",stroke:n.border,strokeWidth:2,strokeDasharray:"4 4",opacity:.8,style:{pointerEvents:"none"}}),mt&&jsx("rect",{x:Ke,y:a,width:Fe,height:ce,rx:Pe,fill:"url(#diagonal-stripes)",opacity:.3,style:{pointerEvents:"none"}})]}),!k&&w&&Fe>60&&!e.segments&&!(Ae&&ut)&&(()=>{let P=i.taskLabel(e),z=typeof P=="string"?P:e.name,j=z.length>Math.floor(Fe/8)?`${z.substring(0,Math.floor(Fe/8))}...`:z;return jsx("text",{"data-parte":"etiqueta",x:Ke+8,y:a+ce/2,dominantBaseline:"middle",fill:Oe?"rgba(255, 255, 255, 0.6)":"#FFFFFF",fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none",textDecoration:Oe?"line-through":"none"},children:j})})(),!k&&!he&&!e.segments&&!ut&&e.progress>0&&e.progress<100&&(Ae?jsxs("text",{x:Ke+Fe+6,y:a+ce/2,dominantBaseline:"middle",fill:n.textSecondary,fontSize:"9",fontWeight:"500",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):Fe>100?jsxs("text",{x:Ke+Fe-12,y:a+ce/2,dominantBaseline:"middle",textAnchor:"end",fill:"rgba(255, 255, 255, 0.9)",fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{pointerEvents:"none",userSelect:"none"},children:[e.progress,"%"]}):null),!k&&e.status&&Fe>80&&!he&&!e.segments&&!(Ae&&ut)&&jsxs("g",{"data-parte":"insignia-estado",style:{pointerEvents:"none"},children:[e.status==="completed"&&jsx("circle",{cx:Ke+Fe-8,cy:a+8,r:4,fill:n.statusCompleted,stroke:"#FFFFFF",strokeWidth:1.5}),e.status==="in-progress"&&jsx("circle",{cx:Ke+Fe-8,cy:a+8,r:4,fill:n.statusInProgress,stroke:"#FFFFFF",strokeWidth:1.5,opacity:.8})]}),(Le||dt)&&!wt&&!e.segments&&!ut&&jsxs(Fragment,{children:[jsxs("g",{children:[jsx("rect",{x:Ke-2,y:a,width:16,height:ce,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>ct("resize-start"),onMouseLeave:()=>ct(null),onMouseDown:P=>{P.stopPropagation(),Ze(P,"resize-start");}}),jsx(motion.rect,{x:Ke+4,y:a+8,width:3,height:ce-16,rx:1.5,fill:Qe==="resize-start"||ve==="resize-start"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]}),jsxs("g",{children:[jsx("rect",{x:Ke+Fe-14,y:a,width:16,height:ce,fill:"transparent",style:{cursor:Te},onMouseEnter:()=>ct("resize-end"),onMouseLeave:()=>ct(null),onMouseDown:P=>{P.stopPropagation(),Ze(P,"resize-end");}}),jsx(motion.rect,{x:Ke+Fe-7,y:a+8,width:3,height:ce-16,rx:1.5,fill:Qe==="resize-end"||ve==="resize-end"?"#ffffff":"rgba(255,255,255,0.5)",style:{pointerEvents:"none"},initial:{opacity:0},animate:{opacity:1},transition:{duration:.15}})]})]}),jsx(AnimatePresence,{children:Le&&!he&&!e.segments&&jsxs(motion.g,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[jsx("circle",{cx:t-10,cy:a+ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},"data-conectar-desde":"inicio",onMouseEnter:()=>ct("connect-start"),onMouseLeave:()=>ct(null),onMouseDown:P=>{P.stopPropagation(),S.current=true,Ze(P,"connect");}}),jsx(motion.circle,{cx:t-10,cy:a+ce/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Qe==="connect-start"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}}),jsx("circle",{cx:t+r+10,cy:a+ce/2,r:10,fill:"transparent",style:{cursor:"crosshair"},onMouseEnter:()=>ct("connect"),onMouseLeave:()=>ct(null),"data-conectar-desde":"fin",onMouseDown:P=>{P.stopPropagation(),S.current=false,Ze(P,"connect");}}),jsx(motion.circle,{cx:t+r+10,cy:a+ce/2,r:4,fill:n.accent,stroke:"#FFFFFF",strokeWidth:1.5,style:{pointerEvents:"none"},initial:{scale:0},animate:{scale:Qe==="connect"?1.4:1},exit:{scale:0},transition:{duration:.15,type:"spring",stiffness:500,damping:30}})]})}),wt&&fe&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx(motion.line,{x1:S.current?t:t+r,y1:a+ce/2,x2:fe.x,y2:fe.y,stroke:et?n.statusCompleted:n.accent,strokeWidth:et?3:2,strokeDasharray:"6 4",initial:{opacity:0},animate:{opacity:et?1:.8},transition:{duration:.15}}),jsx(motion.circle,{cx:fe.x,cy:fe.y,r:et?8:6,fill:et?n.statusCompleted:n.accent,stroke:"#FFFFFF",strokeWidth:2,initial:{scale:0},animate:{scale:1},transition:{duration:.15}}),et&&jsx(motion.text,{x:fe.x+15,y:fe.y,dominantBaseline:"middle",fill:n.statusCompleted,fontSize:"11",fontWeight:"600",fontFamily:"Inter, sans-serif",initial:{opacity:0,x:fe.x+10},animate:{opacity:1,x:fe.x+15},transition:{duration:.2},children:(()=>{let P=V;return {FS:P?"Fin \u2192 Comienzo":"Finish \u2192 Start",SS:P?"Comienzo \u2192 Comienzo":"Start \u2192 Start",FF:P?"Fin \u2192 Fin":"Finish \u2192 Finish",SF:P?"Comienzo \u2192 Fin":"Start \u2192 Finish"}[it(et)]})()})]}),(Le||he)&&!wt&&!e.segments&&jsx(motion.rect,{x:Ke-1,y:a-1,width:Fe+2,height:ce+2,rx:Pe+1,fill:"none",stroke:he?n.accent:Ae?"rgba(255,255,255,0.2)":n.taskBarPrimary,strokeWidth:Ae?1:2,opacity:he||Ae?.6:.4,initial:{opacity:0},animate:{opacity:he||Ae?.6:.4},transition:{duration:.2},style:{pointerEvents:"none"}}),dt&&jsxs(Fragment,{children:[jsx("line",{x1:pe,y1:0,x2:pe,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}}),jsx("line",{x1:pe+Ue,y1:0,x2:pe+Ue,y2:1e3,stroke:n.accent,strokeWidth:1,strokeDasharray:"4 4",opacity:.3,style:{pointerEvents:"none"}})]}),jsx(AnimatePresence,{children:Le&&!he&&!e.segments&&!v&&(()=>{let j=a<100,J=j?a+ce+13:a-82-13,be=j?`M ${Ke+Fe/2-6} ${a+ce+3} L ${Ke+Fe/2} ${a+ce+13} L ${Ke+Fe/2+6} ${a+ce+3}`:`M ${Ke+Fe/2-6} ${a-13} L ${Ke+Fe/2} ${a-3} L ${Ke+Fe/2+6} ${a-13}`,Be=J+22,De=J+40,Ne=J+55,lt=J+70,kt=j?J+82-5:a-18;return jsxs(motion.g,{initial:{opacity:0,y:j?-10:10},animate:{opacity:1,y:0},exit:{opacity:0,y:j?-10:10},transition:{duration:.2},style:{pointerEvents:"none"},children:[jsx("path",{d:be,fill:n.bgSecondary,stroke:n.border,strokeWidth:1}),jsx("rect",{x:Ke+Fe/2-120,y:J,width:240,height:82,rx:8,fill:n.bgSecondary,stroke:n.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("text",{x:Ke+Fe/2,y:Be,textAnchor:"middle",fill:n.textPrimary,fontSize:"13",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>28?`${e.name.substring(0,28)}...`:e.name}),jsx("text",{x:Ke+Fe/2-110,y:De,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:E?"Inicio:":"Start:"}),jsx("text",{x:Ke+Fe/2-70,y:De,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:te(e.startDate)}),jsx("text",{x:Ke+Fe/2-110,y:Ne,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:E?"Fin:":"End:"}),jsx("text",{x:Ke+Fe/2-70,y:Ne,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:te(e.endDate)}),jsx("text",{x:Ke+Fe/2+10,y:De,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:E?"Duraci\xF3n:":"Duration:"}),jsx("text",{x:Ke+Fe/2+65,y:De,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:Re()}),jsx("text",{x:Ke+Fe/2+10,y:Ne,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:E?"Avance:":"Progress:"}),jsxs("text",{x:Ke+Fe/2+65,y:Ne,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.progress,"%"]}),e.assignees&&e.assignees.length>0&&jsxs(Fragment,{children:[jsx("text",{x:Ke+Fe/2-110,y:lt,fill:n.textTertiary,fontSize:"11",fontFamily:"Inter, sans-serif",children:E?"Responsables:":"Assignees:"}),jsxs("text",{x:Ke+Fe/2-50,y:lt,fill:n.textSecondary,fontSize:"11",fontWeight:"500",fontFamily:"Inter, sans-serif",children:[e.assignees.map(Se=>Se.name).join(", ").substring(0,30),e.assignees.map(Se=>Se.name).join(", ").length>30?"...":""]})]}),!j&&jsx("text",{x:Ke+Fe/2,y:kt,textAnchor:"middle",fill:n.textTertiary,fontSize:"9",fontFamily:"Inter, sans-serif",style:{opacity:.7},children:I?E?"Izquierda: mover \u2022 Derecha: cambiar tama\xF1o":"Left: move \u2022 Right: resize":Lt?E?"Arrastra para mover \u2022 ALT + arrastrar el borde para cambiar tama\xF1o":"Drag to move \u2022 Hold ALT + drag edge to resize":E?"Arrastra los bordes para cambiar tama\xF1o \u2022 el centro para mover \u2022 \u26AB para enlazar":"Drag edges to resize \u2022 Drag center to move \u2022 Click \u26AB to link"})]})})()})]})}var Su=260,qs=8,B0=16,pk=-12;function $0({tooltipData:e,theme:t,locale:a="en",workingDaysConfig:r}){let[n,s]=useState(null);if(useLayoutEffect(()=>{if(!e){s(null);return}let{task:x,mouseX:y,mouseY:k}=e,M=x.effortMinutes!=null||x.timeLoggedMinutes!=null||x.soldEffortMinutes!=null,H=x.lastActivity!=null,E=(M?155:105)+(H?28:0),N=y+B0,D=k+pk-E;N+Su>window.innerWidth-qs&&(N=y-Su-B0),N<qs&&(N=qs);let S=D<qs;S&&(D=k+20),D+E>window.innerHeight-qs&&(D=window.innerHeight-qs-E),s({left:N,top:D,showBelow:S});},[e]),!e||!n)return null;let{task:o}=e,i=o.effortMinutes!=null||o.timeLoggedMinutes!=null||o.soldEffortMinutes!=null,c={start:a==="es"?"Inicio":"Start",end:a==="es"?"Fin":"End",duration:a==="es"?"Duraci\xF3n":"Duration",progress:a==="es"?"Progreso":"Progress",assignees:a==="es"?"Asignados":"Assignees",estimated:a==="es"?"Estimado":"Estimated",logged:a==="es"?"Registrado":"Logged",quoted:a==="es"?"Ofertado":"Quoted",tags:a==="es"?"Etiqueta":"Tag"},l=x=>x.toLocaleDateString(a==="es"?"es-ES":"en-US",{month:"short",day:"numeric",year:"numeric"}),u=()=>{if(!o.startDate||!o.endDate)return "N/A";if(!r?.enabledWeekdays){let D=Math.max(1,Math.round((o.endDate.getTime()-o.startDate.getTime())/864e5)+1);return a==="es"?`${D} d\xEDa${D!==1?"s":""}`:`${D} day${D!==1?"s":""}`}let x=r.enabledWeekdays,y=r.holidayDates instanceof Set?r.holidayDates:new Set(r.holidayDates??[]),k=D=>`${D.getFullYear()}-${String(D.getMonth()+1).padStart(2,"0")}-${String(D.getDate()).padStart(2,"0")}`,M=0,H=new Date(o.startDate.getFullYear(),o.startDate.getMonth(),o.startDate.getDate()),E=new Date(o.endDate.getFullYear(),o.endDate.getMonth(),o.endDate.getDate());for(;H.getTime()<=E.getTime();){let D=H.getDay();x[D]&&!y.has(k(H))&&M++,H.setDate(H.getDate()+1);}let N=Math.max(0,M);return a==="es"?`${N} d\xEDa${N!==1?"s":""}`:`${N} day${N!==1?"s":""}`},p=x=>{if(x==null||x===0)return "N/A";let y=Math.floor(x/60),k=x%60;return y===0?`${k}m`:k===0?`${y}h`:`${y}h ${k}m`},d=t.textTertiary||"#9CA3AF",m=t.textSecondary||"#D1D5DB",f=t.textPrimary||"#F9FAFB",v=t.accent||"#00E5CC",b=t.bgSecondary||"#1F2937",w=t.border||"#374151",h=jsxs("div",{style:{position:"fixed",left:n.left,top:n.top,width:Su,zIndex:99999,pointerEvents:"none",fontFamily:"Inter, system-ui, sans-serif",animation:"gantt-tooltip-fade 0.12s ease-out"},children:[jsxs("div",{style:{background:b,border:`1px solid ${w}`,borderRadius:8,padding:"12px 14px",boxShadow:"0 8px 24px rgba(0,0,0,0.3)"},children:[jsx("div",{style:{fontSize:13,fontWeight:600,color:f,marginBottom:8,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:o.name}),jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"3px 12px",fontSize:11},children:[jsx(nc,{label:c.start,value:o.startDate?l(o.startDate):"N/A",labelColor:d,valueColor:m}),jsx(nc,{label:c.duration,value:u(),labelColor:d,valueColor:m}),jsx(nc,{label:c.end,value:o.endDate?l(o.endDate):"N/A",labelColor:d,valueColor:m}),jsx(nc,{label:c.progress,value:`${o.progress}%`,labelColor:d,valueColor:m})]}),o.assignees&&o.assignees.length>0&&jsxs("div",{style:{fontSize:11,marginTop:6},children:[jsxs("span",{style:{color:d},children:[c.assignees,": "]}),jsx("span",{style:{color:m,fontWeight:500},children:o.assignees.map(x=>x.name).join(", ")})]}),o.tags&&o.tags.length>0&&jsxs("div",{style:{marginTop:6,fontSize:11},children:[jsxs("span",{style:{color:d},children:[c.tags,": "]}),jsx("span",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,verticalAlign:"middle"},children:o.tags.map(x=>jsx("span",{style:{padding:"1px 6px",borderRadius:4,fontSize:10,fontWeight:600,backgroundColor:`${x.color}22`,color:x.color,border:`1px solid ${x.color}55`,whiteSpace:"nowrap"},children:x.name},x.id))})]}),i&&jsxs("div",{style:{marginTop:6,display:"flex",gap:10,fontSize:11},children:[o.effortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.estimated,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(o.effortMinutes)})]}),o.timeLoggedMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.logged,":"]})," ",jsx("span",{style:{color:v,fontWeight:600},children:p(o.timeLoggedMinutes)})]}),o.soldEffortMinutes!=null&&jsxs("span",{children:[jsxs("span",{style:{color:d},children:[c.quoted,":"]})," ",jsx("span",{style:{color:m,fontWeight:600},children:p(o.soldEffortMinutes)})]})]}),o.lastActivity&&jsxs("div",{style:{marginTop:8,paddingTop:8,borderTop:`1px solid ${t?.borderSubtle||"rgba(255,255,255,0.08)"}`,fontSize:11,color:d,lineHeight:1.4},children:[jsx("span",{style:{opacity:.7},children:a==="es"?"\xDAltimo: ":"Last: "}),jsx("span",{style:{color:m},children:o.lastActivity.userName})," ",jsx("span",{children:o.lastActivity.summary})," ",jsx("span",{style:{opacity:.6},children:o.lastActivity.relativeTime})]})]}),jsx("style",{children:`
|
|
126
126
|
@keyframes gantt-tooltip-fade {
|
|
127
127
|
from { opacity: 0; transform: translateY(${n.showBelow?"-4px":"4px"}); }
|
|
128
128
|
to { opacity: 1; transform: translateY(0); }
|
|
129
129
|
}
|
|
130
|
-
`})]});return createPortal(y,document.body)}function xl({label:e,value:t,labelColor:a,valueColor:r}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function ui({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:p,strokeWidthOverride:u,glowFilter:d}){let[,m]=useState(false),[f,v]=useState(null),b=r-t,h=b>0,y=Math.abs(b)<5,x=20,w=!y&&a<=e,C,P,O=a-e,T=e+O/2;P=T;let D=8;if(o==="squared")if(y)C=`M ${e} ${t} L ${a} ${r}`;else if(w){let $e=e+15,Pe=a-x,je=h?t+20:t-20;P=Pe;let tt=h?1:-1;C=`M ${e} ${t} L ${$e-D} ${t} Q ${$e} ${t} ${$e} ${t+tt*D} L ${$e} ${je-tt*D} Q ${$e} ${je} ${$e-D} ${je} L ${Pe+D} ${je} Q ${Pe} ${je} ${Pe} ${je+tt*D} L ${Pe} ${r-tt*D} Q ${Pe} ${r} ${Pe+D} ${r} L ${a} ${r}`;}else {P=a-x;let He=h?1:-1;C=`M ${e} ${t} L ${P-D} ${t} Q ${P} ${t} ${P} ${t+He*D} L ${P} ${r-He*D} Q ${P} ${r} ${P+D} ${r} L ${a} ${r}`;}else C=`M ${e} ${t} C ${T} ${t}, ${T} ${r}, ${a} ${r}`;let M=6,N=5,z=`M ${a} ${r} L ${a-M} ${r-N/2} L ${a-M} ${r+N/2} Z`,$=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),Y=p||($?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.20)"),A=u||1,Se=n.dependencyHover||($?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),W="#f87171",Ce="rgba(248, 113, 113, 0.15)",R=P,we=(t+r)/2;if(f)if(o==="squared")if(y)R=Math.max(e+10,Math.min(a-10,f.x)),we=t;else if(w){let He=e+15,$e=a-x,Pe=h?t+20:t-20,je=[[e,t,He,t],[He,t,He,Pe],[He,Pe,$e,Pe],[$e,Pe,$e,r],[$e,r,a,r]],tt=1/0,ee={x:R,y:we};for(let Ae of je){let ot=G(f.x,f.y,Ae[0],Ae[1],Ae[2],Ae[3]),Ie=Math.hypot(f.x-ot.x,f.y-ot.y);Ie<tt&&(tt=Ie,ee=ot);}R=ee.x,we=ee.y;}else {let He=[[e,t,P,t],[P,t,P,r],[P,r,a,r]],$e=1/0,Pe={x:R,y:we};for(let je of He){let tt=G(f.x,f.y,je[0],je[1],je[2],je[3]),ee=Math.hypot(f.x-tt.x,f.y-tt.y);ee<$e&&($e=ee,Pe=tt);}R=Pe.x,we=Pe.y;}else {let He=T,$e=t,Pe=T,je=r,tt=1/0,ee=R,Ae=we;for(let ot=0;ot<=1;ot+=.02){let Ie=1-ot,zt=Ie*Ie*Ie*e+3*Ie*Ie*ot*He+3*Ie*ot*ot*Pe+ot*ot*ot*a,st=Ie*Ie*Ie*t+3*Ie*Ie*ot*$e+3*Ie*ot*ot*je+ot*ot*ot*r,bt=Math.hypot(f.x-zt,f.y-st);bt<tt&&(tt=bt,ee=zt,Ae=st);}R=ee,we=Ae;}function G(He,$e,Pe,je,tt,ee){let Ae=tt-Pe,ot=ee-je,Ie=Ae*Ae+ot*ot;if(Ie===0)return {x:Pe,y:je};let zt=((He-Pe)*Ae+($e-je)*ot)/Ie;return zt=Math.max(0,Math.min(1,zt)),{x:Pe+zt*Ae,y:je+zt*ot}}let Ve=He=>{let $e=He.currentTarget.ownerSVGElement;if(!$e)return;let Pe=$e.getScreenCTM();if(!Pe)return;let je=Pe.inverse();v({x:je.a*He.clientX+je.c*He.clientY+je.e,y:je.b*He.clientX+je.d*He.clientY+je.f});},oe=()=>{m(false),v(null),c?.(false);},Be=()=>{m(true),c?.(true);},le=He=>s?jsxs(motion.g,{initial:He,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:$e=>{$e.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:R,cy:we,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:R,cy:we,r:9,fill:Ce,stroke:W,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:R-3,y1:we-3,x2:R+3,y2:we+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:R+3,y1:we-3,x2:R-3,y2:we+3,stroke:W,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxs("g",{"data-dependency-line":"true",onMouseLeave:oe,onMouseMove:Ve,children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:z,fill:Se,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:Se,opacity:.9,style:{pointerEvents:"none"}}),le({opacity:0,scale:.8})]}):l?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Be,onMouseLeave:oe,onMouseMove:Ve,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:C,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:C,fill:"none",stroke:Se,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:z,fill:Se,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:Se,style:{pointerEvents:"none"}}),le({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:Be,onMouseLeave:oe,onMouseMove:Ve,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:C,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:C,fill:"none",stroke:Y,strokeWidth:A,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:d||"none"}}),jsx(motion.path,{d:z,fill:Y,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:Y,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function Cl({task:e,x:t,y:a,theme:r,onClick:n}){let[s,o]=useState(false),i=16,c=l=>l.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true","data-estado":"milestone",onMouseEnter:()=>o(true),onMouseLeave:()=>o(false),onClick:()=>n?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:i+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:s?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{"data-parte":"rombo",x:t-i/2,y:a+16-i/2,width:i,height:i,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:s?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),s&&jsx(motion.rect,{x:t-(i+4)/2,y:a+16-(i+4)/2,width:i+4,height:i+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:s&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:c(e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var Me={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let n=r.getDay();n!==0&&n!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=l=>{l.forEach(p=>{p.dependencies&&r.set(p.id,p.dependencies),p.subtasks&&n(p.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,i=new Set,c=l=>{if(!o.has(l)){o.add(l),i.add(l);let p=r.get(l)||[];for(let u of p){if(!o.has(u)&&c(u))return true;if(i.has(u))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=Me.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=Me.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=Me.findTaskById(e,n);if(s)a.unshift(s),n=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=Me.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
-
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a
|
|
130
|
+
`})]});return createPortal(h,document.body)}function nc({label:e,value:t,labelColor:a,valueColor:r}){return jsxs("div",{children:[jsxs("span",{style:{color:a},children:[e,": "]}),jsx("span",{style:{color:r,fontWeight:500},children:t})]})}function _i({x1:e,y1:t,x2:a,y2:r,theme:n,onDelete:s,lineStyle:o="curved",isHoverLayer:i=false,onHoverChange:c,hoverOverlayOnly:l=false,colorOverride:u,strokeWidthOverride:p,glowFilter:d,salidaPorInicio:m=false,entradaPorFin:f=false,etiqueta:v}){let[,b]=useState(false),[w,h]=useState(null),x=r-t,y=x>0,k=Math.abs(x)<5,M=20,H=!k&&a<=e,E,N,D=a-e,S=e+D/2;N=S;let V=8,W=S,R=t,A=S,ve=r,q=null,le=m||f,B=m?-1:1,pe=f?-1:1;if(le)if(o==="squared"){let Y=e+B*15,Le=a-pe*M,Ye=k?t-16:(t+r)/2;q=[[e,t,Y,t],[Y,t,Y,Ye],[Y,Ye,Le,Ye],[Le,Ye,Le,r],[Le,r,a,r]],E=`M ${e} ${t} L ${Y} ${t} L ${Y} ${Ye} L ${Le} ${Ye} L ${Le} ${r} L ${a} ${r}`,N=Le;}else {let Y=Math.max(40,Math.abs(D)/2);W=e+B*Y,A=a-pe*Y,E=`M ${e} ${t} C ${W} ${R}, ${A} ${ve}, ${a} ${r}`;}else if(o==="squared")if(k)E=`M ${e} ${t} L ${a} ${r}`;else if(H){let Le=e+15,Ye=a-M,he=y?t+20:t-20;N=Ye;let dt=y?1:-1;E=`M ${e} ${t} L ${Le-V} ${t} Q ${Le} ${t} ${Le} ${t+dt*V} L ${Le} ${he-dt*V} Q ${Le} ${he} ${Le-V} ${he} L ${Ye+V} ${he} Q ${Ye} ${he} ${Ye} ${he+dt*V} L ${Ye} ${r-dt*V} Q ${Ye} ${r} ${Ye+V} ${r} L ${a} ${r}`;}else {N=a-M;let Y=y?1:-1;E=`M ${e} ${t} L ${N-V} ${t} Q ${N} ${t} ${N} ${t+Y*V} L ${N} ${r-Y*V} Q ${N} ${r} ${N+V} ${r} L ${a} ${r}`;}else E=`M ${e} ${t} C ${S} ${t}, ${S} ${r}, ${a} ${r}`;let nt=6,Ue=5,$=`M ${a} ${r} L ${a-pe*nt} ${r-Ue/2} L ${a-pe*nt} ${r+Ue/2} Z`,fe=!n.bgPrimary||n.bgPrimary.startsWith("#0")||n.bgPrimary.startsWith("#1"),ie=u||(fe?"rgba(255,255,255,0.55)":"rgba(15,23,42,0.45)"),et=p||1.5,Xe=n.dependencyHover||(fe?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.45)"),Qe="#f87171",ct="rgba(248, 113, 113, 0.15)",Tt=N,_t=(t+r)/2;if(w)if(q){let Y=1/0;for(let Le of q){let Ye=tt(w.x,w.y,Le[0],Le[1],Le[2],Le[3]),he=Math.hypot(w.x-Ye.x,w.y-Ye.y);he<Y&&(Y=he,Tt=Ye.x,_t=Ye.y);}}else if(o==="squared")if(k)Tt=Math.max(e+10,Math.min(a-10,w.x)),_t=t;else if(H){let Y=e+15,Le=a-M,Ye=y?t+20:t-20,he=[[e,t,Y,t],[Y,t,Y,Ye],[Y,Ye,Le,Ye],[Le,Ye,Le,r],[Le,r,a,r]],dt=1/0,wt={x:Tt,y:_t};for(let ue of he){let ce=tt(w.x,w.y,ue[0],ue[1],ue[2],ue[3]),Ae=Math.hypot(w.x-ce.x,w.y-ce.y);Ae<dt&&(dt=Ae,wt=ce);}Tt=wt.x,_t=wt.y;}else {let Y=[[e,t,N,t],[N,t,N,r],[N,r,a,r]],Le=1/0,Ye={x:Tt,y:_t};for(let he of Y){let dt=tt(w.x,w.y,he[0],he[1],he[2],he[3]),wt=Math.hypot(w.x-dt.x,w.y-dt.y);wt<Le&&(Le=wt,Ye=dt);}Tt=Ye.x,_t=Ye.y;}else {let Y=1/0,Le=Tt,Ye=_t;for(let he=0;he<=1;he+=.02){let dt=1-he,wt=dt*dt*dt*e+3*dt*dt*he*W+3*dt*he*he*A+he*he*he*a,ue=dt*dt*dt*t+3*dt*dt*he*R+3*dt*he*he*ve+he*he*he*r,ce=Math.hypot(w.x-wt,w.y-ue);ce<Y&&(Y=ce,Le=wt,Ye=ue);}Tt=Le,_t=Ye;}function tt(Y,Le,Ye,he,dt,wt){let ue=dt-Ye,ce=wt-he,Ae=ue*ue+ce*ce;if(Ae===0)return {x:Ye,y:he};let Et=((Y-Ye)*ue+(Le-he)*ce)/Ae;return Et=Math.max(0,Math.min(1,Et)),{x:Ye+Et*ue,y:he+Et*ce}}let xt=Y=>{let Le=Y.currentTarget.ownerSVGElement;if(!Le)return;let Ye=Le.getScreenCTM();if(!Ye)return;let he=Ye.inverse();h({x:he.a*Y.clientX+he.c*Y.clientY+he.e,y:he.b*Y.clientX+he.d*Y.clientY+he.f});},Jt=()=>{b(false),h(null),c?.(false);},Wt=()=>{b(true),c?.(true);},Qt=Y=>s?jsxs(motion.g,{initial:Y,animate:{opacity:1,scale:1},transition:{duration:.15,ease:"easeOut"},onClick:Le=>{Le.stopPropagation(),s();},style:{cursor:"pointer",pointerEvents:"auto"},children:[jsx("circle",{cx:Tt,cy:_t,r:16,fill:"transparent",style:{cursor:"pointer"}}),jsx("circle",{cx:Tt,cy:_t,r:9,fill:ct,stroke:Qe,strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("line",{x1:Tt-3,y1:_t-3,x2:Tt+3,y2:_t+3,stroke:Qe,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("line",{x1:Tt+3,y1:_t-3,x2:Tt-3,y2:_t+3,stroke:Qe,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}})]}):null;return i?jsxs("g",{"data-dependency-line":"true",onMouseLeave:Jt,onMouseMove:xt,children:[jsx("path",{d:E,fill:"none",stroke:"transparent",strokeWidth:20,strokeLinecap:"round",style:{cursor:"pointer"}}),jsx("path",{d:E,fill:"none",stroke:Xe,strokeWidth:8,strokeLinecap:"round",opacity:.15,style:{pointerEvents:"none",filter:"blur(4px)"}}),jsx("path",{d:E,fill:"none",stroke:Xe,strokeWidth:2.5,strokeLinecap:"round",opacity:.9,style:{pointerEvents:"none"}}),jsx("path",{d:$,fill:Xe,stroke:"none",opacity:.9,style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:4,fill:Xe,opacity:.9,style:{pointerEvents:"none"}}),Qt({opacity:0,scale:.8})]}):l?jsxs("g",{"data-dependency-hover-overlay":"true",onMouseEnter:Wt,onMouseLeave:Jt,onMouseMove:xt,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:E,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx("path",{d:E,fill:"none",stroke:n.bgPrimary||"#1A1D21",strokeWidth:4,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:E,fill:"none",stroke:Xe,strokeWidth:5,strokeLinecap:"round",opacity:.12,style:{pointerEvents:"none"}}),jsx("path",{d:E,fill:"none",stroke:Xe,strokeWidth:1.5,strokeLinecap:"round",style:{pointerEvents:"none"}}),jsx("path",{d:$,fill:Xe,stroke:"none",style:{pointerEvents:"none"}}),jsx("circle",{cx:a,cy:r,r:3.5,fill:Xe,style:{pointerEvents:"none"}}),Qt({opacity:0,scale:0})]}):jsxs("g",{"data-dependency-line":"true",onMouseEnter:Wt,onMouseLeave:Jt,onMouseMove:xt,style:{cursor:s?"pointer":"default"},children:[jsx("path",{d:E,fill:"none",stroke:"transparent",strokeWidth:16,strokeLinecap:"round",style:{cursor:s?"pointer":"default"}}),jsx(motion.path,{d:E,fill:"none",stroke:ie,strokeWidth:et,strokeLinecap:"round",initial:{pathLength:0,opacity:0},animate:{pathLength:1,opacity:1},transition:{pathLength:{duration:.5,ease:"easeInOut"},opacity:{duration:.2}},style:{pointerEvents:"none",filter:d||"none"}}),jsx(motion.path,{d:$,fill:ie,stroke:"none",initial:{opacity:0},animate:{opacity:1},transition:{duration:.2,delay:.3},style:{pointerEvents:"none"}}),v&&jsx("text",{x:a-pe*10,y:r-7,textAnchor:pe>0?"end":"start",fontSize:9,fontWeight:600,fill:ie,style:{pointerEvents:"none",fontFamily:"JetBrains Mono, monospace"},"data-etiqueta-de-enlace":true,children:v}),jsx(motion.circle,{cx:a,cy:r,r:3,fill:ie,initial:{scale:0},animate:{scale:1},transition:{delay:.3,duration:.15},style:{pointerEvents:"none"}})]})}function lc({task:e,x:t,y:a,theme:r,locale:n="en",onClick:s}){let[o,i]=useState(false),c=16,l=u=>u.toLocaleDateString(n,{month:"short",day:"numeric",year:"numeric"});return jsxs("g",{"data-task-bar":"true","data-estado":"milestone",onMouseEnter:()=>i(true),onMouseLeave:()=>i(false),onClick:()=>s?.(e),style:{cursor:"pointer"},children:[e.isCriticalPath&&jsx(motion.circle,{cx:t,cy:a+16,r:c+4,fill:r.criticalPathLight,initial:{scale:0},animate:{scale:o?1.2:1},transition:{duration:.3}}),jsx(motion.rect,{"data-parte":"rombo",x:t-c/2,y:a+16-c/2,width:c,height:c,fill:e.isCriticalPath?r.criticalPath:r.milestone,stroke:r.bgGrid,strokeWidth:2,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:0,rotate:0},animate:{scale:o?1.15:1,rotate:45},transition:{duration:.3,type:"spring",stiffness:300,damping:20}}),o&&jsx(motion.rect,{x:t-(c+4)/2,y:a+16-(c+4)/2,width:c+4,height:c+4,fill:"none",stroke:e.isCriticalPath?r.criticalPath:r.milestone,strokeWidth:2,opacity:.5,transform:`rotate(45 ${t} ${a+16})`,initial:{scale:.8,opacity:0},animate:{scale:1,opacity:.5},transition:{duration:.2}}),jsx(AnimatePresence,{children:o&&jsxs(motion.g,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.2},children:[jsx("rect",{x:t-80,y:a-50,width:160,height:44,rx:8,fill:r.bgSecondary,stroke:r.border,strokeWidth:1,filter:"drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15))"}),jsx("path",{d:`M ${t-6} ${a-6} L ${t} ${a+4} L ${t+6} ${a-6}`,fill:r.bgSecondary,stroke:r.border,strokeWidth:1}),jsx("rect",{x:t-70,y:a-38,width:8,height:8,fill:e.isCriticalPath?r.criticalPath:r.milestone,transform:`rotate(45 ${t-66} ${a-34})`}),jsx("text",{x:t-55,y:a-32,fill:r.textPrimary,fontSize:"12",fontWeight:"600",fontFamily:"Inter, sans-serif",children:e.name.length>18?`${e.name.substring(0,18)}...`:e.name}),jsx("text",{x:t-55,y:a-18,fill:r.textTertiary,fontSize:"10",fontFamily:"Inter, sans-serif",children:l(e.endDate??e.startDate)}),e.isCriticalPath&&jsxs("g",{children:[jsx("rect",{x:t+10,y:a-40,width:60,height:16,rx:4,fill:r.criticalPathLight}),jsx("text",{x:t+40,y:a-30,textAnchor:"middle",fill:r.criticalPath,fontSize:"9",fontWeight:"700",fontFamily:"Inter, sans-serif",letterSpacing:"0.5",children:"CRITICAL"})]})]})})]})}var $e={calculateEndDate:(e,t)=>{let a=new Date(e);return a.setDate(a.getDate()+t),a},calculateDuration:(e,t)=>{let a=t.getTime()-e.getTime();return Math.ceil(a/(1e3*60*60*24))},calculateWorkingDays:(e,t)=>{let a=0,r=new Date(e);for(;r<=t;){let n=r.getDay();n!==0&&n!==6&&a++,r.setDate(r.getDate()+1);}return a},addWorkingDays:(e,t)=>{let a=new Date(e),r=0;for(;r<t;){a.setDate(a.getDate()+1);let n=a.getDay();n!==0&&n!==6&&r++;}return a},isWeekend:e=>{let t=e.getDay();return t===0||t===6},validateDependencies:(e,t,a)=>{let r=new Map,n=l=>{l.forEach(u=>{u.dependencies&&r.set(u.id,u.dependencies),u.subtasks&&n(u.subtasks);});};n(e);let s=r.get(a)||[];r.set(a,[...s,t]);let o=new Set,i=new Set,c=l=>{if(!o.has(l)){o.add(l),i.add(l);let u=r.get(l)||[];for(let p of u){if(!o.has(p)&&c(p))return true;if(i.has(p))return true}}return i.delete(l),false};return c(a)},flattenTasks:e=>{let t=[],a=r=>{[...r].sort((s,o)=>(s.position??0)-(o.position??0)).forEach(s=>{t.push(s),s.subtasks&&s.subtasks.length>0&&a(s.subtasks);});};return a(e),t},findTaskById:(e,t)=>{for(let a of e){if(a.id===t)return a;if(a.subtasks){let r=$e.findTaskById(a.subtasks,t);if(r)return r}}},getParentTasks:(e,t)=>{let a=[],r=$e.findTaskById(e,t);if(!r||!r.parentId)return a;let n=r.parentId;for(;n;){let s=$e.findTaskById(e,n);if(s)a.unshift(s),n=s.parentId;else break}return a},exportToJSON:e=>JSON.stringify(e,null,2),importFromJSON:e=>{try{let t=JSON.parse(e);if(!Array.isArray(t))throw new Error("Invalid JSON: expected an array of tasks");return t.forEach((a,r)=>{if(!a.id||!a.name)throw new Error(`Invalid task at index ${r}: missing required fields (id, name)`)}),t}catch(t){throw new Error(`Failed to import tasks: ${t instanceof Error?t.message:"Unknown error"}`)}},exportToCSV:e=>{let t=$e.flattenTasks(e),r=[["ID","Name","Start Date","End Date","Progress","Status","Dependencies"].join(",")];return t.forEach(n=>{let s=[n.id,`"${n.name.replace(/"/g,'""')}"`,n.startDate?n.startDate.toISOString().split("T")[0]:"",n.endDate?n.endDate.toISOString().split("T")[0]:"",n.progress.toString(),n.status||"",n.dependencies?.join(";")||""];r.push(s.join(","));}),r.join(`
|
|
131
|
+
`)},formatDate:e=>{let t=e.getFullYear(),a=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return `${t}-${a}-${r}`},parseDate:e=>new Date(e),getTaskDateRange:e=>!e.startDate||!e.endDate?null:{start:e.startDate,end:e.endDate},getEarliestStartDate:e=>{let a=$e.flattenTasks(e).filter(r=>r.startDate);return a.length===0?null:new Date(Math.min(...a.map(r=>r.startDate.getTime())))},getLatestEndDate:e=>{let a=$e.flattenTasks(e).filter(r=>r.endDate);return a.length===0?null:new Date(Math.max(...a.map(r=>r.endDate.getTime())))},tasksOverlap:(e,t)=>!e.startDate||!e.endDate||!t.startDate||!t.endDate?false:e.startDate<=t.endDate&&t.startDate<=e.endDate,getDependentTasks:(e,t)=>$e.flattenTasks(e).filter(r=>r.dependencies&&r.dependencies.includes(t)),getDependencyTasks:(e,t)=>{let a=$e.findTaskById(e,t);return !a||!a.dependencies?[]:$e.flattenTasks(e).filter(n=>a.dependencies.includes(n.id))},filterByStatus:(e,t)=>$e.flattenTasks(e).filter(a=>a.status===t),filterByDateRange:(e,t,a)=>$e.flattenTasks(e).filter(r=>!r.startDate||!r.endDate?false:r.startDate<=a&&r.endDate>=t),sortByStartDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.startDate||!r.startDate)return 0;let n=a.startDate.getTime()-r.startDate.getTime();return t?n:-n}),sortByEndDate:(e,t=true)=>[...e].sort((a,r)=>{if(!a.endDate||!r.endDate)return 0;let n=a.endDate.getTime()-r.endDate.getTime();return t?n:-n}),sortByProgress:(e,t=true)=>[...e].sort((a,r)=>{let n=a.progress-r.progress;return t?n:-n}),calculateTotalProgress:e=>{let t=$e.flattenTasks(e);if(t.length===0)return 0;let a=t.reduce((r,n)=>r+n.progress,0);return Math.round(a/t.length)},getTaskByPath:(e,t)=>{let a=e,r;for(let n=0;n<t.length;n++){let s=t[n];if(!a||s===void 0||s>=a.length||(r=a[s],!r))return;n<t.length-1&&(a=r.subtasks||[]);}return r},cloneTask:(e,t)=>({...e,id:t||`${e.id}-copy`,subtasks:e.subtasks?.map(a=>$e.cloneTask(a))}),exportToPDF:async(e,t="gantt-chart.pdf")=>{try{if(!e||e.length===0){alert("No tasks available to export to PDF");return}let{jsPDF:a}=await import('jspdf'),{default:r}=await import('jspdf-autotable'),n=new a,s=$e.flattenTasks(e);if(s.length===0){alert("No tasks found to export");return}n.setFontSize(16),n.text("Gantt Chart - Task List",14,20);let o=[["Task Name","Start Date","End Date","Duration","Progress","Status"]],i=s.map(c=>{let l=c.startDate&&c.endDate?$e.calculateDuration(c.startDate,c.endDate):0;return [c.name,c.startDate?zr(c.startDate,"en"):"N/A",c.endDate?zr(c.endDate,"en"):"N/A",l>0?`${Ao(l,"en")} days`:"N/A",Wr(c.progress??0,"en"),c.status||"N/A"]});r(n,{head:o,body:i,startY:30,styles:{fontSize:9,cellPadding:3},headStyles:{fillColor:[66,139,202],textColor:255,fontStyle:"bold"},alternateRowStyles:{fillColor:[245,245,245]},columnStyles:{0:{cellWidth:60},1:{cellWidth:30},2:{cellWidth:30},3:{cellWidth:25},4:{cellWidth:20},5:{cellWidth:25}}}),n.save(t);}catch(a){throw a}},exportToExcel:async(e,t,a)=>{let r=await import('xlsx'),n=$e.flattenTasks(e),s=a?.rateMap,o=a?.defaultRate||0,i=b=>{if(!s||!b.assignees||b.assignees.length===0)return o;let w=b.assignees.map(h=>h.id?s[h.id]:void 0).filter(h=>h!=null&&h>0);return w.length===0?o:w.reduce((h,x)=>h+x,0)/w.length},c=new Map,l=(b,w="")=>{[...b].sort((x,y)=>(x.position??0)-(y.position??0)).forEach((x,y)=>{let k=w?`${w}.${y+1}`:`${y+1}`;c.set(x.id,k),x.subtasks?.length&&l(x.subtasks,k);});};l(e);let u=s&&Object.keys(s).length>0||n.some(b=>b._costRate>0),p=n.map(b=>{let w=b.startDate&&b.endDate?$e.calculateDuration(b.startDate,b.endDate):0,h=b.effortMinutes,x=b.timeLoggedMinutes,y=b.soldEffortMinutes,k=typeof h=="number"?+(h/60).toFixed(1):0,M=typeof x=="number"?+(x/60).toFixed(1):0,H=typeof y=="number"?+(y/60).toFixed(1):0,E=b._costRate>0?b._costRate:i(b),N={WBS:c.get(b.id)||"","Task Name":b.name,"Start Date":b.startDate?$e.formatDate(b.startDate):"","End Date":b.endDate?$e.formatDate(b.endDate):"","Duration (days)":w>0?w:"","Progress (%)":b.progress,Status:b.status||"",Assignees:b.assignees?.map(S=>S.name).join(", ")||"","Estimated (h)":k||"","Logged (h)":M||"","Quoted (h)":H||""};u&&(N["$ Estimated"]=k>0&&E>0?Math.round(k*E):"",N["$ Executed"]=M>0&&E>0?Math.round(M*E):"",N["$ Quoted"]=H>0&&E>0?Math.round(H*E):"",N["Rate ($/h)"]=E>0?E:"");let D=b.weight;return N["Weight (%)"]=typeof D=="number"&&D>0?D:"",N["Is Milestone"]=b.isMilestone?"Yes":"No",N}),d=a?.projectName||"";if(d||p.length>0){let b=0,w=0,h=0,x=0,y=0,k=0,M=0,H=0,E=n.filter(S=>S.startDate).map(S=>S.startDate.getTime()),N=n.filter(S=>S.endDate).map(S=>S.endDate.getTime());for(let S of p)typeof S["Estimated (h)"]=="number"&&(b+=S["Estimated (h)"]),typeof S["Logged (h)"]=="number"&&(w+=S["Logged (h)"]),typeof S["Quoted (h)"]=="number"&&(h+=S["Quoted (h)"]),u&&(typeof S["$ Estimated"]=="number"&&(x+=S["$ Estimated"]),typeof S["$ Executed"]=="number"&&(y+=S["$ Executed"]),typeof S["$ Quoted"]=="number"&&(k+=S["$ Quoted"])),typeof S["Progress (%)"]=="number"&&(M+=S["Progress (%)"],H++);let D={WBS:"0","Task Name":`\u{1F4CB} ${d||"PROJECT TOTAL"}`,"Start Date":E.length>0?$e.formatDate(new Date(Math.min(...E))):"","End Date":N.length>0?$e.formatDate(new Date(Math.max(...N))):"","Duration (days)":E.length>0&&N.length>0?$e.calculateDuration(new Date(Math.min(...E)),new Date(Math.max(...N))):"","Progress (%)":H>0?Math.round(M/H):0,Status:"",Assignees:"","Estimated (h)":+b.toFixed(1)||"","Logged (h)":+w.toFixed(1)||"","Quoted (h)":+h.toFixed(1)||""};u&&(D["$ Estimated"]=x||"",D["$ Executed"]=y||"",D["$ Quoted"]=k||"",D["Rate ($/h)"]=""),D["Is Milestone"]="No",p.unshift(D);}let m=r.utils.json_to_sheet(p),f=[{wch:10},{wch:40},{wch:12},{wch:12},{wch:15},{wch:12},{wch:15},{wch:30},{wch:14},{wch:12},{wch:12},...u?[{wch:14},{wch:14},{wch:14},{wch:12}]:[],{wch:12}];m["!cols"]=f;let v=r.utils.book_new();if(r.utils.book_append_sheet(v,m,"Gantt Tasks"),!t){let b=new Date,w=x=>String(x).padStart(2,"0");t=`Project_${`${b.getFullYear()}-${w(b.getMonth()+1)}-${w(b.getDate())}_${w(b.getHours())}${w(b.getMinutes())}`}.xlsx`;}r.writeFile(v,t);},exportToMSProject:(e,t="Gantt Project",a="project.xml")=>{let r=$e.flattenTasks(e),n=new Map;r.forEach((d,m)=>{n.set(d.id,m+1);});let s=d=>d.toISOString().replace("Z",""),o=$e.getEarliestStartDate(e)||new Date,i=$e.getLatestEndDate(e)||new Date,c=r.map((d,m)=>{let f=n.get(d.id),v=d.startDate&&d.endDate?$e.calculateDuration(d.startDate,d.endDate):0,b=(d.dependencies||[]).filter(w=>n.has(w)).map(w=>{let h=d.dependencyLinks?.find(x=>x.id===w);return `
|
|
132
132
|
<PredecessorLink>
|
|
133
|
-
<PredecessorUID>${n.get(
|
|
134
|
-
<Type
|
|
133
|
+
<PredecessorUID>${n.get(w)}</PredecessorUID>
|
|
134
|
+
<Type>${{FF:0,FS:1,SF:2,SS:3}[h?.type??"FS"]}</Type>
|
|
135
135
|
<CrossProject>0</CrossProject>
|
|
136
|
-
<LinkLag
|
|
136
|
+
<LinkLag>${Math.round((h?.lag??0)*4800)}</LinkLag>
|
|
137
137
|
<LagFormat>7</LagFormat>
|
|
138
|
-
</PredecessorLink>`).join("");return `
|
|
138
|
+
</PredecessorLink>`}).join("");return `
|
|
139
139
|
<Task>
|
|
140
140
|
<UID>${f}</UID>
|
|
141
141
|
<ID>${m+1}</ID>
|
|
142
|
-
<Name>${d.name.replace(/[<>&'"]/g,
|
|
142
|
+
<Name>${d.name.replace(/[<>&'"]/g,w=>({"<":"<",">":">","&":"&","'":"'",'"':"""})[w]||w)}</Name>
|
|
143
143
|
<Type>0</Type>
|
|
144
144
|
<IsNull>0</IsNull>
|
|
145
145
|
<CreateDate>${s(new Date)}</CreateDate>
|
|
@@ -358,14 +358,14 @@ import {createRoot}from'react-dom/client';import {dragStore,BaseViewAdapter,sele
|
|
|
358
358
|
</Calendars>
|
|
359
359
|
<Tasks>${c}
|
|
360
360
|
</Tasks>
|
|
361
|
-
</Project>`,p=new Blob([l],{type:"application/xml;charset=utf-8;"}),u=document.createElement("a");u.href=URL.createObjectURL(p),u.download=a,u.click(),URL.revokeObjectURL(u.href);},calculateCriticalPath:e=>{let t=Me.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,n=l=>{if(r.has(l.id))return;let p=l.startDate&&l.endDate?Me.calculateDuration(l.startDate,l.endDate):0,u=0;if(l.dependencies&&l.dependencies.length>0)for(let m of l.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=r.get(m)?.ef||0;u=Math.max(u,v);}}let d=u+p;r.set(l.id,{es:u,ef:d});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),o=new Map,i=l=>{if(o.has(l.id))return;let p=l.startDate&&l.endDate?Me.calculateDuration(l.startDate,l.endDate):0,u=t.filter(f=>f.dependencies&&f.dependencies.includes(l.id)),d=s;if(u.length>0)for(let f of u){i(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-p;o.set(l.id,{ls:m,lf:d});};a.forEach(i);let c=[];for(let l of a){let p=r.get(l.id),u=o.get(l.id);if(p&&u){let d=u.ls-p.es;Math.abs(d)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=Me.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(r.length===0)return t;let n=new Map(r.map(d=>[d.id,d])),s=new Map;for(let d of r)s.has(d.id)||s.set(d.id,[]);for(let d of r)if(d.dependencies){for(let m of d.dependencies)if(n.has(m)){let f=s.get(m);f&&f.push(d.id);}}let o=new Map;for(let d of r)o.set(d.id,0);for(let d of r)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let i=new Map,c=[],l=[];for(let d of r)(o.get(d.id)||0)===0&&l.push(d.id);for(;l.length>0;){let d=l.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=Me.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let h of m.dependencies){let y=i.get(h);y&&(v=Math.max(v,y.ef));}i.set(d,{es:v,ef:v+f});let b=s.get(d)||[];for(let h of b){let y=(o.get(h)||1)-1;o.set(h,y),y===0&&l.push(h);}}if(c.length<r.length)return t;let p=Math.max(...Array.from(i.values()).map(d=>d.ef)),u=new Map;for(let d=c.length-1;d>=0;d--){let m=c[d];if(!m)continue;let f=n.get(m);if(!f||!f.startDate||!f.endDate)continue;let v=Me.calculateDuration(f.startDate,f.endDate),b=s.get(m)||[],h=p;if(b.length>0)for(let y of b){let x=u.get(y);x&&(h=Math.min(h,x.ls));}u.set(m,{ls:h-v,lf:h});}for(let d of c){let m=i.get(d),f=u.get(d),v=f.ls-m.es,b=s.get(d)||[],h;b.length>0?h=Math.min(...b.map(y=>i.get(y).es))-m.ef:h=p-m.ef,t.set(d,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(h*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=Me.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if(Me.calculateCriticalPath(e).includes(t))return 0;let n=Me.getDependentTasks(e,t);if(n.length===0){let i=Me.getLatestEndDate(e);if(!i)return null;let c=Me.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=n.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let o=Me.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>Me.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=Me.findTaskById(e,t);if(!s||!s.endDate)return e;let o=Me.getDependentTasks(e,t);if(o.length===0)return e;let i=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let l=Me.calculateDuration(c.startDate,c.endDate),p;if(a!==void 0?(p=new Date(c.startDate),p.setDate(p.getDate()+a)):(p=new Date(s.endDate),p.setDate(p.getDate()+1)),a!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),p<f&&(p=f);}let u=Me.calculateEndDate(p,l),d=m=>m.map(f=>f.id===c.id?{...f,startDate:p,endDate:u}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);i=d(i),i=Me.autoScheduleDependents(i,c.id,a,n);}return i},calculateCascadePreview:(e,t,a,r,n,s,o,i)=>{if(a===0)return [];let c=[],l=n.getTime(),p=1e3*60*60*24,u=Me.findTaskById(e,t);if(!u||!u.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let b=Me.getDependentTasks(e,m);for(let h of b){if(!h.startDate||!h.endDate)continue;let y=r.findIndex(N=>N.id===h.id);if(y===-1)continue;let x=h.startDate.getTime(),C=(h.endDate.getTime()-x)/p,O=(x-l)/p*s,T=O+f*s,D=Math.max(C*s,s),M=i+y*o+(o-18)/2;c.push({taskId:h.id,taskName:h.name,originalX:O,previewX:T,width:D,y:M,rowIndex:y,daysDelta:f,color:h.color}),d(h.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let n=Me.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let o=new Date(a);o.setDate(o.getDate()+r);let i=new Date(n.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:i}],l=p=>p.map(u=>u.id===n.id?{...u,endDate:i,segments:c}:u.subtasks?{...u,subtasks:l(u.subtasks)}:u);return l(e)}};function Tl({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:p=true,onTaskClick:u,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:b,showBaseline:h,showCriticalPath:y=true,showDependencies:x=true,highlightWeekends:w=true,weekHeaderFormat:C="number",canEditTask:P,onTaskProgressDrag:O,workingDaysConfig:T}){let M=Ur(),N=useRef(null),[z,$]=useState([]),[Y,A]=useState(null),[Se,W]=useState(null),[Ce,R]=useState(null),we=useRef(false),[G,Ve]=useState(new Set),[oe,Be]=useState(null),le=useCallback(I=>{if(Ce&&!we.current){let j=I.target,ke=false;for(;j&&j!==I.currentTarget;){if(j.getAttribute?.("data-dependency-line")==="true"||j.getAttribute?.("data-dependency-hover-overlay")==="true"){ke=true;break}j=j.parentElement;}ke||R(null);}},[Ce]),He=useCallback(I=>{W(I);},[]),$e=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Pe=r==="day"?60:r==="week"?20:8,je=$e*Pe*o,tt=I=>{let j=new Date(Date.UTC(I.getFullYear(),I.getMonth(),I.getDate())),ke=j.getUTCDay()||7;j.setUTCDate(j.getUTCDate()+4-ke);let Ue=new Date(Date.UTC(j.getUTCFullYear(),0,1));return Math.ceil(((j.getTime()-Ue.getTime())/864e5+1)/7)},ee=I=>{let j=I.getDay();return j===0||j===6},Ae=useMemo(()=>{let I=T?.holidayDates;return I?I instanceof Set?I:new Set(I):null},[T?.holidayDates]),ot=I=>{if(!Ae)return false;let j=`${I.getFullYear()}-${String(I.getMonth()+1).padStart(2,"0")}-${String(I.getDate()).padStart(2,"0")}`;return Ae.has(j)},Ie=useCallback(I=>{let j=Math.round(I/(Pe*o)),ke=new Date(n);return ke.setDate(ke.getDate()+j),ke},[n,Pe,o]),zt=useCallback((I,j)=>{if(j.startDate&&j.endDate)return;let ke=I.currentTarget.ownerSVGElement;if(!ke)return;let Ue=ke.createSVGPoint();Ue.x=I.clientX,Ue.y=I.clientY;let ue=Ue.matrixTransform(ke.getScreenCTM()?.inverse()),at=Ie(ue.x),yt=new Date(at);yt.setDate(yt.getDate()+1),Be(null),f?.(j,at,yt);},[Ie,f]),st=useCallback((I,j,ke)=>{let Ue=I.currentTarget.ownerSVGElement;if(!Ue)return;let ue=Ue.createSVGPoint();ue.x=I.clientX,ue.y=I.clientY;let at=ue.matrixTransform(Ue.getScreenCTM()?.inverse()),yt=Ie(at.x),vt=Math.round(at.x/(Pe*o))*Pe*o;Be({taskId:j.id,x:vt,y:ke*a+a/2,date:yt});},[Ie,Pe,o,a]),bt=useCallback(()=>{Be(null);},[]),Ee=useMemo(()=>{let I=ue=>ue.map(at=>{if(at.subtasks&&at.subtasks.length>0){let yt=I(at.subtasks),Ye=yt.filter(vt=>vt.startDate&&vt.endDate);if(Ye.length>0){let vt=Ye.map(Ht=>Ht.startDate.getTime()),Xt=Ye.map(Ht=>Ht.endDate.getTime()),wt=new Date(Math.min(...vt)),Ut=new Date(Math.max(...Xt));return {...at,subtasks:yt,startDate:wt,endDate:Ut}}return {...at,subtasks:yt}}return at}),j=(ue,at=[])=>{let yt=[...ue].sort((Ye,vt)=>(Ye.position??0)-(vt.position??0));for(let Ye of yt)at.push(Ye),Ye.subtasks&&Ye.subtasks.length>0&&(Ye.isExpanded===void 0||Ye.isExpanded)&&j(Ye.subtasks,at);return at},ke=I(e);return j(ke)},[e]),Dt=useCallback(I=>{if(!I.startDate||!I.endDate)return {x:0,width:0};let j=I.startDate.getTime(),ke=I.endDate.getTime(),Ue=n.getTime(),ue=(j-Ue)/(1e3*60*60*24),at=(ke-j)/(1e3*60*60*24)+1,yt=ue*Pe*o,Ye=Math.max(Pe*o,40),vt=Math.max(at*Pe*o,Ye);return {x:yt,width:vt}},[n,Pe,o]),ht=useMemo(()=>Ee.filter(I=>I.startDate&&I.endDate).map(I=>{let{x:j,width:ke}=Dt(I),ue=Ee.findIndex(at=>at.id===I.id)*a+(a-18)/2;return {id:I.id,x:j,y:ue,width:ke,height:18}}),[Ee,Dt]),_e=useCallback((I,j,ke)=>{if(!ke){$([]),A(null);return}if(A({taskId:I,daysDelta:j}),j===0){$([]);return}let Ue=Me.calculateCascadePreview(e,I,j,Ee,n,Pe*o,a,48);$(Ue);},[e,Ee,n,Pe,o,a,48]),dt=useCallback((I,j)=>{if(!Y)return j;let ke=Pe*o,Ue=Y.daysDelta*ke;if(I===Y.taskId)return {x:j.x+Ue,width:j.width};let ue=z.find(at=>at.taskId===I);return ue?{x:ue.previewX,width:ue.width}:j},[Y,z,Pe,o]),L=useMemo(()=>{let I=[],j=new Date(n);for(;j<=s;){let ue=(j.getTime()-n.getTime())/864e5*Pe*o;if(r==="day")I.push({date:new Date(j),label:j.toLocaleDateString(i,{day:"numeric",month:"short"}),x:ue}),j.setDate(j.getDate()+1);else if(r==="week"){let at=tt(j);I.push({date:new Date(j),label:C==="range"?(()=>{let yt=new Date(j);yt.setDate(yt.getDate()+6);let Ye=vt=>vt.toLocaleDateString(i,{month:"short"});return Ye(j)===Ye(yt)?`${Ye(j)} ${j.getDate()}\u2013${yt.getDate()}`:`${Ye(j)} ${j.getDate()}\u2013${Ye(yt)} ${yt.getDate()}`})():`${M.labels.week} ${at}`,x:ue}),j.setDate(j.getDate()+7);}else I.push({date:new Date(j),label:j.toLocaleDateString(i,{month:"short",year:"numeric"}),x:ue}),j.setMonth(j.getMonth()+1);}return I},[n,s,r,Pe,o,i,M.labels.week,C]),J=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Pe*o,[n,Pe,o]),xe=Math.max(Ee.length*a,552);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,"data-escala":r,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:t.glassHeader||t.bgSecondary,flexShrink:0,height:"48px",borderBottom:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(je,1e3),height:47,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(je,1e3),height:48,fill:t.glassHeader||t.bgSecondary}),L.map((I,j)=>jsxs("g",{children:[j>0&&jsx("line",{x1:I.x,y1:0,x2:I.x,y2:48,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:I.x+8,y:48/2,fill:r==="day"&&!ee(I.date)&&ot(I.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:I.label})]},`header-${j}`)),J>=0&&J<=je&&jsxs("g",{"data-hoy":"cabecera",children:[jsx("circle",{cx:J,cy:38,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:J,cy:38,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${J-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:"rgba(0,0,0,0.8)",stroke:t.today,strokeWidth:.5,opacity:.8}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:t.today,fontSize:"7",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:M.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:N,width:Math.max(je,1e3),height:xe,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:le,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(je,1e3),height:xe,fill:t.bgPrimary}),Ee.map((I,j)=>jsx("rect",{x:0,y:j*a,width:Math.max(je,1e3),height:a,fill:j%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:{pointerEvents:"none"}},`row-bg-${I.id}`)),L.map((I,j)=>j>0?jsx("line",{x1:I.x,y1:0,x2:I.x,y2:Ee.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${j}`):null),L.map((I,j)=>{let ke=L[j+1]?.x||je,Ue=w&&ee(I.date),ue=r==="day"&&!ee(I.date)&&ot(I.date);return Ue||ue?jsxs("g",{"data-finde":"true",children:[jsx("rect",{x:I.x,y:0,width:ke-I.x,height:Ee.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:I.x,y:0,width:ke-I.x,height:Ee.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${j}`):null}),Ee.map((I,j)=>{let ke=I.startDate&&I.endDate;return jsx("g",{children:!ke&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:j*a,width:je,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Ue=>zt(Ue,I),onMouseMove:Ue=>st(Ue,I,j),onMouseLeave:()=>{bt();}},`clickable-${I.id}`),oe&&oe.taskId===I.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:oe.x,y1:j*a+4,x2:oe.x,y2:j*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:oe.x,cy:oe.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:oe.x,cy:oe.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${oe.x}, ${j*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:oe.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!oe||oe.taskId!==I.id)&&jsx("text",{x:J>0?J:100,y:j*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:M.labels.clickToSetDates},`placeholder-${I.id}`)]})},`row-group-${I.id}`)}),Ee.map((I,j)=>{if(!I.startDate||!I.endDate)return null;let{x:ke,width:Ue}=Dt(I),ue=j*a+(a-18)/2,at=I.subtasks&&I.subtasks.length>0&&!I.isMilestone;if(I.isMilestone)return jsx(Cl,{task:I,x:ke+Ue/2,y:ue+12,theme:t,onClick:u},I.id);if(at){let yt=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Ye=8,vt=ue+(a-18)/2+(18-Ye)/2,Xt=4,wt=I.progress||0,Ut=new Date;Ut.setHours(0,0,0,0);let Ht=I.startDate&&Ut>=I.startDate,he=I.endDate&&(()=>{let aa=new Date(I.endDate);return aa.setHours(0,0,0,0),Ut>aa})(),Fe=I.startDate&&Ut<I.startDate,Qe=1;if(Ht&&I.startDate&&I.endDate&&!Fe){let aa=new Date(I.startDate);aa.setHours(0,0,0,0);let cr=new Date(I.endDate);cr.setHours(0,0,0,0);let Xe=Math.max(1,(cr.getTime()-aa.getTime())/(1e3*60*60*24)),Sa=Math.min((Ut.getTime()-aa.getTime())/(1e3*60*60*24),Xe)/Xe*100;Qe=Sa>0?wt/Sa:1;}let rt;wt>=100?rt="#00E5CC":Fe?rt="#4B5563":he&&wt<100?rt="#EF4444":Qe>=.95?rt="#22C55E":Qe>=.8?rt="#F59E0B":rt="#EF4444";let Tt=Math.max(wt/100*Ue,wt>0?Xt*2:0),Ft=Ue>100&&wt>0,kt=I.isCriticalPath;return jsxs("g",{onClick:()=>u?.(I),onContextMenu:aa=>{aa.preventDefault(),aa.stopPropagation(),m?.(I,aa);},onMouseMove:aa=>{He({task:I,x:ke,y:vt,width:Ue,height:Ye,showBelow:vt<100,mouseX:aa.clientX,mouseY:aa.clientY});},onMouseLeave:()=>He(null),style:{cursor:"default",opacity:y?kt?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":wt>=100?"completed":he?"overdue":"planned",children:[jsx("rect",{x:ke,y:ue,width:Ue,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:ke,y:vt,width:Ue,height:Ye,rx:Xt,fill:yt?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),wt>0&&jsx("rect",{x:ke,y:vt,width:Tt,height:Ye,rx:Xt,fill:rt,"data-parte":"avance"}),y&&kt&&jsx("rect",{x:ke,y:vt,width:Ue,height:Ye,rx:Xt,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),Ft&&jsxs("text",{x:ke+Tt+6,y:vt+Ye/2,dominantBaseline:"central",fill:yt?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(wt),"%"]})]},I.id)}return jsx(yl,{task:I,x:ke,y:ue,width:Ue,theme:t,dayWidth:Pe*o,startDate:n,templates:c,onClick:u,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:ht,onDragMove:_e,onHoverChange:He,showBaseline:h,showTaskBarLabels:p,showCriticalPath:y,readOnly:P?!P(I):false,onProgressChange:O},I.id)}),x&&Ee.map((I,j)=>!I.dependencies||I.dependencies.length===0||!I.startDate||!I.endDate?null:I.dependencies.map(ke=>{let Ue=Ee.find(rt=>rt.id===ke);if(!Ue||!Ue.startDate||!Ue.endDate)return null;let ue=Ee.findIndex(rt=>rt.id===ke),at=dt(Ue.id,Dt(Ue)),yt=dt(I.id,Dt(I)),Ye=at.x+at.width,vt=ue*a+26,Xt=yt.x,wt=j*a+26,Ut=`dep-${ke}-${I.id}`;if(G.has(Ut))return null;let Ht=y&&I.isCriticalPath&&Ue.isCriticalPath;return jsx(ui,{x1:Ye,y1:vt,x2:Xt,y2:wt,theme:t,lineStyle:l,colorOverride:y?Ht?"#EF4444":"rgba(255,255,255,0.10)":void 0,strokeWidthOverride:y?Ht?2:1:void 0,glowFilter:Ht?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,onDelete:()=>b?.(I.id,ke),onHoverChange:rt=>{we.current=rt,rt&&R({key:Ut,fromId:ke,toId:I.id,exitX:Ye,exitY:vt,enterX:Xt,enterY:wt});}},Ut)})),z.map(I=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:I.previewX,y:I.y-48,width:I.width,height:18,rx:6,fill:I.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(I.daysDelta)>0&&jsx("text",{x:I.previewX+I.width/2,y:I.y-48+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:I.daysDelta>0?`+${I.daysDelta}d`:`${I.daysDelta}d`})]},`cascade-preview-${I.taskId}`)),x&&Ce&&jsx(ui,{x1:Ce.exitX,y1:Ce.exitY,x2:Ce.enterX,y2:Ce.enterY,theme:t,lineStyle:l,onDelete:()=>{let I=Ce.key;R(null),we.current=false,Ve(j=>new Set(j).add(I)),b?.(Ce.toId,Ce.fromId);},hoverOverlayOnly:true,onHoverChange:I=>{we.current=I,I||R(null);}},`${Ce.key}-hover-overlay`),J>=0&&J<=je&&jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&jsx("line",{x1:J,y1:0,x2:J,y2:xe,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:J,y1:0,x2:J,y2:xe,stroke:t.today,strokeWidth:1,opacity:1})]})]}),Se&&jsx(fg,{tooltipData:Se,theme:t,locale:i==="es"?"es":"en",workingDaysConfig:T})]})}var Fw=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],yg=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),Lw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),Aw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),Iw=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),Rw=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function Sl({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:i,onDependencyDelete:c}){let[l,p]=useState(false),[u,d]=useState(false),[m,f]=useState([]),[v,b]=useState(""),[h,y]=useState(false),[x,w]=useState(true),[C,P]=useState(""),[O,T]=useState(-1),[D,M]=useState(false),[N,z]=useState(0),$=useRef(null),Y=useRef(null),A=useRef(null),Se=useRef(null),{enabled:W=true,placeholder:Ce='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:R="bottom-right",onCommand:we,suggestions:G=Fw,maxHistory:Ve=50,persistHistory:oe,mentionableUsers:Be=[]}=a,le=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",He=le?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",$e=le?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Pe=le?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",je=le?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",tt=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ee=le?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",Ae=le?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",ot=le?"rgba(0, 229, 204, 0.9)":"#00E5CC",Ie=le?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",zt=le?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",st=le?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",bt=le?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Ee=le?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",Dt=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",ht=le?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",_e=le?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",dt=le?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",L=le?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",J=le?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",xe=le?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",I="rgba(0, 229, 204, 0.04)",j=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ke=le?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",Ue=le?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",ue=le?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",at=le?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",yt=le?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",Ye=le?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",vt=le?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Xt="rgba(0, 229, 204, 0.06)",wt=le?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Ut=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",Ht=le?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",he=le?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",Fe=le?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Qe=le?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",rt=le?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Tt=le?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Ft=le?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",kt=le?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",Da=le?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",aa=le?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",cr=le?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Xe=le?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",et=le?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Sa=oe?.storageKey||"gantt-ai-history",Ia=oe?.maxMessages??5,dr=Be.filter(B=>{if(!C)return true;let re=C.toLowerCase();return B.name.toLowerCase().includes(re)||B.email&&B.email.toLowerCase().includes(re)}).slice(0,5),xr=useCallback(B=>{if(b(B),Be.length===0)return;let re=$.current;if(!re)return;let be=re.selectionStart||B.length,S=B.slice(0,be),H=S.lastIndexOf("@");if(H>=0&&((H>0?S[H-1]:" ")===" "||H===0)){let Te=S.slice(H+1);if(Te.length<=40){P(Te),T(H),M(true),z(0);return}}M(false),P(""),T(-1);},[Be.length]),Ra=useCallback(B=>{let re=v.slice(0,O),be=v.slice(O+1+C.length),S=`${re}@${B.name} ${be}`;b(S),M(false),P(""),T(-1),setTimeout(()=>$.current?.focus(),0);},[v,O,C]),Ja=useCallback(B=>{if(!D||dr.length===0)return false;if(B.key==="ArrowDown")return B.preventDefault(),z(re=>re<dr.length-1?re+1:0),true;if(B.key==="ArrowUp")return B.preventDefault(),z(re=>re>0?re-1:dr.length-1),true;if(B.key==="Enter"||B.key==="Tab"){B.preventDefault();let re=dr[N];return re&&Ra(re),true}return B.key==="Escape"?(M(false),true):false},[D,dr,N,Ra]);useEffect(()=>{if(oe?.enabled)try{let B=localStorage.getItem(Sa);if(B){let be=JSON.parse(B).map(S=>({...S,timestamp:new Date(S.timestamp)}));f(be.slice(-Ia));}}catch(B){console.warn("[GanttAIAssistant] Failed to load persisted history:",B);}},[oe?.enabled,Sa,Ia]),useEffect(()=>{if(oe?.enabled&&m.length>0)try{let B=m.filter(re=>!re.isLoading).slice(-Ia);localStorage.setItem(Sa,JSON.stringify(B));}catch(B){console.warn("[GanttAIAssistant] Failed to persist history:",B);}},[m,oe?.enabled,Sa,Ia]),useEffect(()=>{Y.current&&Y.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{l&&!u&&$.current&&setTimeout(()=>$.current?.focus(),100);},[l,u]);let se=useCallback(B=>{if(B.success)switch(B.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":B.taskId&&B.updates&&n?.(B.taskId,B.updates);break;case "create_task":B.newTask&&s?.(B.newTask);break;case "delete_task":B.taskId&&o?.(B.taskId);break;case "link_tasks":B.dependencyFrom&&B.dependencyTo&&i?.(B.dependencyFrom,B.dependencyTo);break;case "unlink_tasks":B.taskId&&B.dependencyFrom&&c?.(B.taskId,B.dependencyFrom);break}},[n,s,o,i,c]),me=useCallback(async B=>{if(!B.trim()||h)return;let re={id:`user-${Date.now()}`,role:"user",content:B,timestamp:new Date};f(S=>[...S.slice(-(Ve-1)),re]),b(""),w(false),y(true);let be={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(S=>[...S,be]);try{if(we){let S=m.filter(Z=>!Z.isLoading&&Z.content).slice(-6).map(Z=>({role:Z.role,content:Z.content})),H=await we(B,e,S);f(Z=>{let Te=Z.filter(fe=>!fe.isLoading),gt={id:`assistant-${Date.now()}`,role:"assistant",content:H.message,timestamp:new Date,command:H};return [...Te,gt]}),se(H);}else f(S=>[...S.filter(Z=>!Z.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(S){f(H=>[...H.filter(Te=>!Te.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${S instanceof Error?S.message:"Unknown error"}`,timestamp:new Date}]);}finally{y(false);}},[h,Ve,we,e,se]),q=B=>{B.preventDefault(),me(v);},pe=B=>{b(B),$.current?.focus();};if(useEffect(()=>{let B=re=>{(re.metaKey||re.ctrlKey)&&re.key==="k"&&(re.preventDefault(),p(be=>!be),l||d(false)),re.key==="Escape"&&l&&p(false);};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[l]),useEffect(()=>{if(!l)return;let B=be=>{let S=be.target;A.current&&!A.current.contains(S)&&p(false);},re=setTimeout(()=>{document.addEventListener("mousedown",B);},100);return ()=>{clearTimeout(re),document.removeEventListener("mousedown",B);}},[l]),!W)return null;let ce={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(ga,{children:[jsx(AnimatePresence,{children:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ce[R]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:He,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${$e}`,color:"#00E5CC",cursor:"pointer",boxShadow:Pe,overflow:"visible"},onClick:()=>p(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${je}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${tt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(yg,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:ot,background:ee,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${Ae}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
361
|
+
</Project>`,u=new Blob([l],{type:"application/xml;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=a,p.click(),URL.revokeObjectURL(p.href);},calculateCriticalPath:e=>{let t=$e.flattenTasks(e),a=t.filter(l=>l.startDate&&l.endDate);if(a.length===0)return [];let r=new Map,n=l=>{if(r.has(l.id))return;let u=l.startDate&&l.endDate?$e.calculateDuration(l.startDate,l.endDate):0,p=0;if(l.dependencies&&l.dependencies.length>0)for(let m of l.dependencies){let f=t.find(v=>v.id===m);if(f){n(f);let v=r.get(m)?.ef||0;p=Math.max(p,v);}}let d=p+u;r.set(l.id,{es:p,ef:d});};a.forEach(n);let s=Math.max(...Array.from(r.values()).map(l=>l.ef)),o=new Map,i=l=>{if(o.has(l.id))return;let u=l.startDate&&l.endDate?$e.calculateDuration(l.startDate,l.endDate):0,p=t.filter(f=>f.dependencies&&f.dependencies.includes(l.id)),d=s;if(p.length>0)for(let f of p){i(f);let v=o.get(f.id)?.ls||0;d=Math.min(d,v);}let m=d-u;o.set(l.id,{ls:m,lf:d});};a.forEach(i);let c=[];for(let l of a){let u=r.get(l.id),p=o.get(l.id);if(u&&p){let d=p.ls-u.es;Math.abs(d)<.01&&c.push(l.id);}}return c},calculateCriticalPathFull:e=>{let t=new Map,r=$e.flattenTasks(e).filter(d=>d.startDate&&d.endDate);if(r.length===0)return t;let n=new Map(r.map(d=>[d.id,d])),s=new Map;for(let d of r)s.has(d.id)||s.set(d.id,[]);for(let d of r)if(d.dependencies){for(let m of d.dependencies)if(n.has(m)){let f=s.get(m);f&&f.push(d.id);}}let o=new Map;for(let d of r)o.set(d.id,0);for(let d of r)if(d.dependencies)for(let m of d.dependencies)n.has(m)&&o.set(d.id,(o.get(d.id)||0)+1);let i=new Map,c=[],l=[];for(let d of r)(o.get(d.id)||0)===0&&l.push(d.id);for(;l.length>0;){let d=l.shift();c.push(d);let m=n.get(d);if(!m||!m.startDate||!m.endDate)continue;let f=$e.calculateDuration(m.startDate,m.endDate),v=0;if(m.dependencies)for(let w of m.dependencies){let h=i.get(w);h&&(v=Math.max(v,h.ef));}i.set(d,{es:v,ef:v+f});let b=s.get(d)||[];for(let w of b){let h=(o.get(w)||1)-1;o.set(w,h),h===0&&l.push(w);}}if(c.length<r.length)return t;let u=Math.max(...Array.from(i.values()).map(d=>d.ef)),p=new Map;for(let d=c.length-1;d>=0;d--){let m=c[d];if(!m)continue;let f=n.get(m);if(!f||!f.startDate||!f.endDate)continue;let v=$e.calculateDuration(f.startDate,f.endDate),b=s.get(m)||[],w=u;if(b.length>0)for(let h of b){let x=p.get(h);x&&(w=Math.min(w,x.ls));}p.set(m,{ls:w-v,lf:w});}for(let d of c){let m=i.get(d),f=p.get(d),v=f.ls-m.es,b=s.get(d)||[],w;b.length>0?w=Math.min(...b.map(h=>i.get(h).es))-m.ef:w=u-m.ef,t.set(d,{earlyStart:m.es,earlyFinish:m.ef,lateStart:f.ls,lateFinish:f.lf,totalFloat:Math.round(v*100)/100,freeFloat:Math.max(0,Math.round(w*100)/100),isCritical:v<=.01});}return t},calculateSlack:(e,t)=>{let a=$e.findTaskById(e,t);if(!a||!a.startDate||!a.endDate)return null;if($e.calculateCriticalPath(e).includes(t))return 0;let n=$e.getDependentTasks(e,t);if(n.length===0){let i=$e.getLatestEndDate(e);if(!i)return null;let c=$e.calculateDuration(a.endDate,i);return Math.max(0,c)}let s=n.filter(i=>i.startDate).map(i=>i.startDate.getTime()).sort((i,c)=>i-c)[0];if(!s)return null;let o=$e.calculateDuration(a.endDate,new Date(s));return Math.max(0,o)},isOnCriticalPath:(e,t)=>$e.calculateCriticalPath(e).includes(t),autoScheduleDependents:(e,t,a,r)=>{let n=r||new Set;if(n.has(t))return e;n.add(t);let s=$e.findTaskById(e,t);if(!s||!s.endDate)return e;let o=$e.getDependentTasks(e,t);if(o.length===0)return e;let i=[...e];for(let c of o){if(n.has(c.id)||!c.startDate||!c.endDate)continue;let l=$e.calculateDuration(c.startDate,c.endDate),u;if(a!==void 0?(u=new Date(c.startDate),u.setDate(u.getDate()+a)):(u=new Date(s.endDate),u.setDate(u.getDate()+1)),a!==void 0){let m=new Date(s.endDate),f=new Date(m);f.setDate(f.getDate()+1),u<f&&(u=f);}let p=$e.calculateEndDate(u,l),d=m=>m.map(f=>f.id===c.id?{...f,startDate:u,endDate:p}:f.subtasks?{...f,subtasks:d(f.subtasks)}:f);i=d(i),i=$e.autoScheduleDependents(i,c.id,a,n);}return i},calculateCascadePreview:(e,t,a,r,n,s,o,i)=>{if(a===0)return [];let c=[],l=n.getTime(),u=1e3*60*60*24,p=$e.findTaskById(e,t);if(!p||!p.endDate)return [];let d=(m,f,v=new Set)=>{if(v.has(m))return;v.add(m);let b=$e.getDependentTasks(e,m);for(let w of b){if(!w.startDate||!w.endDate)continue;let h=r.findIndex(S=>S.id===w.id);if(h===-1)continue;let x=w.startDate.getTime(),k=(w.endDate.getTime()-x)/u,H=(x-l)/u*s,E=H+f*s,N=Math.max(k*s,s),D=i+h*o+(o-18)/2;c.push({taskId:w.id,taskName:w.name,originalX:H,previewX:E,width:N,y:D,rowIndex:h,daysDelta:f,color:w.color}),d(w.id,f,v);}};return d(t,a),c},splitTask:(e,t,a,r=3)=>{let n=$e.findTaskById(e,t);if(!n||!n.startDate||!n.endDate)return e;if(a<=n.startDate||a>=n.endDate)return console.warn("Split date must be between task start and end dates"),e;let s=new Date(a);s.setDate(s.getDate()-1);let o=new Date(a);o.setDate(o.getDate()+r);let i=new Date(n.endDate);i.setDate(i.getDate()+r);let c=[{startDate:new Date(n.startDate),endDate:s},{startDate:o,endDate:i}],l=u=>u.map(p=>p.id===n.id?{...p,endDate:i,segments:c}:p.subtasks?{...p,subtasks:l(p.subtasks)}:p);return l(e)}};var vo=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),fk=e=>`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,Mu=(e,t)=>{let a=vo(e);return a.setDate(a.getDate()+t),a},Ys=(e,t)=>vo(e).getTime()<vo(t).getTime(),cc={esHabil:()=>true};function Ko(e){if(!e)return cc;let t=e.enabledWeekdays&&e.enabledWeekdays.length===7?e.enabledWeekdays:null,a=e.holidayDates?e.holidayDates instanceof Set?e.holidayDates:new Set(e.holidayDates):null;return t&&!t.some(Boolean)?cc:{esHabil:r=>(!t||!!t[r.getDay()])&&!(a&&a.has(fk(r)))}}function Xs(e,t,a=false){let r=vo(e);for(let n=0;n<3660&&!t.esHabil(r);n++)r=Mu(r,a?-1:1);return r}function _o(e,t,a){if(t===0)return Xs(e,a);let r=vo(e),n=t>0?1:-1,s=Math.abs(t);for(let o=0;o<36600&&s>0;o++)r=Mu(r,n),a.esHabil(r)&&s--;return r}function vs(e,t,a){let r=vo(e),n=vo(t);if(n.getTime()<r.getTime())return 1;let s=0;for(let o=r;o.getTime()<=n.getTime();o=Mu(o,1))a.esHabil(o)&&s++;return Math.max(1,s)}function dc(e,t,a){return _o(Xs(e,a),Math.max(1,t)-1,a)}function ws(e){let t=new Map((e.dependencyLinks??[]).map(r=>[r.id,r]));return [...new Set([...e.dependencies??[],...t.keys()])].map(r=>t.get(r)??{id:r,type:"FS",lag:0})}function uc(e,t=new Map){for(let a of e)t.set(a.id,a),a.subtasks?.length&&uc(a.subtasks,t);return t}function pc(e,t,a){if(!t.startDate||!t.endDate)return null;switch(e.type){case "FS":return {inicioMin:_o(t.endDate,1+e.lag,a),enlace:e,predecesora:t};case "SS":return {inicioMin:_o(t.startDate,e.lag,a),enlace:e,predecesora:t};case "FF":return {finMin:_o(t.endDate,e.lag,a),enlace:e,predecesora:t};case "SF":return {finMin:_o(t.startDate,e.lag,a),enlace:e,predecesora:t}}}function Ki(e,t,a,r,n){let s=r instanceof Map?r:uc(r),o=e.isMilestone?1:vs(t,a,n),i=e.isMilestone?vo(a):vo(t),c=null;for(let l=0;l<8;l++){let u=false,p=e.isMilestone?i:dc(i,o,n);for(let d of ws(e)){let m=s.get(d.id);if(!m||m.id===e.id)continue;let f=pc(d,m,n);f&&(f.inicioMin&&Ys(i,f.inicioMin)?(i=Xs(f.inicioMin,n),c=f,u=true):f.finMin&&Ys(p,f.finMin)&&(i=e.isMilestone?Xs(f.finMin,n):_o(f.finMin,-(o-1),n),c=f,u=true));}if(!u)break}return c?{inicio:i,fin:e.isMilestone?i:dc(i,o,n),porQue:c}:{inicio:t,fin:a,porQue:null}}function Js(e,t,a){let r=uc(e),n=new Map;for(let c of r.values())for(let l of ws(c)){let u=n.get(l.id)??[];u.push(c.id),n.set(l.id,u);}let s=[...t],o=new Map,i=0;for(;s.length>0&&i++<2e4;){let c=s.shift();for(let l of n.get(c)??[]){let u=r.get(l);if(!u?.startDate||!u.endDate)continue;let p=Ki(u,u.startDate,u.endDate,r,a);if(!p.porQue)continue;let d={...u,startDate:p.inicio,endDate:p.fin};r.set(l,d),o.set(l,{id:l,startDate:p.inicio,endDate:p.fin,porQue:p.porQue}),s.push(l);}}return [...o.values()]}function mc(e,t){let a=uc(e),r=[];for(let n of a.values())if(!(!n.startDate||!n.endDate))for(let s of ws(n)){let o=a.get(s.id);if(!o)continue;let i=pc(s,o,t);if(!i)continue;let c=n.isMilestone?n.startDate:n.endDate,l=0;i.inicioMin&&Ys(n.startDate,i.inicioMin)?l=vs(n.startDate,i.inicioMin,t)-1:i.finMin&&Ys(c,i.finMin)&&(l=vs(c,i.finMin,t)-1),(l>0||i.inicioMin&&Ys(n.startDate,i.inicioMin)||i.finMin&&Ys(c,i.finMin))&&r.push({sucesora:n,predecesora:o,enlace:s,dias:Math.max(1,l)});}return r}function no(e){return e==="day"?60:e==="week"?20:8}function Pu(e,t){let a=new Date(e.getFullYear(),e.getMonth(),e.getDate());if(t==="week"){let r=(a.getDay()+6)%7;a.setDate(a.getDate()-r);}else t==="month"&&a.setDate(1);return a}function H0(e,t,a){return {inicio:a<e?new Date(a):e,fin:a>t?new Date(a):t}}function W0(e,t,a,r){return !e||!t||a>=e&&a<=t?a:r||(a<e?e:t)}function z0(e,t,a,r){return t<a?"left":e>r?"right":null}function U0(e,t,a){return e<t?"left":e>a?"right":null}function V0(e,t,a){let r=a.startsWith("es"),n=e==="FS"?"":r?{SS:"CC",FF:"FF",SF:"CF"}[e]:e,s=t===0?"":`${t>0?"+":"\u2212"}${Math.abs(t)}`;return [n,s].filter(Boolean).join(" ")||void 0}function gc({tasks:e,theme:t,rowHeight:a,timeScale:r,startDate:n,endDate:s,zoom:o,locale:i="en",templates:c,dependencyLineStyle:l="curved",showTaskBarLabels:u=true,onTaskClick:p,onTaskDblClick:d,onTaskContextMenu:m,onTaskDateChange:f,onDependencyCreate:v,onDependencyDelete:b,showBaseline:w,showCriticalPath:h=true,showDependencies:x=true,highlightWeekends:y=true,weekHeaderFormat:k="number",canEditTask:M,onTaskProgressDrag:H,workingDaysConfig:E,ventanaVisible:N,onIrAFecha:D,finPlaneado:S,finPrevisto:V,alturaCabecera:W,v6:R=false,alturaBarra:A}){let ve=A??18,q=W??48,le=Rr(),B=useRef(null),[pe,nt]=useState([]),[Ue,$]=useState(null),[fe,ie]=useState(null),[et,Xe]=useState(null),Qe=useMemo(()=>new Set(mc(e,Ko(E)).map(I=>`${I.predecesora.id}>${I.sucesora.id}`)),[e,E]),ct=useRef(false),[Tt,_t]=useState(new Set),[tt,xt]=useState(null),Jt=useCallback(I=>{if(et&&!ct.current){let te=I.target,Re=false;for(;te&&te!==I.currentTarget;){if(te.getAttribute?.("data-dependency-line")==="true"||te.getAttribute?.("data-dependency-hover-overlay")==="true"){Re=true;break}te=te.parentElement;}Re||Xe(null);}},[et]),Wt=useCallback(I=>{ie(I);},[]),Qt=Math.ceil((s.getTime()-n.getTime())/(1e3*60*60*24)),Y=no(r),Le=Qt*Y*o,Ye=I=>{let te=new Date(Date.UTC(I.getFullYear(),I.getMonth(),I.getDate())),Re=te.getUTCDay()||7;te.setUTCDate(te.getUTCDate()+4-Re);let Ee=new Date(Date.UTC(te.getUTCFullYear(),0,1));return Math.ceil(((te.getTime()-Ee.getTime())/864e5+1)/7)},he=I=>{let te=I.getDay();return te===0||te===6},dt=useMemo(()=>{let I=E?.holidayDates;return I?I instanceof Set?I:new Set(I):null},[E?.holidayDates]),wt=I=>{if(!dt)return false;let te=`${I.getFullYear()}-${String(I.getMonth()+1).padStart(2,"0")}-${String(I.getDate()).padStart(2,"0")}`;return dt.has(te)},ue=useMemo(()=>Ko(E??null),[E]),ce=I=>I.startDate&&I.endDate?vs(I.startDate,I.endDate,ue):0,Ae=useCallback(I=>{let te=Math.round(I/(Y*o)),Re=new Date(n);return Re.setDate(Re.getDate()+te),Re},[n,Y,o]),Et=useCallback((I,te)=>{if(te.startDate&&te.endDate)return;let Re=I.currentTarget.ownerSVGElement;if(!Re)return;let Ee=Re.createSVGPoint();Ee.x=I.clientX,Ee.y=I.clientY;let _e=Ee.matrixTransform(Re.getScreenCTM()?.inverse()),it=Ae(_e.x),qe=new Date(it);qe.setDate(qe.getDate()+1),xt(null),f?.(te,it,qe);},[Ae,f]),Pe=useCallback((I,te,Re)=>{let Ee=I.currentTarget.ownerSVGElement;if(!Ee)return;let _e=Ee.createSVGPoint();_e.x=I.clientX,_e.y=I.clientY;let it=_e.matrixTransform(Ee.getScreenCTM()?.inverse()),qe=Ae(it.x),Ct=Math.round(it.x/(Y*o))*Y*o;xt({taskId:te.id,x:Ct,y:Re*a+a/2,date:qe});},[Ae,Y,o,a]),ut=useCallback(()=>{xt(null);},[]),O=useMemo(()=>{let I=_e=>_e.map(it=>{if(it.subtasks&&it.subtasks.length>0){let qe=I(it.subtasks),Ze=qe.filter(At=>At.startDate&&At.endDate),Ct=!!(it.startDate&&it.endDate);if(Ze.length>0&&!Ct){let At=Ze.map(ft=>ft.startDate.getTime()),It=Ze.map(ft=>ft.endDate.getTime()),Ke=new Date(Math.min(...At)),Fe=new Date(Math.max(...It));return {...it,subtasks:qe,startDate:Ke,endDate:Fe}}return {...it,subtasks:qe}}return it}),te=(_e,it=[])=>{let qe=[..._e].sort((Ze,Ct)=>(Ze.position??0)-(Ct.position??0));for(let Ze of qe)it.push(Ze),Ze.subtasks&&Ze.subtasks.length>0&&(Ze.isExpanded===void 0||Ze.isExpanded)&&te(Ze.subtasks,it);return it},Re=I(e);return te(Re)},[e]),re=useCallback(I=>{if(!I.startDate||!I.endDate)return {x:0,width:0};let te=I.startDate.getTime(),Re=I.endDate.getTime(),Ee=n.getTime(),_e=(te-Ee)/(1e3*60*60*24),it=(Re-te)/(1e3*60*60*24)+1,qe=_e*Y*o,Ze=Math.max(Y*o,40),Ct=Math.max(it*Y*o,Ze);return {x:qe,width:Ct}},[n,Y,o]),we=useMemo(()=>O.filter(I=>I.startDate&&I.endDate).map(I=>{let{x:te,width:Re}=re(I),_e=O.findIndex(it=>it.id===I.id)*a+(a-ve)/2;return {id:I.id,x:te,y:_e,width:Re,height:18}}),[O,re]),ot=useCallback((I,te,Re)=>{if(!Re){nt([]),$(null);return}if($({taskId:I,daysDelta:te}),te===0){nt([]);return}let Ee=$e.findTaskById(e,I);if(!Ee?.startDate||!Ee.endDate){nt([]);return}let _e=Fe=>{let ft=new Date(Fe);return ft.setDate(ft.getDate()+te),ft},it=_e(Ee.startDate),qe=_e(Ee.endDate),Ze=Fe=>Fe.map(ft=>ft.id===I?{...ft,startDate:it,endDate:qe}:ft.subtasks?{...ft,subtasks:Ze(ft.subtasks)}:ft),Ct=Js(Ze(e),[I],Ko(E)),At=1e3*60*60*24,It=Y*o,Ke=Ct.flatMap(Fe=>{let ft=O.findIndex(ma=>ma.id===Fe.id),_a=O[ft];return ft===-1||!_a?.startDate?[]:[{taskId:Fe.id,taskName:_a.name,originalX:(_a.startDate.getTime()-n.getTime())/At*It,previewX:(Fe.startDate.getTime()-n.getTime())/At*It,width:Math.max((Fe.endDate.getTime()-Fe.startDate.getTime())/At*It,It),y:q+ft*a+(a-ve)/2,rowIndex:ft,daysDelta:Math.round((Fe.startDate.getTime()-_a.startDate.getTime())/At),color:_a.color}]});nt(Ke);},[e,O,n,Y,o,a,q,E]),mt=useCallback((I,te)=>{if(!Ue)return te;let Re=Y*o,Ee=Ue.daysDelta*Re;if(I===Ue.taskId)return {x:te.x+Ee,width:te.width};let _e=pe.find(it=>it.taskId===I);return _e?{x:_e.previewX,width:_e.width}:te},[Ue,pe,Y,o]),Ht=useMemo(()=>{let I=[],te=new Date(n);for(;te<=s;){let _e=(te.getTime()-n.getTime())/864e5*Y*o;if(r==="day")I.push({date:new Date(te),label:te.toLocaleDateString(i,{day:"numeric",month:"short"}),x:_e}),te.setDate(te.getDate()+1);else if(r==="week"){let it=Ye(te);I.push({date:new Date(te),label:k==="range"?(()=>{let qe=new Date(te);qe.setDate(qe.getDate()+6);let Ze=Ct=>Ct.toLocaleDateString(i,{month:"short"});return Ze(te)===Ze(qe)?`${Ze(te)} ${te.getDate()}\u2013${qe.getDate()}`:`${Ze(te)} ${te.getDate()}\u2013${Ze(qe)} ${qe.getDate()}`})():`${le.labels.week} ${it}`,x:_e}),te.setDate(te.getDate()+7);}else I.push({date:new Date(te),label:te.toLocaleDateString(i,{month:"short",year:"numeric"}),x:_e}),te.setMonth(te.getMonth()+1);}return I},[n,s,r,Y,o,i,le.labels.week,k]),Zt=useMemo(()=>(new Date().getTime()-n.getTime())/(1e3*60*60*24)*Y*o,[n,Y,o]),Oe=R&&r==="day",Wa=Y*o,la=(I,te)=>!!I&&!!te&&I.getFullYear()===te.getFullYear()&&I.getMonth()===te.getMonth()&&I.getDate()===te.getDate(),da=I=>I.toLocaleDateString(i,{month:"short"}).replace(".",""),ke=useMemo(()=>{if(!Oe)return [];let I=[];return Ht.forEach((te,Re)=>{let Ee=te.date;if(Re!==0&&Ee.getDay()!==1)return;let _e=new Date(Ee);_e.setDate(Ee.getDate()-(Ee.getDay()+6)%7);let it=new Date(_e);it.setDate(_e.getDate()+6);let qe=_e.getMonth()===it.getMonth()?`${_e.getDate()} \u2013 ${it.getDate()} ${da(it)}`:`${_e.getDate()} ${da(_e)} \u2013 ${it.getDate()} ${da(it)}`;I.push({x:te.x,etiqueta:qe,num:Ye(_e)});}),I},[Oe,Ht,i]),Te=i==="es"?["D","L","M","X","J","V","S"]:["S","M","T","W","T","F","S"],gt=new Date,Ie={texto:"var(--v6-texto, #0E1114)",texto2:"var(--v6-texto-2, #4D5761)",tenue:"var(--v6-tenue, #5F6972)",borde:"var(--v6-borde, #E2E5E9)",linea:"var(--v6-linea, #EEF0F2)",tarjeta:"var(--v6-tarjeta, #FFFFFF)"},Lt=Math.max(O.length*a,600-q);return jsxs("div",{className:"w-full flex flex-col","data-gantt-chart":true,"data-escala":r,style:{backgroundColor:t.bgPrimary},children:[jsx("div",{style:{position:"sticky",top:0,zIndex:10,backgroundColor:R?Ie.tarjeta:t.glassHeader||t.bgSecondary,flexShrink:0,height:`${q}px`,borderBottom:R?`1px solid ${Ie.borde}`:`1px solid ${t.borderLight}`,boxSizing:"border-box"},children:jsxs("svg",{width:Math.max(Le,1e3),height:q-1,style:{display:"block"},children:[jsx("rect",{x:0,y:0,width:Math.max(Le,1e3),height:q,fill:t.glassHeader||t.bgSecondary,style:R?{fill:Ie.tarjeta}:void 0}),Oe&&jsxs("g",{"data-escala-v6":"dia",children:[ke.map((I,te)=>jsxs("g",{children:[I.x>0&&jsx("line",{x1:I.x,y1:0,x2:I.x,y2:q,style:{stroke:Ie.borde},strokeWidth:1,shapeRendering:"crispEdges"}),jsxs("text",{x:(()=>{let Re=N?.izq??0,Ee=ke[te+1]?.x??1/0;return I.x<Re&&Re+140<Ee?Re+8:I.x+8})(),y:12,dominantBaseline:"middle",style:{fill:Ie.texto2,fontSize:12,fontWeight:500},children:[I.etiqueta,jsx("tspan",{dx:7,style:{fill:Ie.tenue,fontSize:11,fontWeight:400,fontFamily:"'JetBrains Mono', ui-monospace, monospace"},children:`${i==="es"?"S":"W"}${I.num}`})]})]},`sem-${te}`)),jsx("line",{x1:0,y1:24.5,x2:Math.max(Le,1e3),y2:24.5,style:{stroke:Ie.linea},strokeWidth:1}),Ht.map((I,te)=>{let Re=I.x+Wa/2,Ee=he(I.date),_e=!Ee&&wt(I.date),it=la(I.date,V),qe=la(I.date,gt),Ze=String(I.date.getDate());return jsxs("g",{"data-dia-v6":_e?"festivo":Ee?"finde":void 0,children:[_e&&jsx("title",{children:i==="es"?"Festivo":"Holiday"}),jsx("text",{x:Re,y:35,textAnchor:"middle",dominantBaseline:"middle",style:{fill:Ie.tenue,fontSize:11},children:Te[I.date.getDay()]}),qe&&jsx("rect",{x:Re-12,y:41,width:24,height:17,rx:8.5,style:{fill:"var(--v6-hoy-fondo, #0E1114)"}}),it&&!qe&&jsx("rect",{x:Re-(Ze.length>1?11:8),y:24+17.5,width:Ze.length>1?22:16,height:16,rx:8,style:{fill:"none",stroke:Ie.texto2},strokeWidth:1}),jsx("text",{x:Re,y:50,textAnchor:"middle",dominantBaseline:"middle",style:{fill:qe?"var(--v6-hoy-texto, #FFFFFF)":Ee||_e?Ie.tenue:Ie.texto,fontSize:12,fontWeight:500,fontVariantNumeric:"tabular-nums"},children:Ze}),_e&&jsx("line",{x1:Re-6,y1:24+33.5,x2:Re+6,y2:24+33.5,style:{stroke:Ie.tenue},strokeWidth:1,strokeDasharray:"1 2"})]},`dia-${te}`)})]}),!Oe&&Ht.map((I,te)=>jsxs("g",{children:[te>0&&jsx("line",{x1:I.x,y1:0,x2:I.x,y2:q,stroke:t.border,strokeWidth:1,opacity:.1}),jsx("text",{x:I.x+8,y:q/2,fill:r==="day"&&!he(I.date)&&wt(I.date)?"#F59E0B":t.textTertiary,fontSize:"11",fontFamily:"'JetBrains Mono', ui-monospace, monospace",fontWeight:"500",dominantBaseline:"middle",children:I.label})]},`header-${te}`)),!R&&Zt>=0&&Zt<=Le&&jsxs("g",{"data-hoy":"cabecera",children:[jsx("circle",{cx:Zt,cy:q-10,r:4,fill:t.today,opacity:1}),t.neonRedGlow&&jsx("circle",{cx:Zt,cy:q-10,r:6,fill:"none",stroke:t.today,strokeWidth:1,opacity:.3}),t.neonRedGlow&&jsxs("g",{transform:`translate(${Zt-18}, 2)`,children:[jsx("rect",{x:0,y:0,width:36,height:14,rx:2,fill:t.today}),jsx("text",{x:18,y:10,textAnchor:"middle",fill:"#FFFFFF",fontSize:"8",fontFamily:"'JetBrains Mono', monospace",fontWeight:"700",letterSpacing:"0.1em",children:le.labels.today.toUpperCase()})]})]})]})}),jsxs("svg",{ref:B,width:Math.max(Le,1e3),height:Lt,style:{display:"block",flexShrink:0,overflow:"visible"},onMouseMove:Jt,children:[jsxs("defs",{children:[jsx("filter",{id:"shadow",children:jsx("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.1"})}),jsx("pattern",{id:"diagonal-stripes",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:t.border,strokeWidth:"2"})}),jsx("pattern",{id:"festivo-v6",width:"6",height:"6",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"6",style:{stroke:"var(--v6-festivo-trama, rgba(14,17,20,0.09))"},strokeWidth:"1"})}),jsx("pattern",{id:"weekend-hatch",width:"8",height:"8",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:jsx("line",{x1:"0",y1:"0",x2:"0",y2:"8",stroke:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.055)":"rgba(0,0,0,0.04)",strokeWidth:"4"})}),jsxs("pattern",{id:"bar-remaining-hatch",width:"10",height:"10",patternUnits:"userSpaceOnUse",patternTransform:"rotate(45)",children:[jsx("rect",{x:"0",y:"0",width:"5",height:"10",fill:"#00E5CC",opacity:"0.18"}),jsx("rect",{x:"5",y:"0",width:"5",height:"10",fill:"#94A3B8",opacity:"0.12"})]})]}),jsx("rect",{x:0,y:0,width:Math.max(Le,1e3),height:Lt,fill:t.bgPrimary,style:R?{fill:Ie.tarjeta}:void 0}),O.map((I,te)=>jsx("rect",{x:0,y:te*a,width:Math.max(Le,1e3),height:a,fill:te%2===0?t.bgPrimary:t.bgGrid,opacity:1,style:R?{pointerEvents:"none",fill:Ie.tarjeta}:{pointerEvents:"none"}},`row-bg-${I.id}`)),R&&O.map((I,te)=>jsx("line",{x1:0,y1:(te+1)*a-.5,x2:Math.max(Le,1e3),y2:(te+1)*a-.5,style:{stroke:Ie.linea,pointerEvents:"none"},strokeWidth:1},`linea-fila-${te}`)),Oe&&ke.filter(I=>I.x>0).map((I,te)=>jsx("line",{x1:I.x,y1:0,x2:I.x,y2:Lt,style:{stroke:Ie.borde,pointerEvents:"none"},strokeWidth:1,shapeRendering:"crispEdges"},`vsem-${te}`)),!Oe&&Ht.map((I,te)=>te>0?jsx("line",{x1:I.x,y1:0,x2:I.x,y2:O.length*a,stroke:t.borderLight,strokeWidth:1,shapeRendering:"crispEdges",opacity:t.neonRedGlow?1:.1},`vgrid-${te}`):null),Ht.map((I,te)=>{let Re=Ht[te+1]?.x||Le,Ee=r==="day"&&y&&he(I.date),_e=r==="day"&&!he(I.date)&&wt(I.date),it=Ee||_e;if(R&&it){let qe=Re-I.x;return jsxs("g",{"data-finde":"true",style:{pointerEvents:"none"},children:[jsx("rect",{x:I.x,y:0,width:qe,height:Lt,style:{fill:"var(--v6-finde, rgba(14,17,20,0.04))"}}),_e&&jsx("rect",{x:I.x,y:0,width:qe,height:Lt,fill:"url(#festivo-v6)"})]},`we-overlay-${te}`)}return it?jsxs("g",{"data-finde":"true",children:[jsx("rect",{x:I.x,y:0,width:Re-I.x,height:O.length*a,fill:(t.bgPrimary||"").charAt(1)==="0"?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",style:{pointerEvents:"none"}}),jsx("rect",{x:I.x,y:0,width:Re-I.x,height:O.length*a,fill:"url(#weekend-hatch)",style:{pointerEvents:"none"}})]},`we-overlay-${te}`):null}),O.map((I,te)=>{let Re=I.startDate&&I.endDate;return jsx("g",{children:!Re&&jsxs(Fragment,{children:[jsx("rect",{x:0,y:te*a,width:Le,height:a,fill:"transparent",style:{cursor:"pointer",pointerEvents:"all"},onClick:Ee=>Et(Ee,I),onMouseMove:Ee=>Pe(Ee,I,te),onMouseLeave:()=>{ut();}},`clickable-${I.id}`),tt&&tt.taskId===I.id&&jsxs("g",{style:{pointerEvents:"none"},children:[jsx("line",{x1:tt.x,y1:te*a+4,x2:tt.x,y2:te*a+a-4,stroke:t.accent,strokeWidth:2,opacity:.8}),jsx("circle",{cx:tt.x,cy:tt.y,r:8,fill:t.accent,opacity:.9}),jsx("circle",{cx:tt.x,cy:tt.y,r:4,fill:"white",opacity:.9}),jsxs("g",{transform:`translate(${tt.x}, ${te*a-8})`,children:[jsx("rect",{x:-40,y:-20,width:80,height:20,rx:4,fill:t.bgSecondary,stroke:t.border,strokeWidth:1}),jsx("text",{x:0,y:-6,textAnchor:"middle",fill:t.textPrimary,fontSize:"11",fontFamily:"Inter, sans-serif",fontWeight:"500",children:tt.date.toLocaleDateString(i==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})})]})]}),(!tt||tt.taskId!==I.id)&&jsx("text",{x:Zt>0?Zt:100,y:te*a+a/2,fill:t.textTertiary,fontSize:"12",fontFamily:"Inter, sans-serif",fontStyle:"italic",dominantBaseline:"middle",opacity:.4,style:{pointerEvents:"none",userSelect:"none"},children:le.labels.clickToSetDates},`placeholder-${I.id}`)]})},`row-group-${I.id}`)}),O.map((I,te)=>{if(!I.startDate||!I.endDate)return null;let{x:Re,width:Ee}=re(I),_e=te*a+(a-ve)/2,it=I.subtasks&&I.subtasks.length>0&&!I.isMilestone;if(I.isMilestone){let qe=((I.endDate.getTime()-n.getTime())/864e5+.5)*Y*o;return jsx(lc,{task:I,x:qe,y:_e+ve/2-16,theme:t,locale:i,onClick:p},I.id)}if(it&&R){let qe=te*a+a/2,Ze=N?.izq??-1/0,Ct=Re<Ze&&Re+Ee>Ze,At=Ct?Ze+18:Re,It=Re+Ee,Ke=(I.progress??0)<100&&I.endDate.getTime()<new Date(new Date().toDateString()).getTime();return jsxs("g",{"data-barra-resumen":"true","data-estado":(I.progress??0)>=100?"completed":Ke?"overdue":"planned",onClick:()=>p?.(I),onContextMenu:Fe=>{Fe.preventDefault(),Fe.stopPropagation(),m?.(I,Fe);},onMouseMove:Fe=>Wt({task:I,x:Re,y:qe-2,width:Ee,height:4,showBelow:qe<100,mouseX:Fe.clientX,mouseY:Fe.clientY}),onMouseLeave:()=>Wt(null),style:{cursor:"default",opacity:h&&!I.isCriticalPath?.25:1,transition:"opacity 300ms ease"},children:[jsx("rect",{x:Re,y:te*a,width:Ee,height:a,fill:"transparent",style:{pointerEvents:"all"}}),Ct&&jsx("path",{d:`M ${Ze+11} ${qe-4} l -4 4 l 4 4`,fill:"none",stroke:"var(--v6-texto-2, #4D5761)",strokeWidth:2.2,strokeLinecap:"round",strokeLinejoin:"round"}),It-2>At&&jsx("rect",{x:At,y:qe-2,width:It-2-At,height:4,rx:2,"data-parte":"pista",fill:"var(--v6-grupo, #8A939C)"}),jsx("rect",{x:It-2,y:qe-5,width:2,height:10,rx:1,"data-parte":"remate",fill:"var(--v6-grupo-remate, #3A434C)"}),h&&I.isCriticalPath&&jsx("rect",{x:At,y:qe-3,width:Math.max(0,It-At),height:6,rx:3,fill:"none",stroke:"var(--v6-rojo-punto, #D13A40)",strokeWidth:1.5,style:{pointerEvents:"none"}}),jsx("text",{x:It+6,y:qe,dominantBaseline:"middle",fill:"var(--v6-tenue, #5F6972)",fontSize:11,fontFamily:"'JetBrains Mono', ui-monospace, monospace",style:{fontVariantNumeric:"tabular-nums",pointerEvents:"none",userSelect:"none"},children:`${ce(I)} d`})]},I.id)}if(it){let qe=!t.bgPrimary||t.bgPrimary.startsWith("#0")||t.bgPrimary.startsWith("#1"),Ze=8,Ct=_e+(a-18)/2+(18-Ze)/2,At=4,It=I.progress||0,Ke=new Date;Ke.setHours(0,0,0,0);let Fe=I.startDate&&Ke>=I.startDate,ft=I.endDate&&(()=>{let P=new Date(I.endDate);return P.setHours(0,0,0,0),Ke>P})(),_a=I.startDate&&Ke<I.startDate,ma=1;if(Fe&&I.startDate&&I.endDate&&!_a){let P=new Date(I.startDate);P.setHours(0,0,0,0);let z=new Date(I.endDate);z.setHours(0,0,0,0);let j=Math.max(1,(z.getTime()-P.getTime())/(1e3*60*60*24)),be=Math.min((Ke.getTime()-P.getTime())/(1e3*60*60*24),j)/j*100;ma=be>0?It/be:1;}let ta;It>=100?ta="#00E5CC":_a?ta="#4B5563":ft&&It<100?ta="#EF4444":ma>=.95?ta="#22C55E":ma>=.8?ta="#F59E0B":ta="#EF4444";let de=Math.max(It/100*Ee,It>0?At*2:0),G=Ee>100&&It>0,X=I.isCriticalPath;return jsxs("g",{onClick:()=>p?.(I),onContextMenu:P=>{P.preventDefault(),P.stopPropagation(),m?.(I,P);},onMouseMove:P=>{Wt({task:I,x:Re,y:Ct,width:Ee,height:Ze,showBelow:Ct<100,mouseX:P.clientX,mouseY:P.clientY});},onMouseLeave:()=>Wt(null),style:{cursor:"default",opacity:h?X?1:.25:1,transition:"opacity 300ms ease"},"data-barra-resumen":"true","data-estado":It>=100?"completed":ft?"overdue":"planned",children:[jsx("rect",{x:Re,y:_e,width:Ee,height:a,fill:"transparent",style:{pointerEvents:"all"}}),jsx("rect",{x:Re,y:Ct,width:Ee,height:Ze,rx:At,fill:qe?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.08)","data-parte":"pista"}),It>0&&jsx("rect",{x:Re,y:Ct,width:de,height:Ze,rx:At,fill:ta,"data-parte":"avance"}),h&&X&&jsx("rect",{x:Re,y:Ct,width:Ee,height:Ze,rx:At,fill:"none",stroke:"#EF4444",strokeWidth:2,style:{pointerEvents:"none",filter:"drop-shadow(0 0 6px rgba(239, 68, 68, 0.4))"}}),G&&jsxs("text",{x:Re+de+6,y:Ct+Ze/2,dominantBaseline:"central",fill:qe?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.55)",fontSize:"9",fontWeight:"700",fontFamily:"'JetBrains Mono', monospace",style:{pointerEvents:"none",userSelect:"none"},children:[Math.round(It),"%"]})]},I.id)}return jsx(rc,{task:I,x:Re,y:_e,width:Ee,theme:t,dayWidth:Y*o,startDate:n,templates:c,onClick:p,onDoubleClick:d,onContextMenu:m,onDateChange:f,onDependencyCreate:v,allTaskPositions:we,onDragMove:ot,onHoverChange:Wt,showBaseline:w,showTaskBarLabels:u,showCriticalPath:h,readOnly:M?!M(I):false,onProgressChange:H,v6:R,alturaBarra:ve,duracionV6:R?`${ce(I)} d`:void 0},I.id)}),x&&O.map((I,te)=>{let Re=ws(I);return Re.length===0||!I.startDate||!I.endDate?null:Re.map(({id:Ee,type:_e,lag:it})=>{let qe=O.find(z=>z.id===Ee);if(!qe||!qe.startDate||!qe.endDate)return null;let Ze=O.findIndex(z=>z.id===Ee),Ct=mt(qe.id,re(qe)),At=mt(I.id,re(I)),It=_e==="SS"||_e==="SF",Ke=_e==="FF"||_e==="SF",Fe=It?Ct.x:Ct.x+Ct.width,ft=R?Ze*a+a/2:Ze*a+26,_a=Ke?At.x+At.width:At.x,ma=R?te*a+a/2:te*a+26,ta=`dep-${Ee}-${I.id}`;if(Tt.has(ta))return null;let de=h&&I.isCriticalPath&&qe.isCriticalPath,G=Qe.has(`${Ee}>${I.id}`);return jsx(_i,{x1:Fe,y1:ft,x2:_a,y2:ma,theme:t,lineStyle:l,colorOverride:(G?"#EF4444":h?de?"#EF4444":"rgba(255,255,255,0.10)":void 0)??(R?"var(--v6-dependencia, #8A939C)":void 0),strokeWidthOverride:(h?de?2:1:void 0)??(R?1:void 0),glowFilter:de?"drop-shadow(0 0 4px rgba(239, 68, 68, 0.3))":void 0,salidaPorInicio:It,entradaPorFin:Ke,etiqueta:G?`\u26A0 ${V0(_e,it,i)??""}`.trim():V0(_e,it,i),onDelete:()=>b?.(I.id,Ee),onHoverChange:z=>{ct.current=z,z&&Xe({key:ta,fromId:Ee,toId:I.id,exitX:Fe,exitY:ft,enterX:_a,enterY:ma,salidaPorInicio:It,entradaPorFin:Ke});}},ta)})}),pe.map(I=>jsxs("g",{style:{pointerEvents:"none"},children:[jsx("rect",{x:I.previewX,y:I.y-q,width:I.width,height:18,rx:6,fill:I.color||t.accent,opacity:.15,stroke:t.accent,strokeWidth:1,strokeDasharray:"4 3"}),Math.abs(I.daysDelta)>0&&jsx("text",{x:I.previewX+I.width/2,y:I.y-q+9,textAnchor:"middle",dominantBaseline:"middle",fill:t.accent,fontSize:"10",fontWeight:"600",fontFamily:"Inter, sans-serif",style:{userSelect:"none"},children:I.daysDelta>0?`+${I.daysDelta}d`:`${I.daysDelta}d`})]},`cascade-preview-${I.taskId}`)),x&&et&&jsx(_i,{x1:et.exitX,y1:et.exitY,x2:et.enterX,y2:et.enterY,theme:t,lineStyle:l,salidaPorInicio:et.salidaPorInicio,entradaPorFin:et.entradaPorFin,onDelete:()=>{let I=et.key;Xe(null),ct.current=false,_t(te=>new Set(te).add(I)),b?.(et.toId,et.fromId);},hoverOverlayOnly:true,onHoverChange:I=>{ct.current=I,I||Xe(null);}},`${et.key}-hover-overlay`),Zt>=0&&Zt<=Le&&jsxs("g",{"data-hoy":"linea",style:{pointerEvents:"none"},children:[t.neonRedGlow&&!R&&jsx("line",{x1:Zt,y1:0,x2:Zt,y2:Lt,stroke:t.today,strokeWidth:6,opacity:.15}),jsx("line",{x1:Zt,y1:0,x2:Zt,y2:Lt,stroke:t.today,strokeWidth:1,opacity:1})]}),[{fecha:S,clave:"planeado",texto:i==="es"?"Fin planeado":"Planned end",color:t.textTertiary||"#94A3B8"},{fecha:V,clave:"previsto",texto:i==="es"?"Fin previsto":"Expected end",color:"#F59E0B"}].map((I,te,Re)=>{if(!I.fecha)return null;let Ee=((I.fecha.getTime()-n.getTime())/(1e3*60*60*24)+1)*Y*o;if(Ee<0||Ee>Le)return null;let _e=Re[0]?.fecha,qe=4+(te===1&&!!_e&&Math.abs(_e.getTime()-I.fecha.getTime())<864e5?16:0);return R?jsx("g",{"data-fin":I.clave,style:{pointerEvents:"none"},children:jsx("line",{x1:Ee,y1:0,x2:Ee,y2:Lt,style:{stroke:I.clave==="previsto"?Ie.tenue:"var(--v6-separador, #CDD2D8)"},strokeWidth:1,strokeDasharray:"4 3"})},I.clave):jsxs("g",{"data-fin":I.clave,style:{pointerEvents:"none"},children:[jsx("line",{x1:Ee,y1:0,x2:Ee,y2:Lt,stroke:I.color,strokeWidth:1.5,strokeDasharray:"5 4",opacity:.9}),jsx("rect",{x:Ee+3,y:qe,width:I.texto.length*5.6+10,height:14,rx:3,fill:t.bgPrimary||"#0F1115",opacity:.9}),jsx("text",{x:Ee+8,y:qe+10,fontSize:9,fontWeight:600,fill:I.color,style:{fontFamily:"Inter, sans-serif"},children:I.texto})]},I.clave)}),N&&O.map((I,te)=>{if(!I.startDate||!I.endDate)return null;let Re=re(I),Ee=z0(Re.x,Re.x+Re.width,N.izq,N.der);if(!Ee)return null;let _e=Ee==="left"?I.endDate:I.startDate,it=Ee==="left"?`\u25C0 ${_e.toLocaleDateString(i,{day:"numeric",month:"short"})}`:`${_e.toLocaleDateString(i,{day:"numeric",month:"short"})} \u25B6`,qe=it.length*5.8+10,Ze=Ee==="left"?N.izq+4:N.der-qe-4,Ct=te*a+a/2-8;if(R){let At=I.status!=="completed"&&(I.progress??0)<100&&I.endDate.getTime()<new Date(new Date().toDateString()).getTime(),It=Ee==="left"?`\u2039 ${_e.toLocaleDateString(i,{day:"numeric",month:"short"}).replace(".","")}`:`${_e.toLocaleDateString(i,{day:"numeric",month:"short"}).replace(".","")} \u203A`,Ke=It.length*6.6+16,Fe=Ee==="left"?N.izq+4:N.der-Ke-4,ft=te*a+a/2-11;return jsxs("g",{"data-fuera-de-vista":Ee,"data-vencida":At||void 0,role:"button",style:{cursor:D?"pointer":"default"},onClick:()=>D?.(I.startDate),children:[jsx("title",{children:i==="es"?`Ir a \xAB${I.name}\xBB${At?`, venci\xF3 el ${_e.toLocaleDateString(i,{day:"numeric",month:"short"})}`:""}`:`Go to "${I.name}"`}),jsx("rect",{x:Fe,y:ft,width:Ke,height:22,rx:6,strokeWidth:1,style:{fill:At?"var(--v6-rojo-fondo, #FBE9EA)":Ie.tarjeta,stroke:At?"var(--v6-rojo-borde, rgba(192,48,58,0.75))":Ie.borde}}),jsx("text",{x:Fe+Ke/2,y:ft+11.5,textAnchor:"middle",dominantBaseline:"middle",style:{fill:At?"var(--v6-rojo, #B02A33)":Ie.texto2,fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', ui-monospace, monospace"},children:It})]},`fuera-${I.id}`)}return jsxs("g",{"data-fuera-de-vista":Ee,style:{cursor:D?"pointer":"default"},onClick:()=>D?.(I.startDate),children:[jsx("title",{children:i==="es"?`\xAB${I.name}\xBB est\xE1 fuera de la vista: clic para ir`:`"${I.name}" is out of view: click to go`}),jsx("rect",{x:Ze,y:Ct,width:qe,height:16,rx:8,fill:t.bgSecondary||"#1A1D21",stroke:t.border||"rgba(148,163,184,0.4)",strokeWidth:1,opacity:.95}),jsx("text",{x:Ze+qe/2,y:Ct+11.5,fontSize:9.5,textAnchor:"middle",fill:t.textSecondary||"#94A3B8",style:{fontFamily:"Inter, sans-serif"},children:it})]},`fuera-${I.id}`)})]}),R&&(()=>{let I=[V&&{clave:"previsto",fecha:V,texto:i==="es"?"Fin previsto":"Forecast finish"},S&&(!V||Math.abs(S.getTime()-V.getTime())>=864e5)&&{clave:"planeado",fecha:S,texto:i==="es"?"Fin planeado":"Planned finish"}].filter(Boolean);return I.length===0?null:jsx("div",{"aria-hidden":false,style:{position:"sticky",bottom:8,height:0,zIndex:6,pointerEvents:"none"},children:I.map((te,Re)=>{let Ee=((te.fecha.getTime()-n.getTime())/864e5+1)*Y*o;return Ee<0||Ee>Le?null:jsxs("div",{"data-bandera-fin":te.clave,style:{position:"absolute",bottom:Re*28,left:Ee-8,transform:"translateX(-100%)",display:"flex",alignItems:"center",gap:6,padding:"3px 9px 3px 7px",border:"1px solid var(--v6-separador, #CDD2D8)",borderRadius:999,background:Ie.tarjeta,color:Ie.texto2,fontSize:11,fontWeight:500,whiteSpace:"nowrap"},children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("path",{d:"M4 22v-7"})]}),te.texto," \xB7 ",te.fecha.toLocaleDateString(i,{day:"numeric",month:"short"}).replace(".","")]},te.clave)})})})(),fe&&jsx($0,{tooltipData:fe,theme:t,locale:i==="es"?"es":"en",workingDaysConfig:E})]})}var hk=['Move "Task Name" to next Monday','Extend "Task Name" by 3 days','Rename "Old Name" to "New Name"','Set "Task Name" progress to 50%','Link "Task A" to "Task B"','Create a new task called "New Task"','Delete "Task Name"','Assign John to "Task Name"'],G0=({size:e=16})=>jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M12 2l2.4 7.2L22 12l-7.6 2.8L12 22l-2.4-7.2L2 12l7.6-2.8L12 2z"})}),yk=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13"})}),xk=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M18 6L6 18M6 6L18 18"})}),vk=()=>jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("path",{d:"M5 12h14"})}),wk=()=>jsx("div",{className:"flex gap-1 items-center",children:[0,1,2].map(e=>jsx(motion.div,{className:"w-2 h-2 rounded-full bg-current",animate:{scale:[1,1.2,1],opacity:[.5,1,.5]},transition:{duration:.8,repeat:1/0,delay:e*.15}},e))});function hc({tasks:e,theme:t,config:a,onTasksUpdate:r,onTaskUpdate:n,onTaskCreate:s,onTaskDelete:o,onDependencyCreate:i,onDependencyDelete:c}){let[l,u]=useState(false),[p,d]=useState(false),[m,f]=useState([]),[v,b]=useState(""),[w,h]=useState(false),[x,y]=useState(true),[k,M]=useState(""),[H,E]=useState(-1),[N,D]=useState(false),[S,V]=useState(0),W=useRef(null),R=useRef(null),A=useRef(null),ve=useRef(null),{enabled:q=true,placeholder:le='Ask AI to edit tasks... (e.g., "Move Design to next week")',position:B="bottom-right",onCommand:pe,suggestions:nt=hk,maxHistory:Ue=50,persistHistory:$,mentionableUsers:fe=[]}=a,ie=t.bgPrimary==="#050505"||t.bgPrimary==="#0a0a0a"||t.textPrimary==="#FFFFFF",et=ie?"rgba(10, 10, 10, 0.75)":"rgba(255, 255, 255, 0.85)",Xe=ie?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.25)",Qe=ie?"0 0 20px rgba(0, 229, 204, 0.08), 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(0, 229, 204, 0.04)":"0 0 20px rgba(0, 229, 204, 0.06), 0 4px 12px rgba(0, 0, 0, 0.08)",ct=ie?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Tt=ie?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",_t=ie?"rgba(10, 10, 10, 0.85)":"rgba(255, 255, 255, 0.95)",tt=ie?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.2)",xt=ie?"rgba(0, 229, 204, 0.9)":"#00E5CC",Jt=ie?"rgba(10, 10, 10, 0.92)":"rgba(255, 255, 255, 0.95)",Wt=ie?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",Qt=ie?"0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 229, 204, 0.04), inset 0 1px 0 rgba(255,255,255,0.03)":"0 20px 60px rgba(0, 0, 0, 0.1), 0 0 20px rgba(0, 229, 204, 0.04)",Y=ie?"rgba(0, 229, 204, 0.04)":"rgba(0, 229, 204, 0.03)",Le=ie?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.08)",Ye=ie?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",he=ie?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",dt=ie?"rgba(255, 255, 255, 0.85)":"rgba(0, 0, 0, 0.85)",wt=ie?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",ue=ie?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)",ce=ie?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",Ae=ie?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",Et="rgba(0, 229, 204, 0.04)",Pe=ie?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.12)",ut=ie?"rgba(255,255,255,0.5)":"rgba(0,0,0,0.5)",O=ie?"rgba(0, 229, 204, 0.25)":"rgba(0, 229, 204, 0.3)",re=ie?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",we=ie?"rgba(0, 229, 204, 0.15)":"rgba(0, 229, 204, 0.12)",ot=ie?"rgba(255, 255, 255, 0.04)":"rgba(0, 0, 0, 0.03)",mt=ie?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.06)",Ht=ie?"rgba(255,255,255,0.8)":"rgba(0,0,0,0.8)",Zt="rgba(0, 229, 204, 0.06)",Oe=ie?"rgba(255, 255, 255, 0.03)":"rgba(0, 0, 0, 0.02)",Wa=ie?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.1)",la=ie?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",da=ie?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",ke=ie?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",Te=ie?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.2)",gt=ie?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)",Ie=ie?"rgba(15, 15, 15, 0.95)":"rgba(255, 255, 255, 0.98)",Lt=ie?"rgba(0, 229, 204, 0.1)":"rgba(0, 229, 204, 0.15)",I=ie?"0 -4px 20px rgba(0, 0, 0, 0.4)":"0 -4px 20px rgba(0, 0, 0, 0.08)",te=ie?"rgba(0, 229, 204, 0.08)":"rgba(0, 229, 204, 0.06)",Re=ie?"rgba(255,255,255,0.85)":"rgba(0,0,0,0.85)",Ee=ie?"rgba(255,255,255,0.35)":"rgba(0,0,0,0.4)",_e=ie?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)",it=ie?"rgba(0, 229, 204, 0.2)":"rgba(0, 229, 204, 0.15)",qe=$?.storageKey||"gantt-ai-history",Ze=$?.maxMessages??5,Ct=fe.filter(de=>{if(!k)return true;let G=k.toLowerCase();return de.name.toLowerCase().includes(G)||de.email&&de.email.toLowerCase().includes(G)}).slice(0,5),At=useCallback(de=>{if(b(de),fe.length===0)return;let G=W.current;if(!G)return;let X=G.selectionStart||de.length,F=de.slice(0,X),P=F.lastIndexOf("@");if(P>=0&&((P>0?F[P-1]:" ")===" "||P===0)){let j=F.slice(P+1);if(j.length<=40){M(j),E(P),D(true),V(0);return}}D(false),M(""),E(-1);},[fe.length]),It=useCallback(de=>{let G=v.slice(0,H),X=v.slice(H+1+k.length),F=`${G}@${de.name} ${X}`;b(F),D(false),M(""),E(-1),setTimeout(()=>W.current?.focus(),0);},[v,H,k]),Ke=useCallback(de=>{if(!N||Ct.length===0)return false;if(de.key==="ArrowDown")return de.preventDefault(),V(G=>G<Ct.length-1?G+1:0),true;if(de.key==="ArrowUp")return de.preventDefault(),V(G=>G>0?G-1:Ct.length-1),true;if(de.key==="Enter"||de.key==="Tab"){de.preventDefault();let G=Ct[S];return G&&It(G),true}return de.key==="Escape"?(D(false),true):false},[N,Ct,S,It]);useEffect(()=>{if($?.enabled)try{let de=localStorage.getItem(qe);if(de){let X=JSON.parse(de).map(F=>({...F,timestamp:new Date(F.timestamp)}));f(X.slice(-Ze));}}catch(de){console.warn("[GanttAIAssistant] Failed to load persisted history:",de);}},[$?.enabled,qe,Ze]),useEffect(()=>{if($?.enabled&&m.length>0)try{let de=m.filter(G=>!G.isLoading).slice(-Ze);localStorage.setItem(qe,JSON.stringify(de));}catch(de){console.warn("[GanttAIAssistant] Failed to persist history:",de);}},[m,$?.enabled,qe,Ze]),useEffect(()=>{R.current&&R.current.scrollIntoView({behavior:"smooth"});},[m]),useEffect(()=>{l&&!p&&W.current&&setTimeout(()=>W.current?.focus(),100);},[l,p]);let Fe=useCallback(de=>{if(de.success)switch(de.type){case "move_task":case "resize_task":case "rename_task":case "set_progress":case "set_status":case "assign_task":de.taskId&&de.updates&&n?.(de.taskId,de.updates);break;case "create_task":de.newTask&&s?.(de.newTask);break;case "delete_task":de.taskId&&o?.(de.taskId);break;case "link_tasks":de.dependencyFrom&&de.dependencyTo&&i?.(de.dependencyFrom,de.dependencyTo);break;case "unlink_tasks":de.taskId&&de.dependencyFrom&&c?.(de.taskId,de.dependencyFrom);break}},[n,s,o,i,c]),ft=useCallback(async de=>{if(!de.trim()||w)return;let G={id:`user-${Date.now()}`,role:"user",content:de,timestamp:new Date};f(F=>[...F.slice(-(Ue-1)),G]),b(""),y(false),h(true);let X={id:`loading-${Date.now()}`,role:"assistant",content:"",timestamp:new Date,isLoading:true};f(F=>[...F,X]);try{if(pe){let F=m.filter(z=>!z.isLoading&&z.content).slice(-6).map(z=>({role:z.role,content:z.content})),P=await pe(de,e,F);f(z=>{let j=z.filter(be=>!be.isLoading),J={id:`assistant-${Date.now()}`,role:"assistant",content:P.message,timestamp:new Date,command:P};return [...j,J]}),Fe(P);}else f(F=>[...F.filter(z=>!z.isLoading),{id:`assistant-${Date.now()}`,role:"assistant",content:"AI handler not configured. Please provide an onCommand handler in the aiAssistant config.",timestamp:new Date}]);}catch(F){f(P=>[...P.filter(j=>!j.isLoading),{id:`error-${Date.now()}`,role:"assistant",content:`Sorry, I encountered an error: ${F instanceof Error?F.message:"Unknown error"}`,timestamp:new Date}]);}finally{h(false);}},[w,Ue,pe,e,Fe]),_a=de=>{de.preventDefault(),ft(v);},ma=de=>{b(de),W.current?.focus();};if(useEffect(()=>{let de=G=>{(G.metaKey||G.ctrlKey)&&G.key==="k"&&(G.preventDefault(),u(X=>!X),l||d(false)),G.key==="Escape"&&l&&u(false);};return document.addEventListener("keydown",de),()=>document.removeEventListener("keydown",de)},[l]),useEffect(()=>{if(!l)return;let de=X=>{let F=X.target;A.current&&!A.current.contains(F)&&u(false);},G=setTimeout(()=>{document.addEventListener("mousedown",de);},100);return ()=>{clearTimeout(G),document.removeEventListener("mousedown",de);}},[l]),!q)return null;let ta={"bottom-right":"bottom-4 right-4","bottom-left":"bottom-4 left-4","top-right":"top-4 right-4","top-left":"top-4 left-4"};return jsxs(Pa,{children:[jsx(AnimatePresence,{children:!l&&jsxs(motion.button,{initial:{scale:0,opacity:0,rotate:-180},animate:{scale:1,opacity:1,rotate:0},exit:{scale:0,opacity:0,rotate:180},transition:{type:"spring",damping:20,stiffness:260},whileHover:{scale:1.12},whileTap:{scale:.9},className:`fixed ${ta[B]} z-[99999] group`,style:{width:44,height:44,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:et,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:`1px solid ${Xe}`,color:"#00E5CC",cursor:"pointer",boxShadow:Qe,overflow:"visible"},onClick:()=>u(true),children:[jsx("span",{style:{position:"absolute",inset:-3,borderRadius:"50%",border:`1px solid ${ct}`,animation:"ai-fab-pulse 3s ease-in-out infinite",pointerEvents:"none"}}),jsx("span",{style:{position:"absolute",inset:-6,borderRadius:"50%",border:`1px solid ${Tt}`,animation:"ai-fab-pulse 3s ease-in-out infinite 1.5s",pointerEvents:"none"}}),jsx(G0,{size:18}),jsx("span",{className:"pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity duration-200",style:{position:"absolute",right:"100%",marginRight:10,whiteSpace:"nowrap",fontSize:11,fontWeight:500,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.05em",textTransform:"uppercase",color:xt,background:_t,backdropFilter:"blur(8px)",padding:"4px 10px",borderRadius:6,border:`1px solid ${tt}`},children:"AI \xB7 \u2318K"}),jsx("style",{children:`
|
|
362
362
|
@keyframes ai-fab-pulse {
|
|
363
363
|
0%, 100% { transform: scale(1); opacity: 0.4; }
|
|
364
364
|
50% { transform: scale(1.15); opacity: 0; }
|
|
365
365
|
}
|
|
366
|
-
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:u?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ce[R]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Ie,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${zt}`,boxShadow:st},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:bt,borderBottom:`1px solid ${Ee}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Dt,border:`1px solid ${ht}`,color:"#00E5CC"},children:jsx(yg,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:_e},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>d(B=>!B),className:"p-1.5 rounded-lg transition-colors",style:{color:dt},onMouseEnter:B=>{B.currentTarget.style.background=J,B.currentTarget.style.color=L;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=dt;},children:jsx(Iw,{})}),jsx("button",{onClick:()=>p(false),className:"p-1.5 rounded-lg transition-colors",style:{color:dt},onMouseEnter:B=>{B.currentTarget.style.background=J,B.currentTarget.style.color=L;},onMouseLeave:B=>{B.currentTarget.style.background="transparent",B.currentTarget.style.color=dt;},children:jsx(Aw,{})})]})]}),jsx(AnimatePresence,{children:!u&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[m.length===0&&x&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:xe,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:G.slice(0,4).map((B,re)=>jsx("button",{onClick:()=>pe(B),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:I,color:ke,border:`1px solid ${j}`},onMouseEnter:be=>{be.currentTarget.style.borderColor=Ue,be.currentTarget.style.color="#00E5CC";},onMouseLeave:be=>{be.currentTarget.style.borderColor=j,be.currentTarget.style.color=ke;},children:B.length>30?B.slice(0,30)+"...":B},re))})]}),m.map(B=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${B.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${B.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:B.role==="user"?ue:yt,color:B.role==="user"?"#00E5CC":vt,border:B.role==="user"?`1px solid ${at}`:`1px solid ${Ye}`},children:[B.isLoading?jsx(Rw,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:B.content}),B.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:B.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:B.command.success?"#10B981":"#EF4444",border:`1px solid ${B.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[B.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:B.command.type.replace(/_/g," ")})]})]})},B.id)),jsx("div",{ref:Y})]}),jsxs("form",{onSubmit:B=>{if(D&&dr.length>0){B.preventDefault();return}q(B);},className:"p-3 relative",style:{borderTop:`1px solid ${Xt}`},children:[jsx(AnimatePresence,{children:D&&dr.length>0&&jsx(motion.div,{ref:Se,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Tt,border:`1px solid ${Ft}`,boxShadow:kt,backdropFilter:"blur(12px)"},children:dr.map((B,re)=>jsxs("button",{type:"button",onClick:()=>Ra(B),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:re===N?Da:"transparent",color:aa},onMouseEnter:()=>z(re),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:Xe,border:`1px solid ${et}`,color:"#00E5CC"},children:B.name.split(" ").map(be=>be[0]).join("").slice(0,2).toUpperCase()}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:B.name}),B.email&&jsx("div",{className:"text-xs truncate",style:{color:cr},children:B.email})]})]},B.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:wt,border:`1px solid ${Ut}`},children:[jsx("input",{ref:$,type:"text",value:v,onChange:B=>xr(B.target.value),onKeyDown:B=>{Ja(B);},placeholder:Ce,disabled:h,className:"flex-1 bg-transparent text-sm outline-none",style:{color:Ht,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||h,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?he:"transparent",color:v.trim()?"#00E5CC":Qe,border:v.trim()?`1px solid ${Fe}`:"1px solid transparent"},children:jsx(Lw,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:rt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function xg(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((l,p=true)=>{r(u=>{let d=typeof l=="function"?l(u.present):l;if(n.current)return {...u,present:d};if(!p)return {...u,present:d};let m=[...u.past,u.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let p=l.past[l.past.length-1],u=l.past.slice(0,l.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:u,present:p,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let p=l.future[0],u=l.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...l.past,l.present],present:p,future:u}});},[]),c=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function vg({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!i&&c&&o.key==="y"){o.preventDefault(),t();return}if(i&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var Hw={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${Me.formatDate(e.startDate)} - ${Me.formatDate(e.endDate)}`);let a=Me.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>Me.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function wg(e){return {...Hw,...e}}var Kw=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Dg=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,onExportSuccess:p,projectName:u,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:b,persistColumns:h,clearFiltersKey:y,aiAssistant:x,locale:w="en",customTranslations:C,showCreateTaskButton:P=false,createTaskLabel:O,onCreateTask:T,taskFilter:D,onTaskFilterChange:M,toolbarRightContent:N,toolbarContainer:z,hideWbsLevel:$,showBaseline:Y,viewMode:A,onViewModeChange:Se,projectForecast:W,hideForecastHud:Ce,onThemeChange:R,onTaskClick:we,onTaskSelectionChange:G,selectedTaskId:Ve,onTaskDblClick:oe,onTaskContextMenu:Be,onTaskUpdate:le,onDependentTasksScheduled:He,onProgressChange:$e,onTaskEdit:Pe,onTaskAddSubtask:je,onTaskMarkIncomplete:tt,onTaskSetInProgress:ee,onDependencyCreate:Ae,onDependencyDelete:ot,onBeforeTaskAdd:Ie,onAfterTaskAdd:zt,onBeforeTaskUpdate:st,onAfterTaskUpdate:bt,onBeforeTaskDelete:Ee,onAfterTaskDelete:Dt,permissions:ht,onCopySnapshotLink:_e}=a,L=useContext(pl)?.theme,[J,xe]=useState(L||s||"dark"),[I,j]=useState(o),[ke,Ue]=useState(i),[ue,at]=useState(1),[yt,Ye]=useState("all"),[vt,Xt]=useState(A||"execution"),wt=A??vt,Ut=useCallback(E=>{Xt(E),Se?.(E);},[Se]),Ht=Y??wt==="oracle",[he,Fe]=useState(a.showCriticalPath!==false),[Qe,rt]=useState(a.showDependencies!==false),[Tt,Ft]=useState(a.highlightWeekends!==false),kt=useCallback(E=>{Fe(E),a.onShowCriticalPathChange?.(E);},[a.onShowCriticalPathChange]),Da=useCallback(E=>{rt(E),a.onShowDependenciesChange?.(E);},[a.onShowDependenciesChange]),aa=useCallback(E=>{Ft(E),a.onHighlightWeekendsChange?.(E);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(I);},[I]),useEffect(()=>{a.onZoomChange?.(ue);},[ue]);let cr=useRef(a.onDateRangeChange);cr.current=a.onDateRangeChange;let Xe=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[et,Sa]=useState(()=>{if(!b)return "all";try{let E=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(E);if(F){let U=JSON.parse(F);if(U.taskFilter)return U.taskFilter}}catch(E){console.warn("[GanttBoard] Error loading filter state from localStorage:",E);}return "all"}),Ia=D??et,dr=M??Sa,[xr,Ra]=useState(()=>{if(!b)return false;try{let E=typeof b=="string"?b:"gantt-filter-state",F=localStorage.getItem(E);if(F){let U=JSON.parse(F);if(typeof U.hideCompleted=="boolean")return U.hideCompleted}}catch(E){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",E);}return false});useEffect(()=>{let E=Xe();if(E)try{let F={taskFilter:Ia,hideCompleted:xr};localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving filter state to localStorage:",F);}},[Ia,xr,Xe]);let Ja=useRef(y);useEffect(()=>{if(Ja.current!==y&&y!==void 0){Sa("all"),Ra(false);let E=Xe();if(E)try{localStorage.removeItem(E);}catch(F){console.warn("[GanttBoard] Error clearing filter state from localStorage:",F);}}Ja.current=y;},[y,Xe]);let[se,me]=useState(0),[q,pe]=useState(false),[ce,B]=useState(null),[re,be]=useState({isOpen:false,x:0,y:0,task:null}),[S,H]=useState(null),[Z,Te]=useState(null);useEffect(()=>{L&&L!==J&&xe(L);},[L]),useEffect(()=>{s&&s!==J&&xe(s);},[s]);let gt=useCallback(E=>{xe(E),R?.(E);},[R]),{state:fe,setState:Ne,undo:ye,redo:lt,canUndo:Et,canRedo:Qt,clearHistory:ja}=xg(t,50),Er=useMemo(()=>{let E=(F,U=0)=>{let K=U;for(let ie of F)ie.subtasks?.length&&(K=Math.max(K,E(ie.subtasks,U+1)));return K};return E(fe)+1},[fe]),_a=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),Mr=useRef(new Map),xa=useRef(false);if(!xa.current&&v){xa.current=true;let E=typeof v=="string"?v:"gantt-expanded-tasks";try{let F=localStorage.getItem(E);if(F){let U=JSON.parse(F);Array.isArray(U)&&(Mr.current=new Map(U));}}catch(F){console.warn("[GanttBoard] Error loading expanded state from localStorage:",F);}}let On=useCallback(()=>{let E=_a();if(E)try{let F=Array.from(Mr.current.entries());localStorage.setItem(E,JSON.stringify(F));}catch(F){console.warn("[GanttBoard] Error saving expanded state to localStorage:",F);}},[_a]),Vr=useRef(0),Rs=useRef(fe);useEffect(()=>{Rs.current=fe;},[fe]);let Xr=useRef(false),Pi=useCallback(E=>{Ye(E),Vr.current+=1,Ne(F=>{let U=(ie,ge=0)=>ie.map(Ge=>{let ze=E==="all"||ge<E-1;return Ge.subtasks?.length&&Mr.current.set(Ge.id,ze),{...Ge,isExpanded:ze,subtasks:Ge.subtasks?U(Ge.subtasks,ge+1):void 0}}),K=U(F);return On(),K});},[Ne,On]);useEffect(()=>{if(Vr.current>0){Vr.current-=1;return}let E=U=>{let K=new Map;for(let ie of U){let ge=ie.id;K.get(ge)||K.set(ge,ie);}return Array.from(K.values())},F=U=>U.map(K=>{let ie=Mr.current.get(K.id),ge=ie!==void 0?{...K,isExpanded:ie}:K;if(ge.subtasks?.length){let Ge=E(ge.subtasks);return {...ge,subtasks:F(Ge)}}return ge});if(Mr.current.size>0)Ne(tn(F(t)));else {let U=K=>K.map(ie=>ie.subtasks?.length?{...ie,subtasks:E(U(ie.subtasks))}:ie);Ne(tn(U(t)));}},[t,Ne]);let Qo=useRef(t),Fi=useRef(true);useEffect(()=>{if(Fi.current){Fi.current=false,Qo.current=fe;return}if(Xr.current){Xr.current=false,Qo.current=fe;return}if(!r)return;let E=JSON.stringify(Qo.current),F=JSON.stringify(fe);E!==F&&(Qo.current=fe,r(fe));},[fe,r]);let Qa=useMemo(()=>bd(w,C),[w,C]),Bs=useCallback(E=>[{id:"name",label:E.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:E.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:E.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:E.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:E.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:E.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:E.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:E.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),eo=a.defaultVisibleColumns,$s=useCallback(E=>eo?E.map(F=>F.id==="name"?F:{...F,visible:eo.includes(F.id)}):E,[eo]),vr=useMemo(()=>h?typeof h=="string"?h:"gantt-columns-state":null,[h]),[Jr,Hn]=useState(()=>{let E=$s(Bs(Qa));if(!h)return E;try{let F=typeof h=="string"?h:"gantt-columns-state",U=localStorage.getItem(F);if(!U)return E;let K=JSON.parse(U),ie=new Map(K.map(ge=>[ge.id,ge]));return E.map(ge=>{let Ge=ie.get(ge.id);return Ge?{...ge,visible:Ge.visible??ge.visible,width:Ge.width??ge.width}:ge})}catch(F){return console.warn("[GanttBoard] Error loading columns state from localStorage:",F),E}}),Os=useRef(vr);useEffect(()=>{if(Os.current===vr)return;Os.current=vr;let E=$s(Bs(Qa));if(!vr){Hn(E);return}try{let F=localStorage.getItem(vr);if(!F){Hn(E);return}let U=JSON.parse(F),K=new Map(U.map(ie=>[ie.id,ie]));Hn(E.map(ie=>{let ge=K.get(ie.id);return ge?{...ie,visible:ge.visible??ie.visible,width:ge.width??ie.width}:ie}));}catch(F){console.warn("[GanttBoard] Error reloading columns state from localStorage:",F),Hn(E);}},[vr,Bs,Qa]),useEffect(()=>{if(vr&&Os.current===vr)try{let E=Jr.map(F=>({id:F.id,visible:F.visible,width:F.width}));localStorage.setItem(vr,JSON.stringify(E));}catch(E){console.warn("[GanttBoard] Error saving columns state to localStorage:",E);}},[Jr,vr]),useEffect(()=>{Hn(E=>E.map(F=>({...F,label:Qa.columns[F.id==="name"?"taskName":F.id]||F.label})));},[Qa]);let cn=useMemo(()=>Jr.filter(F=>F.visible).reduce((F,U)=>F+U.width,0),[Jr]),Hs=useRef(Jr.filter(E=>E.visible).map(E=>E.id).join(","));useEffect(()=>{let E=Jr.filter(K=>K.visible),F=E.map(K=>K.id).join(","),U=Hs.current;if(F!==U){let K=E.some(ge=>ge.id!=="name"),ie=U.includes(",");K?!ie&&K&&B(null):B(null),Hs.current=F;}},[Jr]);let Li=60,Un=.6,Ai=useMemo(()=>{let F=cn+Li,U=typeof window<"u"?window.innerWidth*Un:800,K=Math.max(F,U);return ce!==null?Math.max(200,Math.min(ce,K)):Math.max(200,F)},[ce,cn]),$r=useRef(null),Zo=useRef(null),wr=useRef(null),No=useRef(null),Do=useRef(null),oa=useMemo(()=>Om(J),[J]),dc=useMemo(()=>({theme:oa,themeName:J}),[oa,J]),Us=useMemo(()=>wg(m),[m]),es=useMemo(()=>{if(!f||!he)return fe;let E=Me.calculateCriticalPathFull(fe),F=U=>U.map(K=>{let ie=E.get(K.id),ge=K.subtasks?F(K.subtasks):void 0,Ge=ge?.some(It=>It.isCriticalPath||It.subtasks&&It.subtasks.some(Gt=>Gt.isCriticalPath))||false,ze=ie?ie.isCritical:Ge;return {...K,isCriticalPath:ze,cpmData:ie||void 0,subtasks:ge}});return F(fe)},[fe,f,he]),Ws=useMemo(()=>Me.flattenTasks(fe).some(F=>F.dependencies&&F.dependencies.length>0),[fe]),Wn=useMemo(()=>{let E=(F,U="")=>[...F].sort((ie,ge)=>(ie.position??0)-(ge.position??0)).map((ie,ge)=>{let Ge=ge+1,ze=U?`${U}.${Ge}`:`${Ge}.0`,It=U?`${U}.${Ge}`:`${Ge}`;return {...ie,wbsCode:ze,subtasks:ie.subtasks?.length?E(ie.subtasks,It):ie.subtasks}});return E(es)},[es]),k=(a.searchQuery??"").trim(),_=useMemo(()=>{let E=ie();if(!k)return E;let F=ge=>ge.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),U=F(k),K=ge=>{let Ge=[];for(let ze of ge){if(F(ze.name||"").includes(U)){Ge.push(ze);continue}let It=ze.subtasks?.length?K(ze.subtasks):[];It.length&&Ge.push({...ze,subtasks:It});}return Ge};return K(E);function ie(){if(Ia==="all"&&!xr)return Wn;let ge=Ge=>{let ze=[];for(let It of Ge){let Gt=It.subtasks?.length?ge(It.subtasks):void 0,qt=false;if(xr)qt=It.progress<100&&It.status!=="completed";else switch(Ia){case "all":qt=true;break;case "incomplete":qt=It.progress<100;break;case "in_progress":qt=It.progress>0&&It.progress<100;break;case "completed":qt=It.progress===100;break}(qt||Gt&&Gt.length>0)&&ze.push({...It,subtasks:Gt});}return ze};return ge(Wn)}},[Wn,Ia,xr,k]),X=Kw(ke);vg({undo:ye,redo:lt,canUndo:Et,canRedo:Qt,enabled:true});let ne=useRef(null),de=(E,F="start")=>{let U=wr.current,K=Do.current;if(!U||!K)return;let ie=(E.getTime()-K.startDate.getTime())/(1e3*60*60*24),ge=K.timeScale==="day"?60:K.timeScale==="week"?20:8,Ge=ie*ge*K.zoom,ze=F==="center"?Ge-U.clientWidth/2:Ge-ge*K.zoom*2;U.scrollTo({left:Math.max(0,ze),behavior:"auto"});};useImperativeHandle(n,()=>({getTask:E=>Me.findTaskById(fe,E),addTask:(E,F)=>{Ne(U=>{if(!F)return [...U,{...E,level:0}];let K=ie=>ie.map(ge=>ge.id===F?{...ge,subtasks:[...ge.subtasks||[],{...E,parentId:F,level:(ge.level||0)+1}],isExpanded:true}:ge.subtasks?{...ge,subtasks:K(ge.subtasks)}:ge);return K(U)});},updateTask:(E,F)=>{Ne(U=>{let K=ie=>ie.map(ge=>ge.id===E?{...ge,...F}:ge.subtasks?{...ge,subtasks:K(ge.subtasks)}:ge);return K(U)});},deleteTask:E=>{Ne(F=>{let U=K=>K.filter(ie=>ie.id===E?false:(ie.subtasks&&(ie.subtasks=U(ie.subtasks)),true));return U(F)});},deleteTasks:E=>{Ne(F=>Ed(F,E));},duplicateTask:E=>{if(a.onTaskDuplicate){let F=Me.findTaskById(fe,E);F&&a.onTaskDuplicate(F);}else Ne(F=>ci(F,[E]).tasks);},splitTask:(E,F,U=3)=>{Ne(K=>Me.splitTask(K,E,F,U));},calculateEndDate:Me.calculateEndDate,calculateDuration:Me.calculateDuration,validateDependency:(E,F)=>!Me.validateDependencies(fe,E,F),getAllTasks:()=>Me.flattenTasks(fe),getTasksByStatus:E=>Me.flattenTasks(fe).filter(F=>F.status===E),getTasksByParent:E=>E?Me.findTaskById(fe,E)?.subtasks||[]:fe.filter(U=>!U.parentId),getCriticalPath:()=>Me.flattenTasks(fe).filter(E=>E.isCriticalPath),indentTask:E=>{Ne(F=>tn(Nd(F,[E])));},outdentTask:E=>{Ne(F=>tn(Dd(F,[E])));},moveTask:(E,F)=>{Ne(U=>Sd(U,[E],F));},createSubtask:async E=>{let{tasks:F,newTask:U}=Fd(fe,E);if(Ie){let K=Ie({...U,parentId:E});if((K instanceof Promise?await K:K)===false)return}Ne(tn(F)),zt&&zt({...U,parentId:E});},scrollToTask:E=>{let U=Me.flattenTasks(fe).findIndex(K=>K.id===E);if(U!==-1&&$r.current){let K=U*X;$r.current.scrollTo({top:K,behavior:"smooth"}),wr.current&&wr.current.scrollTo({top:K,behavior:"smooth"});}},highlightTask:(E,F=2e3)=>{},expandTask:E=>{Ne(F=>{let U=K=>K.map(ie=>ie.id===E?{...ie,isExpanded:true}:ie.subtasks?{...ie,subtasks:U(ie.subtasks)}:ie);return U(F)});},collapseTask:E=>{Ne(F=>{let U=K=>K.map(ie=>ie.id===E?{...ie,isExpanded:false}:ie.subtasks?{...ie,subtasks:U(ie.subtasks)}:ie);return U(F)});},expandAll:()=>{Ne(E=>{let F=U=>U.map(K=>({...K,isExpanded:true,subtasks:K.subtasks?F(K.subtasks):void 0}));return F(E)});},collapseAll:()=>{Ne(E=>{let F=U=>U.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?F(K.subtasks):void 0}));return F(E)});},collapseToLevel:E=>{Pi(E);},undo:ye,redo:lt,canUndo:()=>Et,canRedo:()=>Qt,clearHistory:ja,exportToPNG:async()=>{if(!No.current||!$r.current||!wr.current)throw new Error("Gantt container not found");let E=No.current,F=$r.current,U=Zo.current||F.querySelector(".gantt-grid-scroll"),K=wr.current,ie=U?.scrollTop||0,ge=K.scrollTop,Ge=E.style.overflow,ze=E.style.height,It=F.style.overflow;try{let Gt=U?.querySelector(".gantt-taskgrid-content"),qt=K.querySelector("svg"),br=Gt?.scrollHeight||U?.scrollHeight||600,jr=qt?.getBoundingClientRect().height||K.scrollHeight,So=(E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(br,jr)+20;U&&(U.scrollTop=0),K.scrollTop=0,E.style.overflow="visible",E.style.height=`${So}px`,F.style.overflow="visible",await new Promise(ns=>setTimeout(ns,100));let En=await toPng(E,{backgroundColor:oa.bgPrimary,pixelRatio:2,filter:ns=>{if(!(ns instanceof Element))return !0;let Ii=window.getComputedStyle(ns),Gs=parseInt(Ii.zIndex,10);return (isNaN(Gs)||Gs<50)&&Ii.position!=="fixed"}});return await(await fetch(En)).blob()}finally{E.style.overflow=Ge,E.style.height=ze,F.style.overflow=It,U&&(U.scrollTop=ie),K.scrollTop=ge;}},exportToPDF:async E=>{await Me.exportToPDF(fe,E);},exportToExcel:async E=>{await Me.exportToExcel(fe,E,pc.current);},exportToJSON:()=>Me.exportToJSON(fe),exportToCSV:()=>Me.exportToCSV(fe),importFromJSON:E=>{let F=Me.importFromJSON(E);Ne(F);},getTasks:()=>fe,refresh:()=>{Ne(E=>[...E]);},clearAll:()=>{Ne([]);},scrollToDate:(E,F="start")=>de(E,F),fitToDates:(E,F)=>{let U=Math.max(1,(F.getTime()-E.getTime())/864e5),K=U<=21?"day":U<=122?"week":"month";ne.current=E,j(K),K===Do.current?.timeScale&&requestAnimationFrame(()=>{let ie=ne.current;ne.current=null,ie&&de(ie);});},scrollToToday:()=>{let E=wr.current,F=Do.current;if(!E||!F)return;let K=(new Date().getTime()-F.startDate.getTime())/(1e3*60*60*24),ie=F.timeScale==="day"?60:F.timeScale==="week"?20:8,ge=K*ie*F.zoom,Ge=E.clientWidth,ze=Math.max(0,ge-Ge/2);E.scrollTo({left:ze,behavior:"smooth"});}}),[fe,ye,lt,Et,Qt,ja,oa,X]);let We=useCallback(E=>{Hn(F=>F.map(U=>U.id===E?{...U,visible:!U.visible}:U));},[]),Q=useCallback((E,F)=>{Hn(U=>U.map(K=>{if(K.id!==E)return K;let ie=K.minWidth??100,ge=K.maxWidth??800,Ge=Math.max(ie,Math.min(ge,F));return {...K,width:Ge}}));},[]),De=useCallback(E=>{Ne(F=>{let U=Pd(F,E),K=ie=>{for(let ge of ie){if(ge.id===E){Mr.current.set(E,ge.isExpanded??true);return}ge.subtasks?.length&&K(ge.subtasks);}};return K(U),On(),U}),a.onTaskToggleExpand?.(E);},[a,On]),Re=useCallback((E,F)=>{if(st&&st(E,F)===false)return;let K=Me.findTaskById(fe,E)?.progress,ie=Ge=>Ge.map(ze=>ze.id===E?{...ze,...F}:ze.subtasks?{...ze,subtasks:ie(ze.subtasks)}:ze);Ne(Ge=>ie(Ge));let ge=Me.findTaskById(ie(fe),E);ge&&(le?.(ge),bt?.(ge),F.progress!==void 0&&K!==void 0&&F.progress!==K&&$e?.(E,K,F.progress));},[fe,le,st,bt,$e]),Ke=useCallback((E,F,U)=>{if(E.length===0)return;let K=new Set(E),ie=ge=>ge.map(Ge=>{let ze=K.has(Ge.id)?{...Ge,[F]:U}:Ge;return ze.subtasks?{...ze,subtasks:ie(ze.subtasks)}:ze});Ne(ge=>{let Ge=ie(ge);return a.onBulkFill?.(E,F,U,Ge),Ge});},[a]),$t=useCallback(E=>{E.length!==0&&(Vr.current+=1,Xr.current=true,Ne(F=>tn(Nd(F,E))),a.onTaskIndent?.(E[0]));},[a]),ut=useCallback(E=>{E.length!==0&&(Vr.current+=1,Xr.current=true,Ne(F=>tn(Dd(F,E))),a.onTaskOutdent?.(E[0]));},[a]),ct=useCallback((E,F,U)=>{Vr.current+=1,Xr.current=true,Ne(K=>tn(og(K,E,F,U))),a.onTaskReparent?.(E,F,U);},[a]),Zt=useCallback((E,F)=>{E.length!==0&&(Vr.current+=1,Xr.current=true,Ne(U=>Sd(U,E,F)),a.onTaskMove?.(E[0],F));},[a]),it=useCallback(async E=>{let F=[];for(let U of E)Ee&&await Promise.resolve(Ee(U))===false||F.push(U);F.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(F):(Ne(U=>tn(Ed(U,F))),F.forEach(U=>a.onTaskDelete?.(U))),Dt&&F.forEach(U=>Dt(U)));},[a,Ee,Dt]),ea=useCallback(E=>{a.onTaskDuplicate?E.forEach(F=>{let U=Me.findTaskById(fe,F);U&&a.onTaskDuplicate(U);}):Ne(F=>ci(F,E).tasks);},[a,fe]),xt=useCallback((E,F)=>{Ne(U=>{let{tasks:K,newTask:ie}=ng(U,E,F);return Ie&&Ie(ie)===false?U:(a.onTaskCreate?.(ie.parentId,ie.position||0),zt?.(ie),K)});},[a,Ie,zt]),Lt=useCallback((E,F)=>{Ne(U=>Md(U,E,F)),a.onTaskRename?.(E,F);},[a]),pt=useCallback(E=>{let{onTaskAddSubtask:F}=a;if(F){let U=xs(fe,E);if(U){F(U);return}}Ne(U=>{let{tasks:K}=Fd(U,E);return a.onTaskCreate?.(E,0),K});},[a,fe]),At=useCallback((E,F)=>{let U=Math.max(0,Math.min(100,Math.round(F))),K={progress:U};U===100?K.status="completed":U>0?K.status="in-progress":K.status="todo",Re(E.id,K);},[Re]),Ba=useCallback((E,F,U)=>{let K=!E.startDate&&!E.endDate,ie=E.startDate?Math.round((F.getTime()-E.startDate.getTime())/(1e3*60*60*24)):0,ge=Gt=>Gt.map(qt=>qt.id===E.id?{...qt,startDate:F,endDate:U,...E.segments&&{segments:E.segments}}:qt.subtasks?{...qt,subtasks:ge(qt.subtasks)}:qt),Ge=ge(fe),ze=Ge;Ge=Me.autoScheduleDependents(Ge,E.id,ie),Ge=tn(Ge),Ne(Ge);let It={...E,startDate:F,endDate:U};if(K&&a?.onTaskDateChange?a.onTaskDateChange(E,F,U):le?.(It),He&&ie!==0){let Gt=Me.flattenTasks(ze),qt=Me.flattenTasks(Ge),br=[];for(let jr of qt){if(jr.id===E.id)continue;let ao=Gt.find(En=>En.id===jr.id);if(!ao)continue;let rs=jr.startDate?.getTime()!==ao.startDate?.getTime(),So=jr.endDate?.getTime()!==ao.endDate?.getTime();(rs||So)&&br.push(jr);}br.length>0&&He(br);}},[fe,le,He,a]),kr=useCallback((E,F)=>{Be?.(E,F),be({isOpen:true,x:F.clientX,y:F.clientY,task:E});},[Be]),Pr=useCallback((E,F)=>{let U=Me.splitTask(fe,E.id,F);Ne(U),be({isOpen:false,x:0,y:0,task:null});},[fe]),ur=useCallback(E=>{let F=Me.findTaskById(fe,E.id)||E;oe?.(F),Pe||H(F);},[fe,oe,Pe]),Ka=useCallback((E,F,U)=>{let K=new Map,ie=Gt=>{Gt.forEach(qt=>{qt.dependencies&&K.set(qt.id,qt.dependencies),qt.subtasks&&ie(qt.subtasks);});};ie(U);let ge=K.get(F)||[];K.set(F,[...ge,E]);let Ge=new Set,ze=new Set,It=Gt=>{if(!Ge.has(Gt)){Ge.add(Gt),ze.add(Gt);let qt=K.get(Gt)||[];for(let br of qt){if(!Ge.has(br)&&It(br))return true;if(ze.has(br))return true}}return ze.delete(Gt),false};return It(F)},[]),to=useCallback((E,F)=>{if(Ka(E.id,F,Rs.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
366
|
+
`})]})}),jsx(AnimatePresence,{children:l&&jsxs(motion.div,{ref:A,initial:{opacity:0,y:20,scale:.95},animate:{opacity:1,y:0,scale:1,height:p?"auto":500},exit:{opacity:0,y:20,scale:.95},transition:{type:"spring",damping:25,stiffness:300},className:`fixed ${ta[B]} z-[99999] w-96 rounded-2xl overflow-hidden flex flex-col`,style:{background:Jt,backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)",border:`1px solid ${Wt}`,boxShadow:Qt},children:[jsxs("div",{className:"flex items-center justify-between px-4 py-3",style:{background:Y,borderBottom:`1px solid ${Le}`},children:[jsxs("div",{className:"flex items-center gap-2.5",children:[jsx("div",{style:{width:28,height:28,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",background:Ye,border:`1px solid ${he}`,color:"#00E5CC"},children:jsx(G0,{size:14})}),jsx("span",{style:{fontSize:12,fontWeight:600,fontFamily:"'JetBrains Mono', monospace",letterSpacing:"0.06em",textTransform:"uppercase",color:dt},children:"AI Assistant"})]}),jsxs("div",{className:"flex items-center gap-0.5",children:[jsx("button",{onClick:()=>d(de=>!de),className:"p-1.5 rounded-lg transition-colors",style:{color:wt},onMouseEnter:de=>{de.currentTarget.style.background=ce,de.currentTarget.style.color=ue;},onMouseLeave:de=>{de.currentTarget.style.background="transparent",de.currentTarget.style.color=wt;},children:jsx(vk,{})}),jsx("button",{onClick:()=>u(false),className:"p-1.5 rounded-lg transition-colors",style:{color:wt},onMouseEnter:de=>{de.currentTarget.style.background=ce,de.currentTarget.style.color=ue;},onMouseLeave:de=>{de.currentTarget.style.background="transparent",de.currentTarget.style.color=wt;},children:jsx(xk,{})})]})]}),jsx(AnimatePresence,{children:!p&&jsxs(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"flex flex-col flex-1 min-h-0",children:[jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",style:{maxHeight:350},children:[m.length===0&&x&&jsxs("div",{className:"space-y-3",children:[jsx("p",{className:"text-xs text-center",style:{color:Ae,fontFamily:"'JetBrains Mono', monospace"},children:"Try asking me to edit your Gantt chart:"}),jsx("div",{className:"flex flex-wrap gap-2",children:nt.slice(0,4).map((de,G)=>jsx("button",{onClick:()=>ma(de),className:"text-xs px-3 py-1.5 rounded-full transition-all",style:{background:Et,color:ut,border:`1px solid ${Pe}`},onMouseEnter:X=>{X.currentTarget.style.borderColor=O,X.currentTarget.style.color="#00E5CC";},onMouseLeave:X=>{X.currentTarget.style.borderColor=Pe,X.currentTarget.style.color=ut;},children:de.length>30?de.slice(0,30)+"...":de},G))})]}),m.map(de=>jsx(motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${de.role==="user"?"justify-end":"justify-start"}`,children:jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 ${de.role==="user"?"rounded-br-md":"rounded-bl-md"}`,style:{background:de.role==="user"?re:ot,color:de.role==="user"?"#00E5CC":Ht,border:de.role==="user"?`1px solid ${we}`:`1px solid ${mt}`},children:[de.isLoading?jsx(wk,{}):jsx("p",{className:"text-sm whitespace-pre-wrap",children:de.content}),de.command&&jsxs("div",{className:"mt-2 text-xs px-2 py-1 rounded-md inline-flex items-center gap-1",style:{background:de.command.success?"rgba(16, 185, 129, 0.15)":"rgba(239, 68, 68, 0.15)",color:de.command.success?"#10B981":"#EF4444",border:`1px solid ${de.command.success?"rgba(16,185,129,0.2)":"rgba(239,68,68,0.2)"}`},children:[de.command.success?"\u2713":"\u2717",jsx("span",{className:"capitalize",children:de.command.type.replace(/_/g," ")})]})]})},de.id)),jsx("div",{ref:R})]}),jsxs("form",{onSubmit:de=>{if(N&&Ct.length>0){de.preventDefault();return}_a(de);},className:"p-3 relative",style:{borderTop:`1px solid ${Zt}`},children:[jsx(AnimatePresence,{children:N&&Ct.length>0&&jsx(motion.div,{ref:ve,initial:{opacity:0,y:4},animate:{opacity:1,y:0},exit:{opacity:0,y:4},transition:{duration:.12},className:"absolute bottom-full left-3 right-3 mb-1 rounded-lg overflow-hidden z-10",style:{background:Ie,border:`1px solid ${Lt}`,boxShadow:I,backdropFilter:"blur(12px)"},children:Ct.map((de,G)=>jsxs("button",{type:"button",onClick:()=>It(de),className:"w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",style:{background:G===S?te:"transparent",color:Re},onMouseEnter:()=>V(G),children:[jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-xs font-bold flex-shrink-0",style:{background:_e,border:`1px solid ${it}`,color:"#00E5CC"},children:ba(de.name)}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("div",{className:"text-sm font-medium truncate",children:de.name}),de.email&&jsx("div",{className:"text-xs truncate",style:{color:Ee},children:de.email})]})]},de.id))})}),jsxs("div",{className:"flex items-center gap-2 rounded-xl px-4 py-2",style:{background:Oe,border:`1px solid ${Wa}`},children:[jsx("input",{ref:W,type:"text",value:v,onChange:de=>At(de.target.value),onKeyDown:de=>{Ke(de);},placeholder:le,disabled:w,className:"flex-1 bg-transparent text-sm outline-none",style:{color:la,fontFamily:"Inter, sans-serif"}}),jsx("button",{type:"submit",disabled:!v.trim()||w,className:"p-2 rounded-lg transition-all disabled:opacity-30",style:{background:v.trim()?da:"transparent",color:v.trim()?"#00E5CC":Te,border:v.trim()?`1px solid ${ke}`:"1px solid transparent"},children:jsx(yk,{})})]}),jsx("p",{className:"text-[10px] text-center mt-2",style:{color:gt,fontFamily:"'JetBrains Mono', monospace"},children:"Enter to send \xB7 Esc to close"})]})]})})]})})]})}function _0(e,t=50){let[a,r]=useState({past:[],present:e,future:[]}),n=useRef(false),s=useCallback((l,u=true)=>{r(p=>{let d=typeof l=="function"?l(p.present):l;if(n.current)return {...p,present:d};if(!u)return {...p,present:d};let m=[...p.past,p.present];return m.length>t&&m.shift(),{past:m,present:d,future:[]}});},[t]),o=useCallback(()=>{r(l=>{if(l.past.length===0)return l;let u=l.past[l.past.length-1],p=l.past.slice(0,l.past.length-1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:p,present:u,future:[l.present,...l.future]}});},[]),i=useCallback(()=>{r(l=>{if(l.future.length===0)return l;let u=l.future[0],p=l.future.slice(1);return n.current=true,setTimeout(()=>{n.current=false;},0),{past:[...l.past,l.present],present:u,future:p}});},[]),c=useCallback(()=>{r(l=>({past:[],present:l.present,future:[]}));},[]);return {state:a.present,setState:s,undo:o,redo:i,canUndo:a.past.length>0,canRedo:a.future.length>0,clearHistory:c}}function K0({undo:e,redo:t,canUndo:a,canRedo:r,enabled:n=true}){useEffect(()=>{if(!n)return;let s=o=>{let i=navigator.platform.toUpperCase().indexOf("MAC")>=0,c=i?o.metaKey:o.ctrlKey;if(c&&o.key==="z"&&!o.shiftKey&&a){o.preventDefault(),e();return}if(r){if(!i&&c&&o.key==="y"){o.preventDefault(),t();return}if(i&&c&&o.shiftKey&&o.key==="z"){o.preventDefault(),t();return}}};return window.addEventListener("keydown",s),()=>{window.removeEventListener("keydown",s);}},[e,t,a,r,n]);}var Dk={taskTooltip:e=>{let t=[`<strong>${e.name}</strong>`];if(e.startDate&&e.endDate){t.push(`${$e.formatDate(e.startDate)} - ${$e.formatDate(e.endDate)}`);let a=$e.calculateDuration(e.startDate,e.endDate);t.push(`Duration: ${a} days`);}if(e.progress!==void 0&&t.push(`Progress: ${e.progress}%`),e.status&&t.push(`Status: ${e.status}`),e.assignees&&e.assignees.length>0){let a=e.assignees.map(r=>r.name).join(", ");t.push(`Assigned: ${a}`);}return e.dependencies&&e.dependencies.length>0&&t.push(`Dependencies: ${e.dependencies.length}`),t.join("<br/>")},taskLabel:e=>e.name,gridCell:(e,t,a)=>a,taskClass:e=>{let t=[];return e.isCriticalPath&&t.push("critical-path"),e.status==="completed"?t.push("completed"):e.status==="in-progress"?t.push("in-progress"):e.status==="todo"&&t.push("todo"),e.isMilestone&&t.push("milestone"),t.join(" ")},milestoneContent:e=>`\u25C6 ${e.name}`,dateFormat:e=>$e.formatDate(e),durationFormat:e=>e===1?"1 day":`${e} days`,progressFormat:e=>`${e}%`};function q0(e){return {...Dk,...e}}var Ak=e=>{switch(e){case "compact":return 36;case "comfortable":return 42;case "spacious":return 52;default:return 42}},Q0=forwardRef(function({tasks:t,config:a={},onTasksChange:r},n){let{theme:s,timeScale:o="week",rowDensity:i="comfortable",showThemeSelector:c=true,showExportButton:l=true,onExportSuccess:u,projectName:p,availableUsers:d=[],templates:m,enableAutoCriticalPath:f=true,persistExpandedState:v,persistFilter:b,persistColumns:w,clearFiltersKey:h,aiAssistant:x,locale:y="en",customTranslations:k,showCreateTaskButton:M=false,createTaskLabel:H,onCreateTask:E,taskFilter:N,onTaskFilterChange:D,toolbarRightContent:S,toolbarContainer:V,hideWbsLevel:W,disenoV6:R,masOpcionesDeLaBarra:A,onRowDensityChange:ve,showBaseline:q,onShowBaselineChange:le,viewMode:B,onViewModeChange:pe,projectForecast:nt,hideForecastHud:Ue,currencyCode:$,onThemeChange:fe,onTaskClick:ie,onTaskSelectionChange:et,selectedTaskId:Xe,onTaskDblClick:Qe,onTaskContextMenu:ct,onTaskUpdate:Tt,onDependentTasksScheduled:_t,onProgressChange:tt,onTaskEdit:xt,onTaskAddSubtask:Jt,onTaskMarkIncomplete:Wt,onTaskSetInProgress:Qt,onDependencyCreate:Y,onDependencyDelete:Le,onBeforeTaskAdd:Ye,onAfterTaskAdd:he,onBeforeTaskUpdate:dt,onAfterTaskUpdate:wt,onBeforeTaskDelete:ue,onAfterTaskDelete:ce,permissions:Ae,onCopySnapshotLink:Et}=a,ut=useContext(Xl)?.theme,[O,re]=useState(ut||s||"dark"),[we,ot]=useState(o),[mt,Ht]=useState(i),Zt=useCallback(T=>{Ht(T),ve?.(T);},[ve]),[Oe,Wa]=useState(1),[la,da]=useState("all"),[ke,Te]=useState(B||"execution"),gt=B??ke,Ie=useCallback(T=>{Te(T),pe?.(T);},[pe]),Lt=q??gt==="oracle",[I,te]=useState(a.showCriticalPath!==false),[Re,Ee]=useState(a.showDependencies!==false),[_e,it]=useState(a.highlightWeekends!==false),qe=useCallback(T=>{te(T),a.onShowCriticalPathChange?.(T);},[a.onShowCriticalPathChange]),Ze=useCallback(T=>{Ee(T),a.onShowDependenciesChange?.(T);},[a.onShowDependenciesChange]),Ct=useCallback(T=>{it(T),a.onHighlightWeekendsChange?.(T);},[a.onHighlightWeekendsChange]);useEffect(()=>{a.onTimeScaleChange?.(we);},[we]),useEffect(()=>{a.onZoomChange?.(Oe);},[Oe]);let At=useRef(a.onDateRangeChange);At.current=a.onDateRangeChange;let It=useCallback(()=>b?typeof b=="string"?b:"gantt-filter-state":null,[b]),[Ke,Fe]=useState(()=>{if(!b)return "all";try{let T=typeof b=="string"?b:"gantt-filter-state",L=localStorage.getItem(T);if(L){let U=JSON.parse(L);if(U.taskFilter)return U.taskFilter}}catch(T){console.warn("[GanttBoard] Error loading filter state from localStorage:",T);}return "all"}),ft=N??Ke,_a=D??Fe,[ma,ta]=useState(()=>{if(!b)return false;try{let T=typeof b=="string"?b:"gantt-filter-state",L=localStorage.getItem(T);if(L){let U=JSON.parse(L);if(typeof U.hideCompleted=="boolean")return U.hideCompleted}}catch(T){console.warn("[GanttBoard] Error loading hideCompleted state from localStorage:",T);}return false});useEffect(()=>{let T=It();if(T)try{let L={taskFilter:ft,hideCompleted:ma};localStorage.setItem(T,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving filter state to localStorage:",L);}},[ft,ma,It]);let de=useRef(h);useEffect(()=>{if(de.current!==h&&h!==void 0){Fe("all"),ta(false);let T=It();if(T)try{localStorage.removeItem(T);}catch(L){console.warn("[GanttBoard] Error clearing filter state from localStorage:",L);}}de.current=h;},[h,It]);let[G,X]=useState(0),[F,P]=useState(false),[z,j]=useState(null),[J,be]=useState({isOpen:false,x:0,y:0,task:null}),[Be,De]=useState(null),[Ne,lt]=useState(null);useEffect(()=>{ut&&ut!==O&&re(ut);},[ut]),useEffect(()=>{s&&s!==O&&re(s);},[s]);let kt=useCallback(T=>{re(T),fe?.(T);},[fe]),{state:Se,setState:je,undo:xe,redo:Kt,canUndo:ca,canRedo:pr,clearHistory:rr}=_0(t,50),Fr=useMemo(()=>{let T=(L,U=0)=>{let K=U;for(let se of L)se.subtasks?.length&&(K=Math.max(K,T(se.subtasks,U+1)));return K};return T(Se)+1},[Se]),Lr=useCallback(()=>v?typeof v=="string"?v:"gantt-expanded-tasks":null,[v]),jr=useRef(new Map),za=useRef(false);if(!za.current&&v){za.current=true;let T=typeof v=="string"?v:"gantt-expanded-tasks";try{let L=localStorage.getItem(T);if(L){let U=JSON.parse(L);Array.isArray(U)&&(jr.current=new Map(U));}}catch(L){console.warn("[GanttBoard] Error loading expanded state from localStorage:",L);}}let Eo=useCallback(()=>{let T=Lr();if(T)try{let L=Array.from(jr.current.entries());localStorage.setItem(T,JSON.stringify(L));}catch(L){console.warn("[GanttBoard] Error saving expanded state to localStorage:",L);}},[Lr]),sn=useRef(0),pi=useRef(Se);useEffect(()=>{pi.current=Se;},[Se]);let fn=useRef(false),mi=useCallback(T=>{da(T),sn.current+=1,je(L=>{let U=(se,me=0)=>se.map(rt=>{let We=T==="all"||me<T-1;return rt.subtasks?.length&&jr.current.set(rt.id,We),{...rt,isExpanded:We,subtasks:rt.subtasks?U(rt.subtasks,me+1):void 0}}),K=U(L);return Eo(),K});},[je,Eo]);useEffect(()=>{if(sn.current>0){sn.current-=1;return}let T=U=>{let K=new Map;for(let se of U){let me=se.id;K.get(me)||K.set(me,se);}return Array.from(K.values())},L=U=>U.map(K=>{let se=jr.current.get(K.id),me=se!==void 0?{...K,isExpanded:se}:K;if(me.subtasks?.length){let rt=T(me.subtasks);return {...me,subtasks:L(rt)}}return me});if(jr.current.size>0)je(Cn(L(t)));else {let U=K=>K.map(se=>se.subtasks?.length?{...se,subtasks:T(U(se.subtasks))}:se);je(Cn(U(t)));}},[t,je]);let uo=useRef(t),gi=useRef(true);useEffect(()=>{if(gi.current){gi.current=false,uo.current=Se;return}if(fn.current){fn.current=false,uo.current=Se;return}if(!r)return;let T=JSON.stringify(uo.current),L=JSON.stringify(Se);T!==L&&(uo.current=Se,r(Se));},[Se,r]);let Ba=useMemo(()=>xd(y,k),[y,k]),Ar=Ba.toolbar.visibility==="Visibilidad",ad=useMemo(()=>R?[{id:"name",label:Ar?"Tarea":"Task",width:312,minWidth:120,visible:true,sortable:false,resizable:false},{id:"assignees",label:Ar?"Resp.":"Owner",width:28,visible:true,sortable:false,resizable:false},{id:"startDate",label:Ar?"Inicio":"Start",width:50,visible:true,sortable:false,resizable:false},{id:"endDate",label:Ar?"Fin":"End",width:50,visible:true,sortable:false,resizable:false},{id:"progress",label:"%",width:40,visible:true,sortable:false,resizable:false}]:null,[R,Ar]),fi=useCallback(T=>[{id:"name",label:T.columns.taskName,width:400,minWidth:200,maxWidth:2e3,visible:true,sortable:true,resizable:true},{id:"startDate",label:T.columns.startDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"endDate",label:T.columns.endDate,width:110,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"duration",label:T.columns.duration,width:80,minWidth:60,maxWidth:150,visible:false,sortable:true,resizable:true},{id:"assignees",label:T.columns.assignees,width:120,minWidth:80,maxWidth:300,visible:false,sortable:false,resizable:true},{id:"status",label:T.columns.status,width:100,minWidth:70,maxWidth:180,visible:false,sortable:true,resizable:true},{id:"progress",label:T.columns.progress,width:120,minWidth:80,maxWidth:200,visible:false,sortable:true,resizable:true},{id:"priority",label:T.columns.priority,width:90,minWidth:70,maxWidth:150,visible:false,sortable:true,resizable:true}],[]),bn=a.defaultVisibleColumns,bi=useCallback(T=>bn?T.map(L=>L.id==="name"?L:{...L,visible:bn.includes(L.id)}):T,[bn]),hn=useMemo(()=>w?typeof w=="string"?w:"gantt-columns-state":null,[w]),[Vr,Yn]=useState(()=>{let T=bi(fi(Ba));if(!w)return T;try{let L=typeof w=="string"?w:"gantt-columns-state",U=localStorage.getItem(L);if(!U)return T;let K=JSON.parse(U),se=new Map(K.map(me=>[me.id,me]));return T.map(me=>{let rt=se.get(me.id);return rt?{...me,visible:rt.visible??me.visible,width:rt.width??me.width}:me})}catch(L){return console.warn("[GanttBoard] Error loading columns state from localStorage:",L),T}}),po=useRef(hn);useEffect(()=>{if(po.current===hn)return;po.current=hn;let T=bi(fi(Ba));if(!hn){Yn(T);return}try{let L=localStorage.getItem(hn);if(!L){Yn(T);return}let U=JSON.parse(L),K=new Map(U.map(se=>[se.id,se]));Yn(T.map(se=>{let me=K.get(se.id);return me?{...se,visible:me.visible??se.visible,width:me.width??se.width}:se}));}catch(L){console.warn("[GanttBoard] Error reloading columns state from localStorage:",L),Yn(T);}},[hn,fi,Ba]),useEffect(()=>{if(hn&&po.current===hn)try{let T=Vr.map(L=>({id:L.id,visible:L.visible,width:L.width}));localStorage.setItem(hn,JSON.stringify(T));}catch(T){console.warn("[GanttBoard] Error saving columns state to localStorage:",T);}},[Vr,hn]),useEffect(()=>{Yn(T=>T.map(L=>({...L,label:Ba.columns[L.id==="name"?"taskName":L.id]||L.label})));},[Ba]);let As=useMemo(()=>Vr.filter(L=>L.visible).reduce((L,U)=>L+U.width,0),[Vr]),ml=useRef(Vr.filter(T=>T.visible).map(T=>T.id).join(","));useEffect(()=>{let T=Vr.filter(K=>K.visible),L=T.map(K=>K.id).join(","),U=ml.current;if(L!==U){let K=T.some(me=>me.id!=="name"),se=U.includes(",");K?!se&&K&&j(null):j(null),ml.current=L;}},[Vr]);let gl=60,fl=.6,bl=useMemo(()=>{if(R&&z===null)return 544;let T=200,L=As+gl,U=typeof window<"u"?window.innerWidth*fl:800,K=Math.max(L,U);return z!==null?Math.max(T,Math.min(z,K)):Math.max(T,L)},[z,As,R]),Xn=useRef(null),rs=useRef(null),mr=useRef(null),mo=useRef(null),Jn=useRef(null),ea=useMemo(()=>t0(O),[O]),rd=useMemo(()=>({theme:ea,themeName:O}),[ea,O]),C=useMemo(()=>q0(m),[m]),Q=useMemo(()=>{if(!f||!I)return Se;let T=$e.calculateCriticalPathFull(Se),L=U=>U.map(K=>{let se=T.get(K.id),me=K.subtasks?L(K.subtasks):void 0,rt=me?.some(Mt=>Mt.isCriticalPath||Mt.subtasks&&Mt.subtasks.some(jt=>jt.isCriticalPath))||false,We=se?se.isCritical:rt;return {...K,isCriticalPath:We,cpmData:se||void 0,subtasks:me}});return L(Se)},[Se,f,I]),ee=useMemo(()=>$e.flattenTasks(Se).some(L=>L.dependencies&&L.dependencies.length>0),[Se]),oe=useMemo(()=>{let T=(L,U="")=>[...L].sort((se,me)=>(se.position??0)-(me.position??0)).map((se,me)=>{let rt=me+1,We=U?`${U}.${rt}`:`${rt}.0`,Mt=U?`${U}.${rt}`:`${rt}`;return {...se,wbsCode:We,subtasks:se.subtasks?.length?T(se.subtasks,Mt):se.subtasks}});return T(Q)},[Q]),ge=(a.searchQuery??"").trim(),Ge=useMemo(()=>{let T=se();if(!ge)return T;let L=me=>me.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),U=L(ge),K=me=>{let rt=[];for(let We of me){if(L(We.name||"").includes(U)){rt.push(We);continue}let Mt=We.subtasks?.length?K(We.subtasks):[];Mt.length&&rt.push({...We,subtasks:Mt});}return rt};return K(T);function se(){if(ft==="all"&&!ma)return oe;let me=rt=>{let We=[];for(let Mt of rt){let jt=Mt.subtasks?.length?me(Mt.subtasks):void 0,Pt=false;if(ma)Pt=Mt.progress<100&&Mt.status!=="completed";else switch(ft){case "all":Pt=true;break;case "incomplete":Pt=Mt.progress<100;break;case "in_progress":Pt=Mt.progress>0&&Mt.progress<100;break;case "completed":Pt=Mt.progress===100;break}(Pt||jt&&jt.length>0)&&We.push({...Mt,subtasks:jt});}return We};return me(oe)}},[oe,ft,ma,ge]),ne=useMemo(()=>{if(!R)return;let T=$e.flattenTasks(Ge).length,L=Ar?`${T} ${T===1?"tarea":"tareas"}`:`${T} ${T===1?"task":"tasks"}`;return ma?`${L} \xB7 ${Ar?"completadas ocultas":"completed hidden"}`:ft!=="all"?`${L} \xB7 ${Ar?"filtradas":"filtered"}`:L},[R,Ge,ma,ft,Ar]),Me=useCallback(()=>{je(T=>{let L=U=>U.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?L(K.subtasks):void 0}));return L(T)});},[]),ze={compact:{fila:32,barra:18},comfortable:{fila:40,barra:22},spacious:{fila:48,barra:26}},He=R?ze[mt].fila:Ak(mt);K0({undo:xe,redo:Kt,canUndo:ca,canRedo:pr,enabled:true});let Ft=useRef(null),bt=(T,L="start")=>{let U=mr.current,K=Jn.current;if(!U||!K)return;let se=(T.getTime()-K.startDate.getTime())/(1e3*60*60*24),me=no(K.timeScale),rt=se*me*K.zoom,We=L==="center"?rt-U.clientWidth/2:rt-me*K.zoom*2;U.scrollTo({left:Math.max(0,We),behavior:"auto"});};useImperativeHandle(n,()=>({getTask:T=>$e.findTaskById(Se,T),addTask:(T,L)=>{je(U=>{if(!L)return [...U,{...T,level:0}];let K=se=>se.map(me=>me.id===L?{...me,subtasks:[...me.subtasks||[],{...T,parentId:L,level:(me.level||0)+1}],isExpanded:true}:me.subtasks?{...me,subtasks:K(me.subtasks)}:me);return K(U)});},updateTask:(T,L)=>{je(U=>{let K=se=>se.map(me=>me.id===T?{...me,...L}:me.subtasks?{...me,subtasks:K(me.subtasks)}:me);return K(U)});},deleteTask:T=>{je(L=>{let U=K=>K.filter(se=>se.id===T?false:(se.subtasks&&(se.subtasks=U(se.subtasks)),true));return U(L)});},deleteTasks:T=>{je(L=>wu(L,T));},duplicateTask:T=>{if(a.onTaskDuplicate){let L=$e.findTaskById(Se,T);L&&a.onTaskDuplicate(L);}else je(L=>Vi(L,[T]).tasks);},splitTask:(T,L,U=3)=>{je(K=>$e.splitTask(K,T,L,U));},calculateEndDate:$e.calculateEndDate,calculateDuration:$e.calculateDuration,validateDependency:(T,L)=>!$e.validateDependencies(Se,T,L),getAllTasks:()=>$e.flattenTasks(Se),getTasksByStatus:T=>$e.flattenTasks(Se).filter(L=>L.status===T),getTasksByParent:T=>T?$e.findTaskById(Se,T)?.subtasks||[]:Se.filter(U=>!U.parentId),getCriticalPath:()=>$e.flattenTasks(Se).filter(T=>T.isCriticalPath),indentTask:T=>{je(L=>Cn(yu(L,[T])));},outdentTask:T=>{je(L=>Cn(xu(L,[T])));},moveTask:(T,L)=>{je(U=>vu(U,[T],L));},createSubtask:async T=>{let{tasks:L,newTask:U}=Tu(Se,T);if(Ye){let K=Ye({...U,parentId:T});if((K instanceof Promise?await K:K)===false)return}je(Cn(L)),he&&he({...U,parentId:T});},scrollToTask:T=>{let U=$e.flattenTasks(Se).findIndex(K=>K.id===T);if(U!==-1&&Xn.current){let K=U*He;Xn.current.scrollTo({top:K,behavior:"smooth"}),mr.current&&mr.current.scrollTo({top:K,behavior:"smooth"});}},highlightTask:(T,L=2e3)=>{},expandTask:T=>{je(L=>{let U=K=>K.map(se=>se.id===T?{...se,isExpanded:true}:se.subtasks?{...se,subtasks:U(se.subtasks)}:se);return U(L)});},collapseTask:T=>{je(L=>{let U=K=>K.map(se=>se.id===T?{...se,isExpanded:false}:se.subtasks?{...se,subtasks:U(se.subtasks)}:se);return U(L)});},expandAll:()=>{je(T=>{let L=U=>U.map(K=>({...K,isExpanded:true,subtasks:K.subtasks?L(K.subtasks):void 0}));return L(T)});},collapseAll:()=>{je(T=>{let L=U=>U.map(K=>({...K,isExpanded:false,subtasks:K.subtasks?L(K.subtasks):void 0}));return L(T)});},collapseToLevel:T=>{mi(T);},undo:xe,redo:Kt,canUndo:()=>ca,canRedo:()=>pr,clearHistory:rr,exportToPNG:async()=>{if(!mo.current||!Xn.current||!mr.current)throw new Error("Gantt container not found");let T=mo.current,L=Xn.current,U=rs.current||L.querySelector(".gantt-grid-scroll"),K=mr.current,se=U?.scrollTop||0,me=K.scrollTop,rt=T.style.overflow,We=T.style.height,Mt=L.style.overflow;try{let jt=U?.querySelector(".gantt-taskgrid-content"),Pt=K.querySelector("svg"),La=jt?.scrollHeight||U?.scrollHeight||600,nr=Pt?.getBoundingClientRect().height||K.scrollHeight,xn=(T.querySelector('[style*="z-index: 100"]')?.offsetHeight||48)+Math.max(La,nr)+20;U&&(U.scrollTop=0),K.scrollTop=0,T.style.overflow="visible",T.style.height=`${xn}px`,L.style.overflow="visible",await new Promise(Mo=>setTimeout(Mo,100));let Qn=await toPng(T,{backgroundColor:ea.bgPrimary,pixelRatio:2,filter:Mo=>{if(!(Mo instanceof Element))return !0;let yl=window.getComputedStyle(Mo),xi=parseInt(yl.zIndex,10);return (isNaN(xi)||xi<50)&&yl.position!=="fixed"}});return await(await fetch(Qn)).blob()}finally{T.style.overflow=rt,T.style.height=We,L.style.overflow=Mt,U&&(U.scrollTop=se),K.scrollTop=me;}},exportToPDF:async T=>{await $e.exportToPDF(Se,T);},exportToExcel:async T=>{await $e.exportToExcel(Se,T,od.current);},exportToJSON:()=>$e.exportToJSON(Se),exportToCSV:()=>$e.exportToCSV(Se),importFromJSON:T=>{let L=$e.importFromJSON(T);je(L);},getTasks:()=>Se,refresh:()=>{je(T=>[...T]);},clearAll:()=>{je([]);},scrollToDate:(T,L="start")=>bt(T,L),fitToDates:(T,L)=>{let U=Math.max(1,(L.getTime()-T.getTime())/864e5),K=U<=21?"day":U<=122?"week":"month";Ft.current=T,ot(K),K===Jn.current?.timeScale&&requestAnimationFrame(()=>{let se=Ft.current;Ft.current=null,se&&bt(se);});},scrollToToday:()=>{let T=mr.current,L=Jn.current;if(!T||!L)return;let K=(new Date().getTime()-L.startDate.getTime())/(1e3*60*60*24),se=no(L.timeScale),me=K*se*L.zoom,rt=T.clientWidth,We=Math.max(0,me-rt/2);T.scrollTo({left:We,behavior:"smooth"});}}),[Se,xe,Kt,ca,pr,rr,ea,He]);let Nt=useCallback(T=>{Yn(L=>L.map(U=>U.id===T?{...U,visible:!U.visible}:U));},[]),aa=useCallback((T,L)=>{Yn(U=>U.map(K=>{if(K.id!==T)return K;let se=K.minWidth??100,me=K.maxWidth??800,rt=Math.max(se,Math.min(me,L));return {...K,width:rt}}));},[]),ht=useCallback(T=>{je(L=>{let U=Cu(L,T),K=se=>{for(let me of se){if(me.id===T){jr.current.set(T,me.isExpanded??true);return}me.subtasks?.length&&K(me.subtasks);}};return K(U),Eo(),U}),a.onTaskToggleExpand?.(T);},[a,Eo]),Ut=useCallback((T,L)=>{if(dt&&dt(T,L)===false)return;let K=$e.findTaskById(Se,T)?.progress,se=rt=>rt.map(We=>We.id===T?{...We,...L}:We.subtasks?{...We,subtasks:se(We.subtasks)}:We);je(rt=>se(rt));let me=$e.findTaskById(se(Se),T);me&&(Tt?.(me),wt?.(me),L.progress!==void 0&&K!==void 0&&L.progress!==K&&tt?.(T,K,L.progress));},[Se,Tt,dt,wt,tt]),oa=useCallback((T,L,U)=>{if(T.length===0)return;let K=new Set(T),se=me=>me.map(rt=>{let We=K.has(rt.id)?{...rt,[L]:U}:rt;return We.subtasks?{...We,subtasks:se(We.subtasks)}:We});je(me=>{let rt=se(me);return a.onBulkFill?.(T,L,U,rt),rt});},[a]),ga=useCallback(T=>{T.length!==0&&(sn.current+=1,fn.current=true,je(L=>Cn(yu(L,T))),a.onTaskIndent?.(T[0]));},[a]),Rt=useCallback(T=>{T.length!==0&&(sn.current+=1,fn.current=true,je(L=>Cn(xu(L,T))),a.onTaskOutdent?.(T[0]));},[a]),Bt=useCallback((T,L,U)=>{sn.current+=1,fn.current=true,je(K=>Cn(N0(K,T,L,U))),a.onTaskReparent?.(T,L,U);},[a]),ua=useCallback((T,L)=>{T.length!==0&&(sn.current+=1,fn.current=true,je(U=>vu(U,T,L)),a.onTaskMove?.(T[0],L));},[a]),Ma=useCallback(async T=>{let L=[];for(let U of T)ue&&await Promise.resolve(ue(U))===false||L.push(U);L.length!==0&&(a.onMultiTaskDelete?a.onMultiTaskDelete(L):(je(U=>Cn(wu(U,L))),L.forEach(U=>a.onTaskDelete?.(U))),ce&&L.forEach(U=>ce(U)));},[a,ue,ce]),Ka=useCallback(T=>{a.onTaskDuplicate?T.forEach(L=>{let U=$e.findTaskById(Se,L);U&&a.onTaskDuplicate(U);}):je(L=>Vi(L,T).tasks);},[a,Se]),ln=useCallback((T,L)=>{je(U=>{let{tasks:K,newTask:se}=D0(U,T,L);return Ye&&Ye(se)===false?U:(a.onTaskCreate?.(se.parentId,se.position||0),he?.(se),K)});},[a,Ye,he]),Ir=useCallback((T,L)=>{je(U=>ku(U,T,L)),a.onTaskRename?.(T,L);},[a]),Pn=useCallback(T=>{let{onTaskAddSubtask:L}=a;if(L){let U=Ks(Se,T);if(U){L(U);return}}je(U=>{let{tasks:K}=Tu(U,T);return a.onTaskCreate?.(T,0),K});},[a,Se]),yn=useCallback((T,L)=>{let U=Math.max(0,Math.min(100,Math.round(L))),K={progress:U};U===100?K.status="completed":U>0?K.status="in-progress":K.status="todo",Ut(T.id,K);},[Ut]),cn=useCallback((T,L,U)=>{let K=Ko(a?.workingDaysConfig),se=Ki(T,L,U,Se,K);se.porQue&&(L=se.inicio,U=se.fin,a?.onDependencyConstraint?.({task:T,predecessor:se.porQue.predecesora,earliestStart:se.inicio}));let me=!T.startDate&&!T.endDate,rt=La=>La.map(nr=>nr.id===T.id?{...nr,startDate:L,endDate:U,...T.segments&&{segments:T.segments}}:nr.subtasks?{...nr,subtasks:rt(nr.subtasks)}:nr),We=rt(Se),Mt=We,jt=new Map(Js(We,[T.id],K).map(La=>[La.id,La]));if(jt.size>0){let La=nr=>nr.map(en=>{let tn=jt.get(en.id),xn=en.subtasks?{...en,subtasks:La(en.subtasks)}:en;return tn?{...xn,startDate:tn.startDate,endDate:tn.endDate}:xn});We=La(We);}We=Cn(We),je(We);let Pt={...T,startDate:L,endDate:U};if(me&&a?.onTaskDateChange?a.onTaskDateChange(T,L,U):Tt?.(Pt),_t&&jt.size>0){let La=$e.flattenTasks(Mt),nr=$e.flattenTasks(We),en=[];for(let tn of nr){if(tn.id===T.id)continue;let xn=La.find(Mo=>Mo.id===tn.id);if(!xn)continue;let Qn=tn.startDate?.getTime()!==xn.startDate?.getTime(),yi=tn.endDate?.getTime()!==xn.endDate?.getTime();(Qn||yi)&&en.push(tn);}en.length>0&&_t(en);}},[Se,Tt,_t,a]),Zh=useCallback((T,L)=>{ct?.(T,L),be({isOpen:true,x:L.clientX,y:L.clientY,task:T});},[ct]),ey=useCallback((T,L)=>{let U=$e.splitTask(Se,T.id,L);je(U),be({isOpen:false,x:0,y:0,task:null});},[Se]),qp=useCallback(T=>{let L=$e.findTaskById(Se,T.id)||T;Qe?.(L),xt||De(L);},[Se,Qe,xt]),Yp=useCallback((T,L,U)=>{let K=new Map,se=jt=>{jt.forEach(Pt=>{Pt.dependencies&&K.set(Pt.id,Pt.dependencies),Pt.subtasks&&se(Pt.subtasks);});};se(U);let me=K.get(L)||[];K.set(L,[...me,T]);let rt=new Set,We=new Set,Mt=jt=>{if(!rt.has(jt)){rt.add(jt),We.add(jt);let Pt=K.get(jt)||[];for(let La of Pt){if(!rt.has(La)&&Mt(La))return true;if(We.has(La))return true}}return We.delete(jt),false};return Mt(L)},[]),Xp=useCallback((T,L,U="FS")=>{if(Yp(T.id,L,pi.current)){console.warn("Cannot create dependency: would create a circular dependency"),alert(`Cannot create this dependency: it would create a circular dependency chain.
|
|
367
367
|
|
|
368
|
-
Task dependencies must flow in one direction only.`);return}let U=K=>K.map(ie=>{if(ie.id===F){let ge=ie.dependencies||[];if(!ge.includes(E.id))return {...ie,dependencies:[...ge,E.id]}}return ie.subtasks?{...ie,subtasks:U(ie.subtasks)}:ie});Vr.current+=1,Ne(K=>U(K)),Ae?.(E.id,F);},[Ae,Ka]),ts=useCallback((E,F)=>{let U=K=>K.map(ie=>{if(ie.id===E&&ie.dependencies){let ge=ie.dependencies.filter(Ge=>Ge!==F);return {...ie,dependencies:ge}}return ie.subtasks?{...ie,subtasks:U(ie.subtasks)}:ie});Vr.current+=1,Ne(K=>U(K)),ot?.(E,F);},[ot]),{startDate:Cr,endDate:uc}=useMemo(()=>{let E=fe.filter(ge=>ge.startDate&&ge.endDate);if(E.length===0){let ge=new Date,Ge=new Date(ge);Ge.setDate(Ge.getDate()-30);let ze=new Date(ge);return ze.setDate(ze.getDate()+60),{startDate:Ge,endDate:ze}}let F=E.flatMap(ge=>[ge.startDate,ge.endDate]).filter(ge=>ge!==void 0),U=new Date(Math.min(...F.map(ge=>ge.getTime()))),K=new Date(Math.max(...F.map(ge=>ge.getTime()))),ie=I==="day"?7:I==="week"?14:30;return U.setDate(U.getDate()-ie),K.setDate(K.getDate()+ie),{startDate:U,endDate:K}},[fe,I]);useEffect(()=>{cr.current?.(Cr,uc);},[Cr,uc]);let Lb=useCallback(async()=>{if(!No.current||!$r.current||!wr.current)return;await new Promise(So=>setTimeout(So,200));let E=No.current,F=$r.current,U=Zo.current||F.querySelector(".gantt-grid-scroll"),K=wr.current,ie=U?.scrollTop||0,ge=U?.scrollLeft||0,Ge=K.scrollTop,ze=K.scrollLeft,It=E.style.overflow,Gt=E.style.height,qt=U?.style.overflow||"",br=K.style.overflow,jr=F.style.overflow,ao=E.style.width,rs=K.style.width;try{let So=U?.querySelector(".gantt-taskgrid-content"),En=K.querySelector("svg"),fc=En?.getAttribute("height")?parseInt(En.getAttribute("height"),10):En?.getBoundingClientRect().height||0,ns=So?.scrollHeight||U?.scrollHeight||600,Ii=Math.max(fc,K.scrollHeight),Gs=En?.getAttribute("width")?parseInt(En.getAttribute("width"),10):En?.getBoundingClientRect().width||K.scrollWidth,Ub=E.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,bc=Math.max(ns,Ii,fc),Qu=Ub+bc+50,Zu=(U?.offsetWidth||F.offsetWidth||300)+Gs+10;U&&(U.scrollTop=0,U.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,E.style.overflow="visible",E.style.height=`${Qu}px`,E.style.width=`${Zu}px`,F.style.overflow="visible",U&&(U.style.overflow="visible",U.style.height=`${bc+50}px`),K.style.overflow="visible",K.style.height=`${bc+50}px`,K.style.width=`${Gs+10}px`,await new Promise(Ri=>setTimeout(Ri,150));let Wb=await toPng(E,{backgroundColor:oa.bgPrimary,pixelRatio:2,width:Zu,height:Qu,skipFonts:!1,filter:Ri=>{if(!(Ri instanceof Element))return !0;let ep=window.getComputedStyle(Ri),tp=parseInt(ep.zIndex,10);return !(!isNaN(tp)&&tp>=50||ep.position==="fixed")}}),hc=document.createElement("a");hc.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,hc.href=Wb,hc.click();}finally{E.style.overflow=It,E.style.height=Gt,E.style.width=ao,F.style.overflow=jr,U&&(U.style.overflow=qt,U.style.height="",U.scrollTop=ie,U.scrollLeft=ge),K.style.overflow=br,K.style.height="",K.style.width=rs,K.scrollTop=Ge,K.scrollLeft=ze;}p?.("png");},[oa,p]),Ab=useCallback(async()=>{await Me.exportToPDF(fe),p?.("pdf");},[fe,p]),pc=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:u});pc.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:u};let Ib=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),p?.("excel");return}let E=new Date,F=ie=>String(ie).padStart(2,"0"),U=`${E.getFullYear()}-${F(E.getMonth()+1)}-${F(E.getDate())}_${F(E.getHours())}${F(E.getMinutes())}`,K=u?u.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await Me.exportToExcel(fe,`${K}_${U}.xlsx`,pc.current),p?.("excel");},[fe,u,p,a.onExportExcel]),Rb=useCallback(()=>{let E=Me.exportToCSV(fe),F=new Blob([E],{type:"text/csv;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(F),U.download="gantt-chart.csv",U.click(),URL.revokeObjectURL(U.href),p?.("csv");},[fe,p]),Bb=useCallback(()=>{let E=Me.exportToJSON(fe),F=new Blob([E],{type:"application/json;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(F),U.download="gantt-chart.json",U.click(),URL.revokeObjectURL(U.href),p?.("json");},[fe,p]),$b=useCallback(()=>{Me.exportToMSProject(fe,"Gantt Project","project.xml"),p?.("msproject");},[fe,p]),Ob=E=>{E.preventDefault(),pe(true);},as=useRef(false),[mc,Yu]=useState(false),zs=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let E=wr.current,F=$r.current?.querySelector(".gantt-grid-scroll");if(!E||!F)return;let U=()=>{if(as.current)return;as.current=true;let ze=E.scrollTop;me(ze),F.scrollTop=ze,requestAnimationFrame(()=>{as.current=false;});},K=()=>{if(as.current)return;as.current=true;let ze=F.scrollTop;me(ze),E.scrollTop=ze,requestAnimationFrame(()=>{as.current=false;});},ie=ze=>{if(q&&F){let Gt=F.parentElement?.getBoundingClientRect()?.left||0,qt=ze.clientX-Gt,br=200,jr=cn+Li,ao=window.innerWidth*Un,rs=Math.max(jr,ao);qt>=br&&qt<=rs&&B(qt);}if(mc&&E){let It=ze.clientX-zs.current.x,Gt=ze.clientY-zs.current.y;E.scrollLeft=zs.current.scrollLeft-It,E.scrollTop=zs.current.scrollTop-Gt;}},ge=()=>{pe(false),Yu(false);},Ge=ze=>{if(ze.button!==0)return;let It=ze.target;It.closest("[data-task-bar]")||It.closest("[data-dependency-line]")||It.closest("button")||It.closest('[role="button"]')||It.tagName==="rect"&&It.getAttribute("data-clickable")==="true"||(Yu(true),zs.current={x:ze.clientX,y:ze.clientY,scrollLeft:E.scrollLeft,scrollTop:E.scrollTop},ze.preventDefault());};return E.addEventListener("scroll",U),F.addEventListener("scroll",K),E.addEventListener("mousedown",Ge),document.addEventListener("mousemove",ie),document.addEventListener("mouseup",ge),()=>{E.removeEventListener("scroll",U),F.removeEventListener("scroll",K),E.removeEventListener("mousedown",Ge),document.removeEventListener("mousemove",ie),document.removeEventListener("mouseup",ge);}},[q,mc,cn]),Do.current={startDate:Cr,timeScale:I,zoom:ue};let gc=a.onTodayVisibilityChange,Xu=useRef(null);useEffect(()=>{if(!gc)return;let E=wr.current;if(!E)return;let F=I==="day"?60:I==="week"?20:8,U=()=>{let ge=(new Date().getTime()-Cr.getTime())/(1e3*60*60*24)*F*ue,Ge=E.scrollLeft,ze=Ge+E.clientWidth,It=ge>=Ge&&ge<=ze;Xu.current!==It&&(Xu.current=It,gc(It));};return U(),E.addEventListener("scroll",U,{passive:true}),window.addEventListener("resize",U),()=>{E.removeEventListener("scroll",U),window.removeEventListener("resize",U);}},[gc,Cr,I,ue]);let Ju=useRef(false),Hb=useRef(null);return useLayoutEffect(()=>{if(Ju.current||fe.length===0||!wr.current)return;Ju.current=true,Hb.current=Cr;let E=wr.current,F=new Date,U=I==="day"?60:I==="week"?20:8,K=(F.getTime()-Cr.getTime())/(1e3*60*60*24),ie=E.clientWidth,Ge=K*U*ue-ie/2;K>=0&&ie>0&&(E.scrollLeft=Math.max(0,Ge));},[fe.length,Cr,I,ue]),useLayoutEffect(()=>{let E=ne.current;!E||Do.current?.timeScale!==I||(ne.current=null,de(E));},[I,Cr,ue]),jsx(hs.Provider,{value:Qa,children:jsx(kc.Provider,{value:dc,children:jsxs("div",{ref:No,className:"flex flex-col h-full w-full",style:{backgroundColor:oa.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...oa.dotGrid&&{backgroundImage:`radial-gradient(circle, ${oa.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let E=jsx(gl,{enCabecera:!!z,theme:oa,timeScale:I,onTimeScaleChange:j,zoom:ue,onZoomChange:at,currentTheme:J,onThemeChange:gt,rowDensity:ke,onRowDensityChange:Ue,showThemeSelector:c,showCreateTaskButton:P&&ht?.canCreateTask!==false&&!ht?.canCreateSubtaskOnly,createTaskLabel:O,onCreateTask:T,taskFilter:Ia,onTaskFilterChange:dr,hideCompleted:xr,onHideCompletedChange:Ra,toolbarRightContent:N,wbsLevel:yt,onWbsLevelChange:$?void 0:Pi,maxWbsDepth:Er,viewMode:wt,onViewModeChange:Se?Ut:void 0,projectForecast:W,hideForecastHud:Ce,onExportPNG:l?Lb:void 0,onExportPDF:l?Ab:void 0,onExportExcel:l?Ib:void 0,onExportCSV:l?Rb:void 0,onExportJSON:l?Bb:void 0,onExportMSProject:l?$b:void 0,showCriticalPath:he,onShowCriticalPathChange:kt,showDependencies:Qe,onShowDependenciesChange:Da,highlightWeekends:Tt,onHighlightWeekendsChange:aa,showBaseline:Ht,onShowBaselineChange:F=>{F&&wt!=="oracle"&&Ut("oracle"),!F&&wt==="oracle"&&Ut("execution");},onCopySnapshotLink:_e,hasDependencies:Ws});return z?createPortal(E,z):jsx("div",{style:{position:"relative",zIndex:100},children:E})})(),jsxs("div",{ref:$r,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[jsx("div",{ref:Zo,className:"gantt-grid-scroll flex-shrink-0",style:{width:Ai,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(hl,{addTaskRow:a.addTaskRow,tasks:_,allTasks:Wn,theme:oa,rowHeight:X,availableUsers:d,templates:Us,showCriticalPath:he,onTaskClick:we,onTaskSelectionChange:G,selectedTaskId:Ve,onTaskDblClick:ur,onTaskContextMenu:Be,onTaskToggle:De,scrollTop:se,columns:Jr,onToggleColumn:We,onColumnResize:Q,onTaskUpdate:Re,onBulkFill:Ke,onTaskIndent:$t,onTaskOutdent:ut,onTaskMove:Zt,onMultiTaskDelete:it,onTaskDuplicate:ea,onTaskCreate:xt,onTaskRename:Lt,onCreateSubtask:pt,onOpenTaskModal:we?E=>we(E):void 0,onDeleteRequest:(E,F)=>Te({taskIds:E,taskName:F}),onTaskReparent:ct,scrollContainerRef:Zo})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:oa.border,zIndex:15},onMouseDown:Ob}),jsx("div",{ref:wr,className:"gantt-timeline-scroll flex-1",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:mc?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(Tl,{tasks:_,theme:oa,rowHeight:X,timeScale:I,startDate:Cr,endDate:uc,zoom:ue,locale:w,templates:Us,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:we,onTaskDblClick:ur,onTaskContextMenu:kr,onTaskDateChange:Ba,onTaskProgressDrag:At,onDependencyCreate:to,onDependencyDelete:ts,showBaseline:Ht,showCriticalPath:he,showDependencies:Qe,highlightWeekends:Tt,weekHeaderFormat:a.weekHeaderFormat,canEditTask:ht?.canEditTask,workingDaysConfig:a?.workingDaysConfig})})]}),re.task&&jsx(ys,{isOpen:re.isOpen,x:re.x,y:re.y,theme:oa,onClose:()=>be({isOpen:false,x:0,y:0,task:null}),items:(()=>{let E=re.task;if(!E)return [];let F=Me.findTaskById(fe,E.id)||E,U=F.subtasks&&F.subtasks.length>0,K=ht?.canCreateTask!==false,ie=ht?.canDeleteTask!==false;if(U){let Gt=[],qt=ht?.canDuplicateTask!==false;return K&&Gt.push({id:"addSubtask",label:Qa.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{je?je(F):pt(F.id);}}),qt&&Gt.push({id:"duplicate",label:Qa.contextMenu?.duplicateTask||"Duplicate Task",icon:ua.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):Ne(br=>ci(br,[F.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),ie&&(Gt.length>0&&Gt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),Gt.push({id:"delete",label:Qa.contextMenu?.deleteTask||"Delete Task",icon:ua.Delete,onClick:()=>{Te({taskIds:[F.id],taskName:F.name});}})),Gt}let ge=ht?.canUpdateTask!==false,Ge=ht?.canDuplicateTask!==false,ze=[];return ge&&ze.push({id:"edit",label:Qa.contextMenu?.editTask||"Edit Task",icon:ua.Pencil,onClick:()=>{Pe?Pe(F):H(F);}}),K&&ze.push({id:"addSubtask",label:Qa.contextMenu?.addSubtask||"Add Subtask",icon:ua.Add,onClick:()=>{je?je(F):pt(F.id);}}),ze.length>0&&ge&&ze.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),ge&&(ze.push({id:"markIncomplete",label:Qa.contextMenu?.markIncomplete||"Mark Incomplete",icon:ua.MarkIncomplete,onClick:()=>{tt?tt(F):Re(F.id,{status:"todo",progress:0});},disabled:F.status==="todo"}),ze.push({id:"setInProgress",label:Qa.contextMenu?.setInProgress||"Set In Progress",icon:ua.SetInProgress,onClick:()=>{ee?ee(F):Re(F.id,{status:"in-progress"});},disabled:F.status==="in-progress"}),ze.push({id:"markComplete",label:Qa.contextMenu?.markComplete||"Mark Complete",icon:ua.MarkComplete,onClick:()=>{Re(F.id,{status:"completed",progress:100});},disabled:F.status==="completed"})),(Ge||ge&&F.startDate&&F.endDate)&&ze.length>0&&ze.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),Ge&&ze.push({id:"duplicate",label:Qa.contextMenu?.duplicateTask||"Duplicate Task",icon:ua.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(F):Ne(Gt=>ci(Gt,[F.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),ge&&F.startDate&&F.endDate&&ze.push({id:"split",label:Qa.contextMenu?.splitTask||"Split Task",icon:ua.Split,onClick:()=>{let Gt=F.startDate.getTime(),qt=F.endDate.getTime(),br=Gt+(qt-Gt)/2,jr=new Date(br);Pr(F,jr);}}),ie&&(ze.length>0&&ze.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),ze.push({id:"delete",label:Qa.contextMenu?.deleteTask||"Delete Task",icon:ua.Delete,onClick:()=>{Te({taskIds:[F.id],taskName:F.name});}})),ze})()}),jsx(Io,{task:S,isOpen:!!S,onClose:()=>H(null),onTaskUpdate:E=>{S&&(Re(S.id,E),H(null));},theme:J==="light"?"light":"dark",locale:w==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Z&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>Te(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:E=>E.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:oa.bgSecondary,border:`1px solid ${oa.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${oa.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:oa.textPrimary,fontFamily:"Inter, sans-serif"},children:[Qa.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:oa.textSecondary,fontFamily:"Inter, sans-serif"},children:w==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:oa.textSecondary,fontFamily:"Inter, sans-serif"},children:Z.taskIds.length>1?jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:oa.textPrimary},children:[Z.taskIds.length," ",w==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[w==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:oa.textPrimary},children:['"',Z.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:oa.bgPrimary,borderTop:`1px solid ${oa.border}`},children:[jsx("button",{onClick:()=>Te(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:oa.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor=oa.hoverBg;},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="transparent";},children:w==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{it(Z.taskIds),Te(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:E=>{E.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:E=>{E.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),w==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsx(Sl,{tasks:fe,theme:oa,config:x,onTasksUpdate:Ne,onTaskUpdate:Re,onTaskCreate:E=>{Ne(F=>[...F,E]);},onTaskDelete:E=>{it([E]);},onDependencyCreate:(E,F)=>{let U=Me.findTaskById(fe,E);U&&to(U,F);},onDependencyDelete:ts})]})})})});function nk(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function ok(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var Id=[{id:"todo",title:"Por Hacer",color:"#6B7280"},{id:"in-progress",title:"En Progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Rd=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function Mg({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:p=[],onCreateTag:u,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let b=[...Id,...l.filter(L=>!Id.some(J=>J.id===L.id))],h=ft[c]||ft.dark,[y,x]=useState(false),[w,C]=useState(false),[P,O]=useState(false),[T,D]=useState(false),[M,N]=useState({top:0,left:0}),[z,$]=useState(null),[Y,A]=useState(new Date),[Se,W]=useState({top:0,left:0}),[Ce,R]=useState(false),[we,G]=useState([]),[Ve,oe]=useState(false),[Be,le]=useState(""),He=useRef(null),$e=useRef(null),Pe=useRef(null),je=useRef(null),tt=useRef(null),[ee,Ae]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[ot,Ie]=useState({});useEffect(()=>{a?(Ae({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&R(true)):(Ae({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),R(false),G([]));},[a,e,v]),useEffect(()=>{let L=J=>{He.current&&!He.current.contains(J.target)&&x(false),$e.current&&!$e.current.contains(J.target)&&C(false),Pe.current&&!Pe.current.contains(J.target)&&O(false),je.current&&!je.current.contains(J.target)&&D(false);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]);let zt=()=>{let L={};return ee.name.trim()||(L.name="El nombre es requerido"),ee.startDate&&ee.endDate&&ee.startDate>ee.endDate&&(L.endDate="La fecha de fin debe ser posterior a la de inicio"),Ie(L),Object.keys(L).length===0},st=async L=>{if(L.preventDefault(),!!zt())try{let J=i==="create"&&we.length>0?{...ee,pendingFiles:we}:ee;await s(J),G([]),t();}catch(J){console.error("Error submitting task:",J);}},bt=(L,J)=>{Ae(xe=>{let I={...xe,[L]:J};if(L==="status"){let j=J;j==="todo"?I.progress=0:j==="in-progress"?(xe.progress===0||xe.progress===100)&&(I.progress=50):j==="completed"||j==="closed"?I.progress=100:(j==="in-review"||j==="review")&&(I.progress=75);}if(L==="progress"){let j=typeof J=="number"?J:parseInt(J,10);j===100&&xe.status!=="completed"?I.status="completed":j>0&&j<100&&xe.status==="todo"?I.status="in-progress":j===0&&xe.status!=="todo"&&(I.status="todo");}return I}),ot[L]&&Ie(xe=>{let I={...xe};return delete I[L],I});},Ee=b.find(L=>L.id===ee.status)??Id[0],Dt=Rd.find(L=>L.id===ee.priority)??Rd[1],ht=Ao.find(L=>L.value===ee.color)??Ao[0],_e=c==="dark",dt={backgroundColor:_e?"#1d1f27":h.bgSecondary,border:`1px solid ${_e?"rgba(65,71,84,0.1)":h.borderLight}`,color:h.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:_e?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,border:`1px solid ${_e?"rgba(65,71,84,0.1)":h.border}`,boxShadow:_e?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:L=>L.stopPropagation(),children:jsxs("form",{onSubmit:st,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:ee.name,onChange:L=>bt("name",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:h.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),ot.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),ot.name]}),jsx("textarea",{value:ee.description||"",onChange:L=>bt("description",L.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:h.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":h.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:He,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&x(!y),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...dt,borderColor:Ee.color,backgroundColor:`${Ee.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:Ee.color}}),jsx("span",{style:{color:Ee.color},children:Ee.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:Ee.color}})]}),jsx(AnimatePresence,{children:y&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:b.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{bt("status",L.id),x(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:L.color}}),L.title,ee.status===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},L.id))})})]}),jsxs("div",{ref:$e,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&C(!w),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:Dt.color}}),jsx("span",{children:Dt.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:w&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Rd.map(L=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:J=>J.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:J=>J.currentTarget.style.backgroundColor="transparent",onClick:()=>{bt("priority",L.id),C(false);},children:[jsx("span",{children:L.icon}),L.label,ee.priority===L.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:h.accent}})]},L.id))})})]}),n.length>0&&jsxs("div",{ref:Pe,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&O(!P),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[ee.assignees&&ee.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:ee.assignees.slice(0,3).map((L,J)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:L.color||h.accent,borderColor:h.bgSecondary},children:L.initials},J))}),ee.assignees.length>3&&jsxs("span",{style:{color:h.textTertiary},children:["+",ee.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:h.textTertiary}}),jsx("span",{style:{color:h.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:P&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(L=>{let J=ee.assignees?.some(xe=>xe.name===L.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:h.textPrimary},onMouseEnter:xe=>xe.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:xe=>xe.currentTarget.style.backgroundColor="transparent",onClick:()=>{let xe=J?(ee.assignees||[]).filter(I=>I.name!==L.name):[...ee.assignees||[],{name:L.name,avatar:L.avatar,initials:L.name.split(" ").map(I=>I[0]).join("").toUpperCase().slice(0,2),color:h.accent}];bt("assignees",xe);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:h.accent},children:L.name.charAt(0).toUpperCase()}),jsx("span",{className:"truncate flex-1 text-left",children:L.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:J&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:h.accent}})})]},L.id)})})})]}),jsxs("div",{ref:je,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(T)D(false);else {if(je.current){let L=je.current.getBoundingClientRect(),J=window.innerHeight,xe=120,j=J-L.bottom<xe?L.top-xe-8:L.bottom+8;N({top:j,left:L.left});}D(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:dt,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:ee.color}}),jsx("span",{children:ht.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:h.textTertiary}})]}),jsx(AnimatePresence,{children:T&&jsxs(ga,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>D(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${M.top}px`,left:`${M.left}px`,zIndex:99999,backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:L=>L.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:Ao.slice(0,18).map(L=>{let J=ee.color===L.value;return jsx("button",{type:"button",onClick:xe=>{xe.preventDefault(),xe.stopPropagation(),bt("color",L.value),D(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:L.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:L.value,outline:J?`2px solid ${L.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},L.value)})})})})]})})]}),p.length>0||u?jsx(ls,{selectedTags:ee.tags||[],availableTags:p,onChange:L=>bt("tags",L),onCreateTag:u,theme:h,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:h.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:_e?"#191b22":h.bgSecondary,borderRadius:8,border:`1px solid ${_e?"rgba(65,71,84,0.05)":h.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:tt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!ee.isMilestone)if(z==="start")$(null);else {if(tt.current){let L=tt.current.getBoundingClientRect();W({top:L.bottom+8,left:Math.max(16,L.left-40)});}$("start"),A(ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:o||ee.isMilestone,children:ee.startDate?ee.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:h.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!ee.isMilestone)if(z==="end")$(null);else {if(tt.current){let L=tt.current.getBoundingClientRect();W({top:L.bottom+8,left:Math.max(16,L.left-40)});}$("end"),A(ee.endDate||ee.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...dt,opacity:ee.isMilestone?.5:1,cursor:ee.isMilestone?"not-allowed":"pointer"},disabled:o||ee.isMilestone,children:ee.endDate?ee.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:z&&jsxs(ga,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>$(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${Se.top}px`,left:`${Se.left}px`,zIndex:99999,backgroundColor:_e?"#0a0a0a":h.bgPrimary,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:L=>L.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${_e?"#262626":h.border}`},children:[(()=>{let L=new Date,J=new Date(L);J.setDate(L.getDate()+1);let xe=new Date(L);xe.setDate(L.getDate()+7);let I=new Date(L);return I.setDate(L.getDate()+14),[{label:"Hoy",date:L},{label:"Ma\xF1ana",date:J},{label:"Pr\xF3xima semana",date:xe},{label:"2 semanas",date:I}].map((ke,Ue)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:h.textPrimary},onMouseEnter:ue=>ue.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:ue=>ue.currentTarget.style.backgroundColor="transparent",onClick:()=>{z==="start"?(bt("startDate",ke.date),(!ee.endDate||ke.date>ee.endDate)&&bt("endDate",ke.date),$("end")):(bt("endDate",ke.date),(!ee.startDate||ke.date<ee.startDate)&&bt("startDate",ke.date),$(null));},children:ke.label},Ue))})(),jsx("div",{style:{borderTop:`1px solid ${h.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",onClick:()=>{bt("startDate",void 0),bt("endDate",void 0),$(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>A(new Date(Y.getFullYear(),Y.getMonth()-1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:h.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:h.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:Y.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>A(new Date(Y.getFullYear(),Y.getMonth()+1)),className:"p-1 rounded",onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:h.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["D","L","M","M","J","V","S"].map((L,J)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:h.textTertiary},children:L},J))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let L=Y.getFullYear(),J=Y.getMonth(),xe=new Date(L,J,1).getDay(),I=new Date(L,J+1,0).getDate(),j=new Date,ke=[];for(let ue=xe-1;ue>=0;ue--)ke.push({day:new Date(L,J,-ue).getDate(),date:new Date(L,J-1,new Date(L,J,-ue).getDate()),isCurrentMonth:false});for(let ue=1;ue<=I;ue++)ke.push({day:ue,date:new Date(L,J,ue),isCurrentMonth:true});let Ue=42-ke.length;for(let ue=1;ue<=Ue;ue++)ke.push({day:ue,date:new Date(L,J+1,ue),isCurrentMonth:false});return ke.map((ue,at)=>{let yt=ue.date.toDateString()===j.toDateString(),Ye=ee.startDate?.toDateString()===ue.date.toDateString(),vt=ee.endDate?.toDateString()===ue.date.toDateString(),Xt=ee.startDate&&ee.endDate&&ue.date>=ee.startDate&&ue.date<=ee.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:ue.isCurrentMonth?Ye||vt?"#FFF":h.textPrimary:h.textTertiary,backgroundColor:Ye?h.accent:vt?"#7C3AED":Xt?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:yt&&!Ye&&!vt?`inset 0 0 0 1px ${h.accent}`:"none"},onClick:()=>{z==="start"?(bt("startDate",ue.date),ee.endDate&&ue.date>ee.endDate&&bt("endDate",ue.date),$("end")):(bt("endDate",ue.date),ee.startDate&&ue.date<ee.startDate&&bt("startDate",ue.date),$(null));},children:ue.day},at)})})()})]})]})]})})]}),ot.endDate&&jsx("span",{className:"text-xs text-red-400",children:ot.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:h.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[ee.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:_e?"#33343c":"#E5E7EB"},onClick:L=>{if(o)return;let J=L.currentTarget.getBoundingClientRect(),xe=Math.round((L.clientX-J.left)/J.width*100/5)*5;bt("progress",Math.max(0,Math.min(100,xe)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${ee.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${_e?"rgba(65,71,84,0.05)":h.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>R(!Ce),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:h.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${Ce?"":"-rotate-90"}`,style:{color:h.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:Ce&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:h.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:h.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:ee.effortMinutes?nk(ee.effortMinutes):"",onChange:L=>{let J=ok(L.target.value);bt("effortMinutes",J);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:h.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:h.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:ee.parentId||"",onChange:L=>bt("parentId",L.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(L=>L.id!==a?.id).map(L=>jsx("option",{value:L.id,children:L.name},L.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:h.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:ee.location||"",onChange:L=>bt("location",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:h.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:ee.equipment||"",onChange:L=>bt("equipment",L.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textPrimary,border:`1px solid ${h.borderLight}`},disabled:o})]})]}),(m||d.length>0||i==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:h.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:h.textTertiary},children:["Adjuntos ",i==="create"?we.length>0&&`(${we.length})`:d.length>0&&`(${d.length})`]})]}),i==="create"?jsx(ps,{cardId:"pending",attachments:we.map((L,J)=>({id:`pending-${J}`,cardId:"pending",name:L.name,size:L.size,type:L.type,url:URL.createObjectURL(L),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:L=>G(J=>[...J,...L]),onDelete:L=>{let J=parseInt(L.replace("pending-",""),10);G(xe=>xe.filter((I,j)=>j!==J));},maxSizeMB:10,maxFiles:20}):jsx(ps,{cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?L=>m(a.id,L):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),i==="create"&&we.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:h.textTertiary},children:[we.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:L=>L.currentTarget.style.backgroundColor=h.hoverBg,onMouseLeave:L=>L.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:ee.isMilestone,onChange:L=>bt("isMilestone",L.target.checked),className:"w-4 h-4 rounded",style:{accentColor:h.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:h.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:h.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),ee.dependencies&&ee.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:ee.dependencies.map(L=>{let J=r.find(xe=>xe.id===L);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${h.accent}20`,color:h.accent},children:[J?.name||L.slice(0,8),jsx("button",{type:"button",onClick:()=>{let xe=(ee.dependencies||[]).filter(I=>I!==L);bt("dependencies",xe);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},L)})}),jsxs("button",{type:"button",onClick:()=>{oe(!Ve),le("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:h.bgSecondary,color:h.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:Ve&&jsxs(Fragment,{children:[jsx("div",{className:"fixed inset-0 z-40",onClick:()=>{oe(false),le("");}}),jsxs(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:_e?"#0a0a0a":h.bgPrimary,backdropFilter:_e?"blur(16px)":void 0,border:`1px solid ${_e?"#262626":h.border}`,boxShadow:_e?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${h.border}`},children:jsx("input",{type:"text",value:Be,onChange:L=>le(L.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:h.bgSecondary,color:h.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(L=>L.id!==a?.id).filter(L=>Be===""||L.name.toLowerCase().includes(Be.toLowerCase())).map(L=>{let J=ee.dependencies?.includes(L.id);return jsxs("button",{type:"button",onClick:()=>{let xe=ee.dependencies||[],I;J?I=xe.filter(j=>j!==L.id):I=[...xe,L.id],bt("dependencies",I);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:J?`${h.accent}10`:"transparent"},onMouseEnter:xe=>{J||(xe.currentTarget.style.backgroundColor=h.hoverBg);},onMouseLeave:xe=>{xe.currentTarget.style.backgroundColor=J?`${h.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:J?h.accent:"transparent",borderColor:J?h.accent:h.borderLight},children:J&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:h.textPrimary},children:L.name}),jsx("span",{className:"text-[10px]",style:{color:h.textTertiary},children:L.id.slice(0,8)})]})]},L.id)}),r.filter(L=>L.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:h.textTertiary},children:"No hay tareas disponibles"})]})]})]})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${_e?"rgba(65,71,84,0.1)":h.border}`,backgroundColor:_e?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:h.textTertiary},onMouseEnter:L=>L.currentTarget.style.color=h.textPrimary,onMouseLeave:L=>L.currentTarget.style.color=h.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:L=>!o&&(L.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:L=>!o&&(L.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:i==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var Pg=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
368
|
+
Task dependencies must flow in one direction only.`);return}let K=se=>se.map(me=>{if(me.id===L){let rt=me.dependencies||[];if(!rt.includes(T.id)){let We=[...(me.dependencyLinks??[]).filter(Mt=>Mt.id!==T.id),{id:T.id,type:U,lag:0}];return {...me,dependencies:[...rt,T.id],dependencyLinks:We}}}return me.subtasks?{...me,subtasks:K(me.subtasks)}:me});sn.current+=1,je(se=>K(se)),Y?.(T.id,L,U);},[Y,Yp]),Jp=useCallback((T,L)=>{let U=K=>K.map(se=>{if(se.id===T&&se.dependencies){let me=se.dependencies.filter(rt=>rt!==L);return {...se,dependencies:me}}return se.subtasks?{...se,subtasks:U(se.subtasks)}:se});sn.current+=1,je(K=>U(K)),Le?.(T,L);},[Le]),{startDate:Nr,endDate:nd,primeraTarea:Qp,ultimaTarea:Zp,primeraPendiente:em}=useMemo(()=>{let T=$e.flattenTasks(Se).filter(Pt=>Pt.startDate&&!Pt.subtasks?.length&&(Pt.progress??0)<100&&Pt.status!=="completed").map(Pt=>Pt.startDate.getTime()),L=T.length?new Date(Math.min(...T)):null,U=Se.filter(Pt=>Pt.startDate&&Pt.endDate);if(U.length===0){let Pt=new Date,La=new Date(Pt);La.setDate(La.getDate()-30);let nr=new Date(Pt);return nr.setDate(nr.getDate()+60),{startDate:Pu(La,we),endDate:nr,primeraTarea:null,ultimaTarea:null,primeraPendiente:L}}let K=U.flatMap(Pt=>[Pt.startDate,Pt.endDate]).filter(Pt=>Pt!==void 0),se=new Date(Math.min(...K.map(Pt=>Pt.getTime()))),me=new Date(Math.max(...K.map(Pt=>Pt.getTime()))),rt=new Date(se),We=new Date(me),Mt=H0(se,me,new Date);se.setTime(Mt.inicio.getTime()),me.setTime(Mt.fin.getTime());let jt=we==="day"?7:we==="week"?14:30;return se.setDate(se.getDate()-jt),me.setDate(me.getDate()+jt),{startDate:Pu(se,we),endDate:me,primeraTarea:rt,ultimaTarea:We,primeraPendiente:L}},[Se,we]);useEffect(()=>{At.current?.(Nr,nd);},[Nr,nd]);let tm=useCallback(async()=>{if(!mo.current||!Xn.current||!mr.current)return;await new Promise(xn=>setTimeout(xn,200));let T=mo.current,L=Xn.current,U=rs.current||L.querySelector(".gantt-grid-scroll"),K=mr.current,se=U?.scrollTop||0,me=U?.scrollLeft||0,rt=K.scrollTop,We=K.scrollLeft,Mt=T.style.overflow,jt=T.style.height,Pt=U?.style.overflow||"",La=K.style.overflow,nr=L.style.overflow,en=T.style.width,tn=K.style.width;try{let xn=U?.querySelector(".gantt-taskgrid-content"),Qn=K.querySelector("svg"),yi=Qn?.getAttribute("height")?parseInt(Qn.getAttribute("height"),10):Qn?.getBoundingClientRect().height||0,Mo=xn?.scrollHeight||U?.scrollHeight||600,yl=Math.max(yi,K.scrollHeight),xi=Qn?.getAttribute("width")?parseInt(Qn.getAttribute("width"),10):Qn?.getBoundingClientRect().width||K.scrollWidth,ly=T.querySelector('[style*="z-index: 100"]')?.offsetHeight||48,ld=Math.max(Mo,yl,yi),um=ly+ld+50,pm=(U?.offsetWidth||L.offsetWidth||300)+xi+10;U&&(U.scrollTop=0,U.scrollLeft=0),K.scrollTop=0,K.scrollLeft=0,T.style.overflow="visible",T.style.height=`${um}px`,T.style.width=`${pm}px`,L.style.overflow="visible",U&&(U.style.overflow="visible",U.style.height=`${ld+50}px`),K.style.overflow="visible",K.style.height=`${ld+50}px`,K.style.width=`${xi+10}px`,await new Promise(xl=>setTimeout(xl,150));let cy=await toPng(T,{backgroundColor:ea.bgPrimary,pixelRatio:2,width:pm,height:um,skipFonts:!1,filter:xl=>{if(!(xl instanceof Element))return !0;let mm=window.getComputedStyle(xl),gm=parseInt(mm.zIndex,10);return !(!isNaN(gm)&&gm>=50||mm.position==="fixed")}}),cd=document.createElement("a");cd.download=`gantt-chart-${new Date().toISOString().slice(0,10)}.png`,cd.href=cy,cd.click();}finally{T.style.overflow=Mt,T.style.height=jt,T.style.width=en,L.style.overflow=nr,U&&(U.style.overflow=Pt,U.style.height="",U.scrollTop=se,U.scrollLeft=me),K.style.overflow=La,K.style.height="",K.style.width=tn,K.scrollTop=rt,K.scrollLeft=We;}u?.("png");},[ea,u]),am=useCallback(async()=>{await $e.exportToPDF(Se),u?.("pdf");},[Se,u]),od=useRef({rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p});od.current={rateMap:a.rateMap,defaultRate:a.defaultRate,projectName:p};let rm=useCallback(async()=>{if(a.onExportExcel){await a.onExportExcel(),u?.("excel");return}let T=new Date,L=se=>String(se).padStart(2,"0"),U=`${T.getFullYear()}-${L(T.getMonth()+1)}-${L(T.getDate())}_${L(T.getHours())}${L(T.getMinutes())}`,K=p?p.replace(/[^a-zA-Z0-9áéíóúñÁÉÍÓÚÑ _-]/g,""):"Project";await $e.exportToExcel(Se,`${K}_${U}.xlsx`,od.current),u?.("excel");},[Se,p,u,a.onExportExcel]),ty=useCallback(()=>{let T=$e.exportToCSV(Se),L=new Blob([T],{type:"text/csv;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(L),U.download="gantt-chart.csv",U.click(),URL.revokeObjectURL(U.href),u?.("csv");},[Se,u]),ay=useCallback(()=>{let T=$e.exportToJSON(Se),L=new Blob([T],{type:"application/json;charset=utf-8;"}),U=document.createElement("a");U.href=URL.createObjectURL(L),U.download="gantt-chart.json",U.click(),URL.revokeObjectURL(U.href),u?.("json");},[Se,u]),nm=useCallback(()=>{$e.exportToMSProject(Se,"Gantt Project","project.xml"),u?.("msproject");},[Se,u]),ry=T=>{T.preventDefault(),P(true);},Is=useRef(false),[sd,om]=useState(false),hi=useRef({x:0,y:0,scrollLeft:0,scrollTop:0});useEffect(()=>{let T=mr.current,L=Xn.current?.querySelector(".gantt-grid-scroll");if(!T||!L)return;let U=()=>{if(Is.current)return;Is.current=true;let We=T.scrollTop;X(We),L.scrollTop=We,requestAnimationFrame(()=>{Is.current=false;});},K=()=>{if(Is.current)return;Is.current=true;let We=L.scrollTop;X(We),T.scrollTop=We,requestAnimationFrame(()=>{Is.current=false;});},se=We=>{if(F&&L){let jt=L.parentElement?.getBoundingClientRect()?.left||0,Pt=We.clientX-jt,La=200,nr=As+gl,en=window.innerWidth*fl,tn=Math.max(nr,en);Pt>=La&&Pt<=tn&&j(Pt);}if(sd&&T){let Mt=We.clientX-hi.current.x,jt=We.clientY-hi.current.y;T.scrollLeft=hi.current.scrollLeft-Mt,T.scrollTop=hi.current.scrollTop-jt;}},me=()=>{P(false),om(false);},rt=We=>{if(We.button!==0)return;let Mt=We.target;Mt.closest("[data-task-bar]")||Mt.closest("[data-dependency-line]")||Mt.closest("button")||Mt.closest('[role="button"]')||Mt.tagName==="rect"&&Mt.getAttribute("data-clickable")==="true"||(om(true),hi.current={x:We.clientX,y:We.clientY,scrollLeft:T.scrollLeft,scrollTop:T.scrollTop},We.preventDefault());};return T.addEventListener("scroll",U),L.addEventListener("scroll",K),T.addEventListener("mousedown",rt),document.addEventListener("mousemove",se),document.addEventListener("mouseup",me),()=>{T.removeEventListener("scroll",U),L.removeEventListener("scroll",K),T.removeEventListener("mousedown",rt),document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",me);}},[F,sd,As]),Jn.current={startDate:Nr,timeScale:we,zoom:Oe};let id=a.onTodayVisibilityChange,sm=useRef(void 0);useEffect(()=>{if(!id)return;let T=mr.current;if(!T)return;let L=no(we),U=()=>{let me=(new Date().getTime()-Nr.getTime())/(1e3*60*60*24)*L*Oe,rt=T.scrollLeft,We=rt+T.clientWidth,Mt=U0(me,rt,We);sm.current!==Mt&&(sm.current=Mt,id(Mt===null,Mt));};return U(),T.addEventListener("scroll",U,{passive:true}),window.addEventListener("resize",U),()=>{T.removeEventListener("scroll",U),window.removeEventListener("resize",U);}},[id,Nr,we,Oe]);let hl=useRef(false),[im,ny]=useState(0),oy=useRef(null);useLayoutEffect(()=>{if(hl.current)return;let T=Se.length===0;if(!mr.current)return;if(mr.current.clientWidth===0){if(im>120)return;let Mt=requestAnimationFrame(()=>ny(jt=>jt+1));return ()=>cancelAnimationFrame(Mt)}T||(hl.current=true,oy.current=Nr);let L=mr.current,U=T?new Date:W0(Qp,Zp,new Date,em),K=no(we),se=(U.getTime()-Nr.getTime())/(1e3*60*60*24),me=L.clientWidth,We=se*K*Oe-me/2;se>=0&&me>0&&(L.scrollLeft=Math.max(0,We));},[Se.length,Nr,we,Oe,im,Qp,Zp,em]);let lm=useRef(null),cm=useRef(null);useLayoutEffect(()=>{let T=cm.current;if(cm.current={timeScale:we,zoom:Oe},!T||T.timeScale===we&&T.zoom===Oe)return;let L=mr.current,U=lm.current;if(!L||!U||L.clientWidth===0)return;let K=(U.getTime()-Nr.getTime())/864e5*no(we)*Oe;L.scrollLeft=Math.max(0,K-L.clientWidth/2);},[we,Oe,Nr]);let[sy,iy]=useState(null);useEffect(()=>{let T=mr.current;if(!T)return;let L=0,U=()=>{cancelAnimationFrame(L),L=requestAnimationFrame(()=>{let K=T.scrollLeft,se=K+T.clientWidth;if(iy(me=>me&&me.izq===K&&me.der===se?me:{izq:K,der:se}),hl.current&&T.clientWidth>0){let me=(K+T.clientWidth/2)/(no(we)*Oe);lm.current=new Date(Nr.getTime()+me*864e5);}});};return U(),T.addEventListener("scroll",U,{passive:true}),window.addEventListener("resize",U),()=>{cancelAnimationFrame(L),T.removeEventListener("scroll",U),window.removeEventListener("resize",U);}},[we,Oe,Nr]);let dm=useRef(null);return useLayoutEffect(()=>{let T=dm.current;if(dm.current={t:Nr.getTime(),timeScale:we,zoom:Oe},!T||!hl.current||T.timeScale!==we||T.zoom!==Oe||T.t===Nr.getTime())return;let L=mr.current;if(!L)return;let U=no(we),K=(T.t-Nr.getTime())/(1e3*60*60*24);L.scrollLeft=Math.max(0,L.scrollLeft+K*U*Oe);},[Nr,we,Oe]),useLayoutEffect(()=>{let T=Ft.current;!T||Jn.current?.timeScale!==we||(Ft.current=null,bt(T));},[we,Nr,Oe]),jsx(ls.Provider,{value:Ba,children:jsx(gd.Provider,{value:rd,children:jsxs("div",{ref:mo,className:"flex flex-col h-full w-full",style:{backgroundColor:ea.bgPrimary,fontFamily:"Inter, sans-serif",minHeight:0,...ea.dotGrid&&{backgroundImage:`radial-gradient(circle, ${ea.dotGrid} 1px, transparent 1px)`,backgroundSize:"24px 24px"},...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:[(()=>{let T=R&&V?jsx(f0,{timeScale:we,onTimeScaleChange:ot,rowDensity:mt,onRowDensityChange:Zt,taskFilter:ft,onTaskFilterChange:_a,hideCompleted:ma,onHideCompletedChange:ta,toolbarRightContent:S,showCreateTaskButton:M&&Ae?.canCreateTask!==false&&!Ae?.canCreateSubtaskOnly,createTaskLabel:H,onCreateTask:E,wbsLevel:la,onWbsLevelChange:W?void 0:mi,maxWbsDepth:Fr,viewMode:gt,onViewModeChange:pe?Ie:void 0,showCriticalPath:I,onShowCriticalPathChange:qe,showDependencies:Re,onShowDependenciesChange:Ze,highlightWeekends:_e,onHighlightWeekendsChange:Ct,hasDependencies:ee,onExportPNG:l?tm:void 0,onExportPDF:l?am:void 0,onExportExcel:l?rm:void 0,onExportMSProject:l?nm:void 0,onCopySnapshotLink:Et,masOpciones:A}):jsx(Ql,{enCabecera:!!V,theme:ea,timeScale:we,onTimeScaleChange:ot,zoom:Oe,onZoomChange:Wa,currentTheme:O,onThemeChange:kt,rowDensity:mt,onRowDensityChange:Zt,showThemeSelector:c,showCreateTaskButton:M&&Ae?.canCreateTask!==false&&!Ae?.canCreateSubtaskOnly,createTaskLabel:H,onCreateTask:E,taskFilter:ft,onTaskFilterChange:_a,hideCompleted:ma,onHideCompletedChange:ta,toolbarRightContent:S,wbsLevel:la,onWbsLevelChange:W?void 0:mi,maxWbsDepth:Fr,viewMode:gt,onViewModeChange:pe?Ie:void 0,projectForecast:nt,hideForecastHud:Ue,currencyCode:$,onExportPNG:l?tm:void 0,onExportPDF:l?am:void 0,onExportExcel:l?rm:void 0,onExportCSV:l?ty:void 0,onExportJSON:l?ay:void 0,onExportMSProject:l?nm:void 0,showCriticalPath:I,onShowCriticalPathChange:qe,showDependencies:Re,onShowDependenciesChange:Ze,highlightWeekends:_e,onHighlightWeekendsChange:Ct,showBaseline:Lt,onShowBaselineChange:L=>{if(le){le(L);return}L&>!=="oracle"&&Ie("oracle"),!L&>==="oracle"&&Ie("execution");},onCopySnapshotLink:Et,hasDependencies:ee});return V?createPortal(T,V):jsx("div",{style:{position:"relative",zIndex:100},children:T})})(),jsxs("div",{ref:Xn,className:"flex-1 flex min-h-0",style:{position:"relative",zIndex:1,overflow:"clip",overflowClipMargin:"100px"},children:[Se.length===0&&E&&jsx("div",{"data-gantt-vacio":true,style:{position:"absolute",inset:0,zIndex:20,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:jsxs("div",{style:{pointerEvents:"auto",textAlign:"center",padding:"28px 32px",borderRadius:14,maxWidth:360,background:ea.bgSecondary||ea.bgPrimary,border:`1px solid ${ea.border}`,boxShadow:"0 10px 30px rgba(0,0,0,0.10)"},children:[jsx("div",{style:{fontSize:15,fontWeight:600,color:ea.textPrimary,marginBottom:6},children:Ar?"Este proyecto a\xFAn no tiene tareas":"This project has no tasks yet"}),jsx("div",{style:{fontSize:12.5,color:ea.textSecondary,marginBottom:16,lineHeight:1.45},children:Ar?"Crea la primera y el cronograma empezar\xE1 a dibujarse desde hoy.":"Create the first one and the timeline starts from today."}),jsxs("button",{type:"button",onClick:E,style:{display:"inline-flex",alignItems:"center",gap:6,padding:"8px 14px",borderRadius:8,border:"none",cursor:"pointer",background:ea.accent||"#00E5CC",color:"#fff",fontSize:13,fontWeight:600},children:["+ ",Ar?"Crear la primera tarea":"Create the first task"]})]})}),jsx("div",{ref:rs,className:"gantt-grid-scroll flex-shrink-0",style:{width:bl,overflowX:"auto",overflowY:"scroll",scrollbarWidth:"none",msOverflowStyle:"none"},children:jsx(ac,{v6:!!R,resumenV6:ne,onContraerTodo:R?Me:void 0,addTaskRow:a.addTaskRow,tasks:Ge,allTasks:oe,theme:ea,rowHeight:He,availableUsers:d,templates:C,showCriticalPath:I,onTaskClick:ie,onTaskSelectionChange:et,selectedTaskId:Xe,onTaskDblClick:qp,onTaskContextMenu:ct,onTaskToggle:ht,scrollTop:G,columns:ad??Vr,onToggleColumn:Nt,onColumnResize:aa,onTaskUpdate:Ut,onBulkFill:oa,onTaskIndent:ga,onTaskOutdent:Rt,onTaskMove:ua,onMultiTaskDelete:Ma,onTaskDuplicate:Ka,onTaskCreate:ln,onTaskRename:Ir,onCreateSubtask:Pn,onTaskDependencies:a.onTaskDependencies,onOpenTaskModal:ie?T=>ie(T):void 0,onDeleteRequest:(T,L)=>lt({taskIds:T,taskName:L}),onTaskReparent:Bt,scrollContainerRef:rs})}),jsx("div",{className:"flex-shrink-0 cursor-col-resize hover:bg-[#00E5CC]/50 transition-colors h-full",style:{width:1,backgroundColor:ea.border,zIndex:15},onMouseDown:ry}),jsx("div",{ref:mr,className:"gantt-timeline-scroll flex-1",tabIndex:0,role:"region","aria-label":Ar?"Cronograma":"Timeline",style:{minHeight:0,overflowX:"auto",overflowY:"auto",cursor:sd?"grabbing":"grab",...a.disableScrollSync&&{scrollBehavior:"auto",overflowAnchor:"none"}},children:jsx(gc,{v6:!!R,alturaCabecera:R?60:void 0,alturaBarra:R?ze[mt].barra:void 0,tasks:Ge,theme:ea,rowHeight:He,timeScale:we,startDate:Nr,endDate:nd,zoom:Oe,locale:y,templates:C,dependencyLineStyle:a?.dependencyLineStyle,showTaskBarLabels:a?.showTaskBarLabels!==false,onTaskClick:ie,onTaskDblClick:qp,onTaskContextMenu:Zh,onTaskDateChange:cn,onTaskProgressDrag:yn,onDependencyCreate:Xp,onDependencyDelete:Jp,showBaseline:Lt,showCriticalPath:I,showDependencies:Re,highlightWeekends:_e,weekHeaderFormat:a.weekHeaderFormat,canEditTask:Ae?.canEditTask,workingDaysConfig:a?.workingDaysConfig,ventanaVisible:sy,onIrAFecha:T=>bt(T,"center"),finPlaneado:a?.finPlaneado??null,finPrevisto:a?.projectForecast?.expectedFinish??null})})]}),J.task&&jsx(_s,{isOpen:J.isOpen,x:J.x,y:J.y,theme:ea,onClose:()=>be({isOpen:false,x:0,y:0,task:null}),items:(()=>{let T=J.task;if(!T)return [];let L=$e.findTaskById(Se,T.id)||T,U=L.subtasks&&L.subtasks.length>0,K=Ae?.canCreateTask!==false,se=Ae?.canDeleteTask!==false;if(U){let jt=[],Pt=Ae?.canDuplicateTask!==false;return K&&jt.push({id:"addSubtask",label:Ba.contextMenu?.addSubtask||"Add Subtask",icon:ha.Add,onClick:()=>{Jt?Jt(L):Pn(L.id);}}),Pt&&jt.push({id:"duplicate",label:Ba.contextMenu?.duplicateTask||"Duplicate Task",icon:ha.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(L):je(La=>Vi(La,[L.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),se&&(jt.length>0&&jt.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),jt.push({id:"delete",label:Ba.contextMenu?.deleteTask||"Delete Task",icon:ha.Delete,onClick:()=>{lt({taskIds:[L.id],taskName:L.name});}})),jt}let me=Ae?.canUpdateTask!==false,rt=Ae?.canDuplicateTask!==false,We=[];return me&&We.push({id:"edit",label:Ba.contextMenu?.editTask||"Edit Task",icon:ha.Pencil,onClick:()=>{xt?xt(L):De(L);}}),K&&We.push({id:"addSubtask",label:Ba.contextMenu?.addSubtask||"Add Subtask",icon:ha.Add,onClick:()=>{Jt?Jt(L):Pn(L.id);}}),me&&(a.onTaskDependencies||xt)&&We.push({id:"dependencies",label:Ba.contextMenu?.dependencies||"Dependencies\u2026",icon:ha.Link,onClick:()=>{a.onTaskDependencies?a.onTaskDependencies(L):xt?.(L),be({isOpen:false,x:0,y:0,task:null});}}),We.length>0&&me&&We.push({id:"separator-status",label:"",separator:true,onClick:()=>{}}),me&&(We.push({id:"markIncomplete",label:Ba.contextMenu?.markIncomplete||"Mark Incomplete",icon:ha.MarkIncomplete,onClick:()=>{Wt?Wt(L):Ut(L.id,{status:"todo",progress:0});},disabled:L.status==="todo"}),We.push({id:"setInProgress",label:Ba.contextMenu?.setInProgress||"Set In Progress",icon:ha.SetInProgress,onClick:()=>{Qt?Qt(L):Ut(L.id,{status:"in-progress"});},disabled:L.status==="in-progress"}),We.push({id:"markComplete",label:Ba.contextMenu?.markComplete||"Mark Complete",icon:ha.MarkComplete,onClick:()=>{Ut(L.id,{status:"completed",progress:100});},disabled:L.status==="completed"})),(rt||me&&L.startDate&&L.endDate)&&We.length>0&&We.push({id:"separator-advanced",label:"",separator:true,onClick:()=>{}}),rt&&We.push({id:"duplicate",label:Ba.contextMenu?.duplicateTask||"Duplicate Task",icon:ha.Duplicate,onClick:()=>{a.onTaskDuplicate?a.onTaskDuplicate(L):je(jt=>Vi(jt,[L.id]).tasks),be({isOpen:false,x:0,y:0,task:null});}}),me&&L.startDate&&L.endDate&&We.push({id:"split",label:Ba.contextMenu?.splitTask||"Split Task",icon:ha.Split,onClick:()=>{let jt=L.startDate.getTime(),Pt=L.endDate.getTime(),La=jt+(Pt-jt)/2,nr=new Date(La);ey(L,nr);}}),se&&(We.length>0&&We.push({id:"separator-delete",label:"",separator:true,onClick:()=>{}}),We.push({id:"delete",label:Ba.contextMenu?.deleteTask||"Delete Task",icon:ha.Delete,onClick:()=>{lt({taskIds:[L.id],taskName:L.name});}})),We})()}),jsx(ds,{task:Be,isOpen:!!Be,onClose:()=>De(null),onTaskUpdate:T=>{Be&&(Ut(Be.id,T),De(null));},theme:O==="light"?"light":"dark",locale:y==="es"?"es":"en",availableUsers:d,availableTasks:t}),jsx(AnimatePresence,{children:Ne&&jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[10000] flex items-center justify-center p-4",style:{backgroundColor:"rgba(0, 0, 0, 0.6)"},onClick:()=>lt(null),children:jsxs(motion.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.2,ease:"easeOut"},onClick:T=>T.stopPropagation(),className:"w-full max-w-md rounded-xl shadow-2xl overflow-hidden",style:{backgroundColor:ea.bgSecondary,border:`1px solid ${ea.border}`},children:[jsx("div",{className:"px-6 py-4",style:{borderBottom:`1px solid ${ea.border}`},children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0",style:{backgroundColor:"rgba(239, 68, 68, 0.2)"},children:jsx(AlertTriangle,{className:"w-5 h-5",style:{color:"#EF4444"}})}),jsxs("div",{className:"flex-1",children:[jsxs("h3",{className:"text-lg font-semibold",style:{color:ea.textPrimary,fontFamily:"Inter, sans-serif"},children:[Ba.contextMenu?.deleteTask||"Delete Task","?"]}),jsx("p",{className:"text-sm mt-1",style:{color:ea.textSecondary,fontFamily:"Inter, sans-serif"},children:y==="es"?"Esta acci\xF3n no se puede deshacer":"This action cannot be undone"})]})]})}),jsx("div",{className:"px-6 py-4",children:jsx("p",{className:"text-sm leading-relaxed",style:{color:ea.textSecondary,fontFamily:"Inter, sans-serif"},children:Ne.taskIds.length>1?jsxs(Fragment,{children:[y==="es"?"Est\xE1s a punto de eliminar":"You are about to delete"," ",jsxs("span",{className:"font-semibold",style:{color:ea.textPrimary},children:[Ne.taskIds.length," ",y==="es"?"tareas":"tasks"]}),"."]}):jsxs(Fragment,{children:[y==="es"?"Est\xE1s a punto de eliminar la tarea":"You are about to delete the task"," ",jsxs("span",{className:"font-semibold",style:{color:ea.textPrimary},children:['"',Ne.taskName,'"']}),"."]})})}),jsxs("div",{className:"px-6 py-4 flex items-center justify-end gap-3",style:{backgroundColor:ea.bgPrimary,borderTop:`1px solid ${ea.border}`},children:[jsx("button",{onClick:()=>lt(null),className:"px-4 py-2 text-sm font-medium rounded-lg transition-colors",style:{color:ea.textSecondary,fontFamily:"Inter, sans-serif"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor=ea.hoverBg;},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="transparent";},children:y==="es"?"Cancelar":"Cancel"}),jsxs("button",{onClick:()=>{Ma(Ne.taskIds),lt(null);},className:"px-4 py-2 text-sm font-medium text-white rounded-lg transition-colors flex items-center gap-2",style:{backgroundColor:"#EF4444",fontFamily:"Inter, sans-serif"},onMouseEnter:T=>{T.currentTarget.style.backgroundColor="#DC2626";},onMouseLeave:T=>{T.currentTarget.style.backgroundColor="#EF4444";},children:[jsx(Trash2,{className:"w-4 h-4"}),y==="es"?"Eliminar":"Delete"]})]})]})})}),x?.enabled&&jsx(hc,{tasks:Se,theme:ea,config:x,onTasksUpdate:je,onTaskUpdate:Ut,onTaskCreate:T=>{je(L=>[...L,T]);},onTaskDelete:T=>{Ma([T]);},onDependencyCreate:(T,L,U)=>{let K=$e.findTaskById(Se,T);K&&Xp(K,L,U);},onDependencyDelete:Jp})]})})})});function Vk(e){if(e<60)return `${e}m`;let t=Math.floor(e/60),a=e%60;return a===0?`${t}h`:`${t}h ${a}m`}function Gk(e){if(!e||e.trim()==="")return null;let t=e.trim().toLowerCase(),a=t.match(/(\d+)h\s*(\d+)m/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/(\d+)h/);if(r&&r[1])return parseInt(r[1],10)*60;let n=t.match(/(\d+)m/);if(n&&n[1])return parseInt(n[1],10);let s=t.match(/(\d+)d/);if(s&&s[1])return parseInt(s[1],10)*480;let o=t.match(/^(\d+)$/);return o&&o[1]?parseInt(o[1],10)*60:null}var kc=[{id:"todo",title:"Por hacer",color:"#6B7280"},{id:"in-progress",title:"En progreso",color:"#F59E0B"},{id:"completed",title:"Completada",color:"#10B981"}],Fu=[{id:"low",label:"Baja",color:"#10B981",icon:"\u{1F7E2}"},{id:"medium",label:"Media",color:"#F59E0B",icon:"\u{1F7E1}"},{id:"high",label:"Alta",color:"#F97316",icon:"\u{1F7E0}"},{id:"urgent",label:"Urgente",color:"#EF4444",icon:"\u{1F534}"}];function ef({isOpen:e,onClose:t,task:a,availableTasks:r=[],availableUsers:n=[],onSubmit:s,isLoading:o=false,mode:i=a?"edit":"create",theme:c="dark",customStatuses:l=[],availableTags:u=[],onCreateTag:p,attachments:d=[],onUploadAttachments:m,onDeleteAttachment:f,defaultStatus:v}){let b=bo(),w={todo:"To do","in-progress":"In progress",completed:"Completed"},h=new Set(kc.flatMap(O=>[O.title.toLowerCase(),(w[O.id]??"").toLowerCase(),"por hacer","en progreso","completada","completado","to do","in progress","completed","done"])),x=[...kc.map(O=>b?O:{...O,title:w[O.id]??O.title}),...l.filter(O=>!kc.some(re=>re.id===O.id)&&!h.has((O.title??"").trim().toLowerCase()))],y=Dt[c]||Dt.dark,[k,M]=useState(false),[H,E]=useState(false),[N,D]=useState(false),[S,V]=useState(false),[W,R]=useState({top:0,left:0}),[A,ve]=useState(null),[q,le]=useState(new Date),[B,pe]=useState({top:0,left:0}),[nt,Ue]=useState(false),[$,fe]=useState([]),[ie,et]=useState(false),Xe=k||H||N||S||A!==null||ie;useEffect(()=>{if(!e||Xe)return;let O=re=>{re.key==="Escape"&&t();};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[e,Xe,t]);let[Qe,ct]=useState(""),Tt=useRef(null),_t=useRef(null);useEffect(()=>{if(!ie)return;let O=we=>{let ot=we.target;Tt.current?.contains(ot)||_t.current?.contains(ot)||(et(false),ct(""));},re=we=>{we.key==="Escape"&&(we.stopPropagation(),et(false));};return document.addEventListener("mousedown",O),document.addEventListener("keydown",re,true),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",re,true);}},[ie]);let tt=useRef(null),xt=useRef(null),Jt=useRef(null),Wt=useRef(null),Qt=useRef(null),[Y,Le]=useState({name:"",description:"",progress:0,status:"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],tags:[],parentId:null,location:"",equipment:""}),[Ye,he]=useState({});useEffect(()=>{a?(Le({name:a.name,description:a.description||"",startDate:a.startDate,endDate:a.endDate,progress:a.progress,status:a.status||"todo",priority:a.priority||"medium",isMilestone:a.isMilestone||false,color:a.color||"#00E5CC",assignees:a.assignees||[],dependencies:a.dependencies||[],tags:a.tags||[],parentId:a.parentId||null,location:a.location||"",equipment:a.equipment||""}),(a.dependencies&&a.dependencies.length>0||a.isMilestone)&&Ue(true)):(Le({name:"",description:"",progress:0,status:v||"todo",priority:"medium",isMilestone:false,color:"#00E5CC",assignees:[],dependencies:[],pendingFiles:[],tags:[],parentId:null,location:"",equipment:""}),Ue(false),fe([]));},[a,e,v]),useEffect(()=>{let O=re=>{tt.current&&!tt.current.contains(re.target)&&M(false),xt.current&&!xt.current.contains(re.target)&&E(false),Jt.current&&!Jt.current.contains(re.target)&&D(false),Wt.current&&!Wt.current.contains(re.target)&&V(false);};return document.addEventListener("mousedown",O),()=>document.removeEventListener("mousedown",O)},[]);let dt=()=>{let O={};return Y.name.trim()||(O.name="El nombre es requerido"),Y.startDate&&Y.endDate&&Y.startDate>Y.endDate&&(O.endDate="La fecha de fin debe ser posterior a la de inicio"),he(O),Object.keys(O).length===0},wt=async O=>{if(O.preventDefault(),!!dt())try{let re=i==="create"&&$.length>0?{...Y,pendingFiles:$}:Y;await s(re),fe([]),t();}catch(re){console.error("Error submitting task:",re);}},ue=(O,re)=>{Le(we=>{let ot={...we,[O]:re};if(O==="status"){let mt=re;mt==="todo"?ot.progress=0:mt==="in-progress"?(we.progress===0||we.progress===100)&&(ot.progress=50):mt==="completed"||mt==="closed"?ot.progress=100:(mt==="in-review"||mt==="review")&&(ot.progress=75);}if(O==="progress"){let mt=typeof re=="number"?re:parseInt(re,10);mt===100&&we.status!=="completed"?ot.status="completed":mt>0&&mt<100&&we.status==="todo"?ot.status="in-progress":mt===0&&we.status!=="todo"&&(ot.status="todo");}return ot}),Ye[O]&&he(we=>{let ot={...we};return delete ot[O],ot});},ce=x.find(O=>O.id===Y.status)??kc[0],Ae=Fu.find(O=>O.id===Y.priority)??Fu[1],Et=cs.find(O=>O.value===Y.color)??cs[0],Pe=c==="dark",ut={backgroundColor:Pe?"#1d1f27":y.bgSecondary,border:`1px solid ${Pe?"rgba(65,71,84,0.1)":y.borderLight}`,color:y.textPrimary};return jsx(AnimatePresence,{children:e&&jsxs(Fragment,{children:[jsx(motion.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-[9999]",style:{backgroundColor:Pe?"rgba(0, 0, 0, 0.85)":"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)"},onClick:t}),jsx(motion.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{duration:.15,ease:[.4,0,.2,1]},className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 pointer-events-none",children:jsx("div",{role:"dialog","aria-modal":"true","aria-label":i==="create"?b?"Nueva tarea":"New task":b?"Editar tarea":"Edit task",className:"w-full max-w-[640px] rounded-xl pointer-events-auto flex flex-col","data-theme":c,style:{backgroundColor:Pe?"#0a0a0a":y.bgPrimary,border:`1px solid ${Pe?"rgba(65,71,84,0.1)":y.border}`,boxShadow:Pe?"0 8px 48px rgba(0, 0, 0, 0.8)":"0 8px 32px rgba(0, 0, 0, 0.12)",maxHeight:"90vh"},onClick:O=>O.stopPropagation(),children:jsxs("form",{onSubmit:wt,className:"flex flex-col overflow-hidden flex-1",style:{fontFamily:"'Inter', system-ui, sans-serif"},children:[jsxs("header",{className:"px-8 pt-8 pb-4 space-y-4 flex-shrink-0",children:[jsx("input",{type:"text",value:Y.name,"aria-label":b?"Nombre de la tarea":"Task name",onChange:O=>ue("name",O.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0",style:{color:y.textPrimary,fontSize:30,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},placeholder:"Nombre de la tarea",disabled:o,autoFocus:true}),Ye.name&&jsxs("p",{className:"text-xs text-red-400 flex items-center gap-1",children:[jsx(AlertCircle,{className:"w-3 h-3"}),Ye.name]}),jsx("textarea",{value:Y.description||"",onChange:O=>ue("description",O.target.value),className:"w-full bg-transparent border-none p-0 focus:outline-none focus:ring-0 resize-none task-form-description",style:{color:y.textPrimary,fontSize:16,fontFamily:"'Inter', system-ui, sans-serif","--placeholder-color":y.textTertiary},placeholder:"Agregar descripci\xF3n...",rows:2,disabled:o})]}),jsxs("div",{className:"flex-1 overflow-y-auto px-8 py-4 space-y-6",children:[jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[jsxs("div",{ref:tt,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&M(!k),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:{...ut,borderColor:ce.color,backgroundColor:`${ce.color}15`},disabled:o,children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:ce.color}}),jsx("span",{style:{color:ce.color},children:ce.title}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:ce.color}})]}),jsx(AnimatePresence,{children:k&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[140px] rounded-lg overflow-hidden",style:{backgroundColor:Pe?"#0a0a0a":y.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":y.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:x.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{ue("status",O.id),M(false);},children:[jsx(CircleDot,{className:"w-3.5 h-3.5",style:{color:O.color}}),O.title,Y.status===O.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:y.accent}})]},O.id))})})]}),jsxs("div",{ref:xt,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&E(!H),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[jsx(Flag,{className:"w-3.5 h-3.5",style:{color:Ae.color}}),jsx("span",{children:Ae.label}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsx(AnimatePresence,{children:H&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[130px] rounded-lg overflow-hidden",style:{backgroundColor:Pe?"#0a0a0a":y.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":y.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:Fu.map(O=>jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:re=>re.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:re=>re.currentTarget.style.backgroundColor="transparent",onClick:()=>{ue("priority",O.id),E(false);},children:[jsx("span",{children:O.icon}),O.label,Y.priority===O.id&&jsx(Check,{className:"w-3.5 h-3.5 ml-auto",style:{color:y.accent}})]},O.id))})})]}),n.length>0&&jsxs("div",{ref:Jt,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!o&&D(!N),className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[Y.assignees&&Y.assignees.length>0?jsxs(Fragment,{children:[jsx("div",{className:"flex -space-x-1",children:Y.assignees.slice(0,3).map((O,re)=>jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white font-medium border-2",style:{backgroundColor:O.color||y.accent,borderColor:y.bgSecondary},children:O.initials},re))}),Y.assignees.length>3&&jsxs("span",{style:{color:y.textTertiary},children:["+",Y.assignees.length-3]})]}):jsxs(Fragment,{children:[jsx(Users,{className:"w-3.5 h-3.5",style:{color:y.textTertiary}}),jsx("span",{style:{color:y.textTertiary},children:"Asignar"})]}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsx(AnimatePresence,{children:N&&jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] max-h-[200px] overflow-y-auto rounded-lg",style:{backgroundColor:Pe?"#0a0a0a":y.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":y.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:n.map(O=>{let re=Y.assignees?.some(we=>we.name===O.name);return jsxs("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",style:{color:y.textPrimary},onMouseEnter:we=>we.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:we=>we.currentTarget.style.backgroundColor="transparent",onClick:()=>{let we=re?(Y.assignees||[]).filter(ot=>ot.name!==O.name):[...Y.assignees||[],{name:O.name,avatar:O.avatar,initials:ba(O.name),color:y.accent}];ue("assignees",we);},children:[jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs text-white font-medium flex-shrink-0",style:{backgroundColor:y.accent},children:ba(O.name)}),jsx("span",{className:"truncate flex-1 text-left",children:O.name}),jsx("div",{className:"w-4 flex-shrink-0 flex justify-end",children:re&&jsx(Check,{className:"w-3.5 h-3.5",style:{color:y.accent}})})]},O.id)})})})]}),jsxs("div",{ref:Wt,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>{if(!o)if(S)V(false);else {if(Wt.current){let O=Wt.current.getBoundingClientRect(),re=window.innerHeight,we=120,mt=re-O.bottom<we?O.top-we-8:O.bottom+8;R({top:mt,left:O.left});}V(true);}},className:"flex items-center gap-2 px-3 py-1.5 rounded-full text-sm transition-all hover:opacity-80",style:ut,disabled:o,children:[jsx("div",{className:"w-3.5 h-3.5 rounded-full",style:{backgroundColor:Y.color}}),jsx("span",{children:Et.name}),jsx(ChevronDown,{className:"w-3 h-3",style:{color:y.textTertiary}})]}),jsx(AnimatePresence,{children:S&&jsxs(Pa,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>V(false)}),jsx(motion.div,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},transition:{duration:.12},className:"rounded-lg",style:{position:"fixed",top:`${W.top}px`,left:`${W.left}px`,zIndex:99999,backgroundColor:Pe?"#0a0a0a":y.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":y.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 4px 20px rgba(0, 0, 0, 0.25)"},onClick:O=>O.stopPropagation(),children:jsx("div",{style:{padding:"6px 8px"},children:jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 28px)",gap:"2px"},children:cs.slice(0,18).map(O=>{let re=Y.color===O.value;return jsx("button",{type:"button",onClick:we=>{we.preventDefault(),we.stopPropagation(),ue("color",O.value),V(false);},style:{width:"28px",height:"28px",borderRadius:"6px",backgroundColor:"transparent",cursor:"pointer",border:"none",display:"flex",alignItems:"center",justifyContent:"center",padding:0},title:O.name,children:jsx("span",{style:{width:"16px",height:"16px",borderRadius:"50%",backgroundColor:O.value,outline:re?`2px solid ${O.value}`:"none",outlineOffset:"2px",pointerEvents:"none",display:"block"}})},O.value)})})})})]})})]}),u.length>0||p?jsx($s,{selectedTags:Y.tags||[],availableTags:u,onChange:O=>ue("tags",O),onCreateTag:p,theme:y,disabled:o}):null]}),jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 gap-8 items-end",children:[jsxs("div",{className:"space-y-3",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:y.textTertiary,display:"block"},children:"Rango de Fechas"}),jsxs("div",{className:"flex items-center gap-3",style:{backgroundColor:Pe?"#191b22":y.bgSecondary,borderRadius:8,border:`1px solid ${Pe?"rgba(65,71,84,0.05)":y.borderLight}`,padding:"10px 16px"},children:[jsx(Calendar,{className:"w-5 h-5",style:{color:"#00E5CC"}}),jsxs("div",{ref:Qt,className:"flex items-center gap-2 flex-1 relative",children:[jsx("button",{type:"button",onClick:()=>{if(!o&&!Y.isMilestone)if(A==="start")ve(null);else {if(Qt.current){let O=Qt.current.getBoundingClientRect();pe({top:O.bottom+8,left:Math.max(16,O.left-40)});}ve("start"),le(Y.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ut,opacity:Y.isMilestone?.5:1,cursor:Y.isMilestone?"not-allowed":"pointer"},disabled:o||Y.isMilestone,children:Y.startDate?Y.startDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Inicio"}),jsx("span",{style:{color:y.textTertiary},children:"\u2192"}),jsx("button",{type:"button",onClick:()=>{if(!o&&!Y.isMilestone)if(A==="end")ve(null);else {if(Qt.current){let O=Qt.current.getBoundingClientRect();pe({top:O.bottom+8,left:Math.max(16,O.left-40)});}ve("end"),le(Y.endDate||Y.startDate||new Date);}},className:"px-3 py-1.5 rounded-lg text-sm transition-colors",style:{...ut,opacity:Y.isMilestone?.5:1,cursor:Y.isMilestone?"not-allowed":"pointer"},disabled:o||Y.isMilestone,children:Y.endDate?Y.endDate.toLocaleDateString("es-ES",{day:"numeric",month:"short"}):"Fin"}),jsx(AnimatePresence,{children:A&&jsxs(Pa,{children:[jsx("div",{className:"fixed inset-0",style:{zIndex:99998},onClick:()=>ve(null)}),jsxs(motion.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},className:"rounded-xl shadow-2xl overflow-hidden flex",style:{position:"fixed",top:`${B.top}px`,left:`${B.left}px`,zIndex:99999,backgroundColor:Pe?"#0a0a0a":y.bgPrimary,border:`1px solid ${Pe?"#262626":y.border}`,boxShadow:Pe?"0 8px 32px rgba(0, 0, 0, 0.6)":"0 8px 24px rgba(0, 0, 0, 0.12)"},onClick:O=>O.stopPropagation(),children:[jsxs("div",{className:"w-40 py-2",style:{borderRight:`1px solid ${Pe?"#262626":y.border}`},children:[(()=>{let O=new Date,re=new Date(O);re.setDate(O.getDate()+1);let we=new Date(O);we.setDate(O.getDate()+7);let ot=new Date(O);return ot.setDate(O.getDate()+14),[{label:"Hoy",date:O},{label:"Ma\xF1ana",date:re},{label:"Pr\xF3xima semana",date:we},{label:"2 semanas",date:ot}].map((Ht,Zt)=>jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:y.textPrimary},onMouseEnter:Oe=>Oe.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:Oe=>Oe.currentTarget.style.backgroundColor="transparent",onClick:()=>{A==="start"?(ue("startDate",Ht.date),(!Y.endDate||Ht.date>Y.endDate)&&ue("endDate",Ht.date),ve("end")):(ue("endDate",Ht.date),(!Y.startDate||Ht.date<Y.startDate)&&ue("startDate",Ht.date),ve(null));},children:Ht.label},Zt))})(),jsx("div",{style:{borderTop:`1px solid ${y.border}`,margin:"0.5rem 0"}}),jsx("button",{type:"button",className:"w-full px-3 py-2 text-sm text-left transition-colors",style:{color:"#EF4444"},onMouseEnter:O=>O.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",onClick:()=>{ue("startDate",void 0),ue("endDate",void 0),ve(null);},children:"Borrar fechas"})]}),jsxs("div",{className:"p-3",children:[jsxs("div",{className:"flex items-center justify-between mb-3",children:[jsx("button",{type:"button",onClick:()=>le(new Date(q.getFullYear(),q.getMonth()-1)),className:"p-1 rounded",onMouseEnter:O=>O.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronLeft,{className:"w-4 h-4",style:{color:y.textSecondary}})}),jsx("span",{className:"text-sm font-medium",style:{color:y.textPrimary,fontFamily:"JetBrains Mono, monospace"},children:q.toLocaleDateString("es-ES",{month:"long",year:"numeric"})}),jsx("button",{type:"button",onClick:()=>le(new Date(q.getFullYear(),q.getMonth()+1)),className:"p-1 rounded",onMouseEnter:O=>O.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",children:jsx(ChevronRight,{className:"w-4 h-4",style:{color:y.textSecondary}})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-1",children:["L","M","X","J","V","S","D"].map((O,re)=>jsx("div",{className:"w-7 h-7 flex items-center justify-center text-xs",style:{color:y.textTertiary},children:O},re))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:(()=>{let O=q.getFullYear(),re=q.getMonth(),we=(new Date(O,re,1).getDay()+6)%7,ot=new Date(O,re+1,0).getDate(),mt=new Date,Ht=[];for(let Oe=we-1;Oe>=0;Oe--)Ht.push({day:new Date(O,re,-Oe).getDate(),date:new Date(O,re-1,new Date(O,re,-Oe).getDate()),isCurrentMonth:false});for(let Oe=1;Oe<=ot;Oe++)Ht.push({day:Oe,date:new Date(O,re,Oe),isCurrentMonth:true});let Zt=42-Ht.length;for(let Oe=1;Oe<=Zt;Oe++)Ht.push({day:Oe,date:new Date(O,re+1,Oe),isCurrentMonth:false});return Ht.map((Oe,Wa)=>{let la=Oe.date.toDateString()===mt.toDateString(),da=Y.startDate?.toDateString()===Oe.date.toDateString(),ke=Y.endDate?.toDateString()===Oe.date.toDateString(),Te=Y.startDate&&Y.endDate&&Oe.date>=Y.startDate&&Oe.date<=Y.endDate;return jsx("button",{type:"button",className:"w-7 h-7 rounded-full flex items-center justify-center text-xs transition-colors",style:{color:Oe.isCurrentMonth?da||ke?"#FFF":y.textPrimary:y.textTertiary,backgroundColor:da?y.accent:ke?"#7C3AED":Te?"rgba(124, 58, 237, 0.2)":"transparent",boxShadow:la&&!da&&!ke?`inset 0 0 0 1px ${y.accent}`:"none"},onClick:()=>{A==="start"?(ue("startDate",Oe.date),Y.endDate&&Oe.date>Y.endDate&&ue("endDate",Oe.date),ve("end")):(ue("endDate",Oe.date),Y.startDate&&Oe.date<Y.startDate&&ue("startDate",Oe.date),ve(null));},children:Oe.day},Wa)})})()})]})]})]})})]}),Ye.endDate&&jsx("span",{className:"text-xs text-red-400",children:Ye.endDate})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("label",{style:{fontSize:10,fontWeight:700,letterSpacing:"0.1em",textTransform:"uppercase",color:y.textTertiary},children:"Progreso Inicial"}),jsxs("span",{style:{fontSize:10,fontWeight:700,color:"#00E5CC"},children:[Y.progress,"%"]})]}),jsx("div",{className:"h-2 w-full rounded-full overflow-hidden cursor-pointer",style:{backgroundColor:Pe?"#33343c":"#E5E7EB"},onClick:O=>{if(o)return;let re=O.currentTarget.getBoundingClientRect(),we=Math.round((O.clientX-re.left)/re.width*100/5)*5;ue("progress",Math.max(0,Math.min(100,we)));},children:jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${Y.progress}%`,backgroundColor:"#00E5CC"}})})]})]}),jsxs("div",{style:{borderTop:`1px solid ${Pe?"rgba(65,71,84,0.05)":y.borderLight}`,paddingTop:16},children:[jsxs("button",{type:"button",onClick:()=>Ue(!nt),className:"flex items-center gap-2 w-full py-2 transition-colors",style:{color:y.textPrimary},children:[jsx(ChevronDown,{className:`w-4 h-4 transition-transform ${nt?"":"-rotate-90"}`,style:{color:y.textTertiary}}),jsx("span",{style:{fontSize:16,fontWeight:700,fontFamily:"'Inter', system-ui, sans-serif"},children:"Opciones Avanzadas"})]}),jsx(AnimatePresence,{children:nt&&jsx(motion.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:jsxs("div",{className:"pt-3 space-y-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:y.textTertiary},children:[jsx("path",{d:"M12 6v6l4 2"}),jsx("circle",{cx:"12",cy:"12",r:"10"})]}),jsx("span",{className:"text-xs",style:{color:y.textTertiary},children:"Horas Estimadas"})]}),jsx("input",{type:"text",placeholder:"Ej: 8 (=8h), 2h 30m, 45m, 1d (1 d\xEDa = 8h)",value:Y.effortMinutes?Vk(Y.effortMinutes):"",onChange:O=>{let re=Gk(O.target.value);ue("effortMinutes",re);},className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:y.bgSecondary,color:y.textPrimary,border:`1px solid ${y.borderLight}`}})]}),r.length>0&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:y.textTertiary},children:jsx("path",{d:"M22 19a2 2 0 01-2 2H4a2 2 0 01-2-2V5a2 2 0 012-2h5l2 3h9a2 2 0 012 2z"})}),jsx("span",{className:"text-xs",style:{color:y.textTertiary},children:"Fase Padre"})]}),jsxs("select",{value:Y.parentId||"",onChange:O=>ue("parentId",O.target.value||null),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors appearance-none cursor-pointer",style:{backgroundColor:y.bgSecondary,color:y.textPrimary,border:`1px solid ${y.borderLight}`},disabled:o,children:[jsx("option",{value:"",children:"\u2014 Sin fase padre (ra\xEDz) \u2014"}),r.filter(O=>O.id!==a?.id).map(O=>jsx("option",{value:O.id,children:O.name},O.id))]})]}),jsxs("div",{className:"grid grid-cols-2 gap-3",children:[jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F4CD}"}),jsx("span",{className:"text-xs",style:{color:y.textTertiary},children:"Ubicaci\xF3n"})]}),jsx("input",{type:"text",placeholder:"Ej: Zona Norte, Piso 3",value:Y.location||"",onChange:O=>ue("location",O.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:y.bgSecondary,color:y.textPrimary,border:`1px solid ${y.borderLight}`},disabled:o})]}),jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("span",{style:{fontSize:14},children:"\u{1F527}"}),jsx("span",{className:"text-xs",style:{color:y.textTertiary},children:"Activo / Equipo"})]}),jsx("input",{type:"text",placeholder:"Ej: CMC-256",value:Y.equipment||"",onChange:O=>ue("equipment",O.target.value),className:"w-full px-3 py-2 rounded-lg text-sm transition-colors",style:{backgroundColor:y.bgSecondary,color:y.textPrimary,border:`1px solid ${y.borderLight}`},disabled:o})]})]}),(m||d.length>0||i==="create")&&jsxs("div",{children:[jsxs("div",{className:"flex items-center gap-2 mb-2",children:[jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{color:y.textTertiary},children:jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"})}),jsxs("span",{className:"text-xs",style:{color:y.textTertiary},children:["Adjuntos ",i==="create"?$.length>0&&`(${$.length})`:d.length>0&&`(${d.length})`]})]}),i==="create"?jsx(zs,{locale:b?"es":"en",cardId:"pending",attachments:$.map((O,re)=>({id:`pending-${re}`,cardId:"pending",name:O.name,size:O.size,type:O.type,url:URL.createObjectURL(O),uploadedAt:new Date().toISOString(),uploadedBy:"current-user"})),onUpload:O=>fe(re=>[...re,...O]),onDelete:O=>{let re=parseInt(O.replace("pending-",""),10);fe(we=>we.filter((ot,mt)=>mt!==re));},maxSizeMB:10,maxFiles:20}):jsx(zs,{locale:b?"es":"en",cardId:a?.id||"new",attachments:d,onUpload:m&&a?.id?O=>m(a.id,O):void 0,onDelete:f,maxSizeMB:10,maxFiles:20}),i==="create"&&$.length>0&&jsxs("p",{className:"text-xs mt-1",style:{color:y.textTertiary},children:[$.length," archivo(s) se subir\xE1n al crear la tarea"]})]}),jsxs("label",{className:"flex items-center gap-3 cursor-pointer p-2 rounded-lg transition-colors",onMouseEnter:O=>O.currentTarget.style.backgroundColor=y.hoverBg,onMouseLeave:O=>O.currentTarget.style.backgroundColor="transparent",children:[jsx("input",{type:"checkbox",checked:Y.isMilestone,onChange:O=>ue("isMilestone",O.target.checked),className:"w-4 h-4 rounded",style:{accentColor:y.accent},disabled:o}),jsx(Milestone,{className:"w-4 h-4 text-yellow-500"}),jsx("span",{className:"text-sm",style:{color:y.textPrimary},children:"Marcar como hito"})]}),r.length>0&&jsxs("div",{className:"relative",children:[jsxs("label",{className:"flex items-center gap-2 text-xs mb-2",style:{color:y.textTertiary},children:[jsx(Link2,{className:"w-3.5 h-3.5"}),"Dependencias"]}),Y.dependencies&&Y.dependencies.length>0&&jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:Y.dependencies.map(O=>{let re=r.find(we=>we.id===O);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",style:{backgroundColor:`${y.accent}20`,color:y.accent},children:[re?`${re.wbsCode?re.wbsCode+" \xB7 ":""}${re.name}`:"\u2014",jsx("button",{type:"button",onClick:()=>{let we=(Y.dependencies||[]).filter(ot=>ot!==O);ue("dependencies",we);},className:"ml-0.5 rounded-full p-0.5 transition-colors hover:bg-white/20",disabled:o,children:jsx(X,{className:"w-3 h-3"})})]},O)})}),jsxs("button",{ref:_t,type:"button",onClick:()=>{et(!ie),ct("");},className:"flex items-center gap-2 px-3 py-1.5 rounded-lg text-xs transition-colors",style:{backgroundColor:y.bgSecondary,color:y.textSecondary},disabled:o,children:[jsx(Plus,{className:"w-3.5 h-3.5"}),jsx("span",{children:"Agregar dependencia"})]}),jsx(AnimatePresence,{children:ie&&jsx(Fragment,{children:jsxs(motion.div,{ref:Tt,initial:{opacity:0,y:-5},animate:{opacity:1,y:0},exit:{opacity:0,y:-5},className:"absolute left-0 top-full mt-1 z-50 rounded-lg overflow-hidden min-w-[280px] max-h-[280px]",style:{backgroundColor:Pe?"#0a0a0a":y.bgPrimary,backdropFilter:Pe?"blur(16px)":void 0,border:`1px solid ${Pe?"#262626":y.border}`,boxShadow:Pe?"0 8px 24px rgba(0, 0, 0, 0.5)":"0 8px 24px rgba(0, 0, 0, 0.12)"},children:[jsx("div",{className:"p-2",style:{borderBottom:`1px solid ${y.border}`},children:jsx("input",{type:"text",value:Qe,onChange:O=>ct(O.target.value),placeholder:"Buscar tarea...",className:"w-full px-3 py-2 rounded-md text-xs outline-none",style:{backgroundColor:y.bgSecondary,color:y.textPrimary},autoFocus:true})}),jsxs("div",{className:"max-h-[200px] overflow-y-auto",children:[r.filter(O=>O.id!==a?.id).filter(O=>Qe===""||O.name.toLowerCase().includes(Qe.toLowerCase())).map(O=>{let re=Y.dependencies?.includes(O.id);return jsxs("button",{type:"button",onClick:()=>{let we=Y.dependencies||[],ot;re?ot=we.filter(mt=>mt!==O.id):ot=[...we,O.id],ue("dependencies",ot);},className:"w-full flex items-center gap-3 px-3 py-2 text-xs transition-colors text-left",style:{backgroundColor:re?`${y.accent}10`:"transparent"},onMouseEnter:we=>{re||(we.currentTarget.style.backgroundColor=y.hoverBg);},onMouseLeave:we=>{we.currentTarget.style.backgroundColor=re?`${y.accent}10`:"transparent";},children:[jsx("div",{className:"w-4 h-4 rounded border-2 flex items-center justify-center flex-shrink-0",style:{backgroundColor:re?y.accent:"transparent",borderColor:re?y.accent:y.borderLight},children:re&&jsx(Check,{className:"w-3 h-3 text-white"})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",style:{color:y.textPrimary},children:O.name}),jsx("span",{className:"text-[10px]",style:{color:y.textTertiary},children:O.wbsCode??""})]})]},O.id)}),r.filter(O=>O.id!==a?.id).length===0&&jsx("div",{className:"px-3 py-4 text-xs text-center",style:{color:y.textTertiary},children:"No hay tareas disponibles"})]})]})})})]})]})})})]})]}),jsxs("div",{className:"flex items-center justify-end gap-6 px-8 py-5 flex-shrink-0",style:{borderTop:`1px solid ${Pe?"rgba(65,71,84,0.1)":y.border}`,backgroundColor:Pe?"rgba(25,27,34,0.2)":void 0},children:[jsx("button",{type:"button",onClick:t,className:"text-sm font-semibold transition-colors",style:{color:y.textTertiary},onMouseEnter:O=>O.currentTarget.style.color=y.textPrimary,onMouseLeave:O=>O.currentTarget.style.color=y.textTertiary,disabled:o,children:"Cancelar"}),jsx("button",{type:"submit",disabled:o,className:"px-8 py-3 font-bold rounded-lg transition-all flex items-center gap-2",style:{backgroundColor:"#00E5CC",color:"#FFF",fontSize:14,fontFamily:"'Inter', system-ui, sans-serif",boxShadow:"0 4px 20px rgba(0, 123, 255, 0.2)"},onMouseEnter:O=>!o&&(O.currentTarget.style.filter="brightness(1.1)"),onMouseLeave:O=>!o&&(O.currentTarget.style.filter="brightness(1)"),children:o?jsxs(Fragment,{children:[jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):jsx(Fragment,{children:i==="create"?"Crear Tarea":"Guardar"})})]})]})})})]})})}var tf=`You are a Gantt chart AI assistant. You help users edit project tasks using natural language commands.
|
|
369
369
|
|
|
370
370
|
AVAILABLE COMMANDS:
|
|
371
371
|
1. move_task - Move a task to a different date
|
|
@@ -406,40 +406,40 @@ Tasks have: id, name, startDate, endDate, progress, status, dependencies[], assi
|
|
|
406
406
|
|
|
407
407
|
Always try to match task names case-insensitively and handle partial matches.
|
|
408
408
|
If you can't find a task by name, search through the provided task list.
|
|
409
|
-
If ambiguous, ask for clarification in the message field.`;function
|
|
410
|
-
${
|
|
409
|
+
If ambiguous, ask for clarification in the message field.`;function af(e){return `CURRENT TASKS:
|
|
410
|
+
${rf(e).map(r=>{let n=r.startDate?r.startDate.toISOString().split("T")[0]:"no date",s=r.endDate?r.endDate.toISOString().split("T")[0]:"no date",o=r.dependencies?.length?`deps: [${r.dependencies.join(", ")}]`:"";return `- ${r.id}: "${r.name}" (${n} to ${s}, ${r.progress}%, ${r.status||"todo"}) ${o}`}).join(`
|
|
411
411
|
`)}
|
|
412
412
|
|
|
413
|
-
Today's date: ${new Date().toISOString().split("T")[0]}`}function Lg(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function qn(e,t){let a=Lg(e),r=t.toLowerCase().trim(),n=a.find(i=>i.name.toLowerCase()===r);if(n)return n;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return o.every(l=>c.includes(l))})}function Bd(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}let n=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let m={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(m!==void 0){let f=new Date(r),v=f.getDay(),b=m-v;return b<=0&&(b+=7),f.setDate(f.getDate()+b),f}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(r);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+d):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+d),f}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let d=parseInt(i[1],10),m=parseInt(i[2],10)-1,f=parseInt(i[3],10);return new Date(f,m,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let d=parseInt(l[1],10),m=c[l[2].toLowerCase()],f=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(f,m,d)}let p={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},u=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(u&&u[1]&&u[2]){let d=p[u[1].toLowerCase()],m=parseInt(u[2],10),f=u[3]?parseInt(u[3],10):r.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function $d(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function Od(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function Ag(e){let t=e.toLowerCase().trim();return t.includes("todo")||t.includes("pendiente")||t.includes("por hacer")?"todo":t.includes("in progress")||t.includes("in-progress")||t.includes("en progreso")||t.includes("working")||t.includes("trabajando")?"in-progress":t.includes("done")||t.includes("complete")||t.includes("finished")||t.includes("completado")||t.includes("terminado")||t.includes("hecho")?"completed":null}function Ig(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),p=r[2].trim(),u=qn(t,l),d=Bd(p);if(!u)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:u.id,taskName:u.name,message:`Could not parse the date "${p}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=u.startDate&&u.endDate?Math.round((u.endDate.getTime()-u.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:u.id,taskName:u.name,updates:{startDate:d,endDate:f},message:`Moved "${u.name}" to ${d.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),p=n[2].trim(),u=qn(t,l),d=$d(p);if(!u)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!d||!u.endDate)return {type:"resize_task",taskId:u.id,taskName:u.name,message:`Could not parse the duration "${p}".`,success:false,error:"Invalid duration"};let m=new Date(u.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:u.id,taskName:u.name,updates:{endDate:m},message:`Extended "${u.name}" by ${d} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),p=s[2].trim(),u=qn(t,l),d=Od(p);return u?d===null?{type:"set_progress",taskId:u.id,taskName:u.name,message:`Could not parse the progress value "${p}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:u.id,taskName:u.name,updates:{progress:d},message:`Set "${u.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),p=o[2].trim(),u=qn(t,l);return u?{type:"rename_task",taskId:u.id,taskName:u.name,updates:{name:p},message:`Renamed "${u.name}" to "${p}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),p=i[2].trim(),u=qn(t,l),d=qn(t,p);return u?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:u.id,dependencyTo:d.id,message:`Linked "${u.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:p,message:`Could not find a task named "${p}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),p=qn(t,l);return p?{type:"delete_task",taskId:p.id,taskName:p.name,message:`Deleted "${p.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function Rg(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 sk(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 ik(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Pl(e,t=[],a=[]){let r=e.assignedUserIds?.map(p=>{let u=a.find(d=>d.id===p);return u?{name:u.name,initials:u.initials,color:u.color}:null}).filter(p=>p!==null),n=t.filter(p=>p.metadata?.parentCardId===e.id).map(p=>Pl(p,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(p=>p.type==="finish-to-start").map(p=>p.taskId));let o=p=>{if(p)return typeof p=="string"?new Date(p):p},i=o(e.startDate),c=o(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:sk(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function Bg(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:ik(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function $g(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Pl(r,e,t))}var Hd={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"}},Ud={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"}},Fl={en:Hd,es:Ud};function Wd(e){return Fl[e]||Fl.en}function Ll(e,t){let a=Wd(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var zd=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function Og(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 Hg({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),i=useRef(null);useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=Og(e),l=zd[0],p=zd.find(m=>m.value===c)??l,u=p.icon,d=m=>{switch(Og(m)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(u,{className:g("w-4 h-4 flex-shrink-0",p.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(u,{className:g("w-4 h-4 flex-shrink-0",p.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)}),jsx(ChevronDown,{className:g("w-3 h-3",a?"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]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:zd.map(m=>{let f=m.icon;return jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",m.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function xo(e,t,a=320){let[r,n]=useState(false);return useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,i=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;n(!i&&c);},[t,a,e]),r}var Gd=[{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 Wg({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),i=useRef(null),c=xo(i,s,180);useEffect(()=>{let u=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[s]);let l=Gd.find(u=>u.value===e)??Gd[4],p=r==="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",a?"text-white/60":"text-gray-500"),children:l.label[p]})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(Flag,{className:g("w-4 h-4",l.color)}),jsx("span",{className:g("text-sm",a?"text-white/60":"text-gray-500"),children:l.label[p]}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Gd.map(u=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(u.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",u.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:u.label[p]})]},u.value))})]})}function bi(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function Vd(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-[#00E5CC]"}function Rl({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,i]=useState(false),[c,l]=useState(""),p=useRef(null),u=useRef(null),d=xo(p,o);useEffect(()=>{let b=h=>{p.current&&!p.current.contains(h.target)&&(i(false),l(""));};return o&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{o&&u.current&&u.current.focus();},[o]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),f=b=>e.some(h=>h.name===b),v=b=>{if(a){if(f(b.name))a(e.filter(h=>h.name!==b.name));else {let h={name:b.name,initials:bi(b.name),color:b.color||Vd(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,h]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:g("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,h)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Vd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)},`${b.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",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:p,className:"relative",children:[jsx("button",{onClick:b=>{b.stopPropagation(),i(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:g("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,h)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&Vd(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)},`${b.name}-${h}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:g("absolute z-50 left-0 rounded-lg overflow-hidden",d?"bottom-full mb-1.5":"top-full mt-1.5"),style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:u,type:"text",value:c,onChange:b=>l(b.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,h)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||bi(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:y=>{y.stopPropagation(),a(e.filter(x=>x.name!==b.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}})})]},`${b.name}-${h}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:r?"rgba(255,255,255,0.35)":"#94A3B8",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let h=f(b.name);return jsxs("button",{onClick:y=>{y.stopPropagation(),v(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:h?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:y=>{h||(y.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:y=>{h||(y.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):bi(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.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"}})})]},b.id)})})]})]})}function Kg({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:i=false,placeholder:c}){let[l,p]=useState(false),[u,d]=useState(n),[m,f]=useState(()=>{let N=n==="start"?e:t;if(N){let z=N instanceof Date?N:new Date(N);return new Date(z.getFullYear(),z.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),v=useRef(null),b=useRef(null),h=useRef(null),[y,x]=useState(null),w=e?e instanceof Date?e:new Date(e):null,C=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let N=z=>{let $=z.target;v.current&&v.current.contains($)||h.current&&h.current.contains($)||p(false);};return l&&document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[l]),useLayoutEffect(()=>{if(!l){x(null);return}let N=()=>{let z=b.current?.getBoundingClientRect();if(!z)return;let $=520,Y=360,A=window.innerHeight-z.bottom,Se=A<Y&&z.top>A,W=Se?z.top-4:z.bottom+4,Ce=Math.min(Math.max(z.left,8),window.innerWidth-$-8);x({top:W,left:Ce,flipUp:Se});};return N(),window.addEventListener("scroll",N,true),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,true),window.removeEventListener("resize",N);}},[l]),useEffect(()=>{l&&d(r?n:"start");},[l,r,n]);let P=N=>N?N.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"}):c||"-",O=useCallback(()=>{let N=m.getFullYear(),z=m.getMonth(),$=new Date(N,z,1),A=new Date(N,z+1,0).getDate(),Se=$.getDay(),W=[],R=new Date(N,z,0).getDate();for(let G=Se-1;G>=0;G--)W.push({date:new Date(N,z-1,R-G),isCurrentMonth:false});for(let G=1;G<=A;G++)W.push({date:new Date(N,z,G),isCurrentMonth:true});let we=42-W.length;for(let G=1;G<=we;G++)W.push({date:new Date(N,z+1,G),isCurrentMonth:false});return W},[m]),T=N=>{if(r)n==="start"?a(N,C||void 0):a(w||void 0,N),p(false);else if(u==="start"){let z=C&&N>C?N:C;a(N,z||void 0),d("end");}else {let z=w&&N<w?N:w;a(z||void 0,N),p(false);}},D=()=>{let N=new Date,z=new Date(N);z.setDate(N.getDate()+1);let $=new Date(N);$.setDate(N.getDate()+((6-N.getDay()+7)%7||7));let Y=new Date(N);Y.setDate(N.getDate()+((1-N.getDay()+7)%7||7));let A=new Date(N);A.setDate(N.getDate()+(6-N.getDay()+7)%7+7);let Se=new Date(N);Se.setDate(N.getDate()+14);let W=new Date(N);return W.setDate(N.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:N,display:N.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:z,display:z.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:$,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:Y,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:A,display:A.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"2 semanas":"2 weeks",date:Se,display:Se.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})},{label:o==="es"?"4 semanas":"4 weeks",date:W,display:W.toLocaleDateString(o==="es"?"es-ES":"en-US",{day:"numeric",month:"short"})}]};if(i){let N=r&&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(N)})]})}let M=r&&n==="start"?w:C;return jsxs("div",{ref:v,className:"relative",children:[jsxs("button",{ref:b,onClick:N=>{N.stopPropagation(),p(!l);let z=n==="start"?w:C;z&&f(new Date(z.getFullYear(),z.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(M)})]}),l&&y&&createPortal(jsxs("div",{ref:h,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:N=>N.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[D().map((N,z)=>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:()=>T(N.date),children:[jsx("span",{children:N.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:N.display})]},z)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,C||void 0):a(w||void 0,void 0):a(void 0,void 0),p(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:[!r&&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:u==="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:m.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(m.getFullYear(),m.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(m.getFullYear(),m.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(N=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:N},N))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:O().map((N,z)=>{let $=N.date.toDateString()===new Date().toDateString(),Y=w?.toDateString()===N.date.toDateString(),A=C?.toDateString()===N.date.toDateString(),Se=Y||A,W=!r&&w&&C&&N.date>=w&&N.date<=C;return jsx("button",{onClick:()=>T(new Date(N.date)),className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!N.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),N.isCurrentMonth&&(s?"text-white":"text-gray-900"),$&&"ring-2 ring-[#00E5CC]",Y&&"bg-[#00E5CC] text-white",A&&!Y&&"bg-[#7C3AED] text-white",W&&!Se&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!Se&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:N.date.getDate()},z)})})]})]}),document.body)]})}function $l({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:i}){let c=e?e instanceof Date?e:new Date(e):null;return jsx(Kg,{startDate:s==="start"?c:o||null,endDate:s==="end"?c:i||null,onChange:(d,m)=>{t&&t(s==="start"?d:m);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-"})}function Ds(e=600){let[t,a]=useState(false),r=useRef(null),n=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:n}}function Ol(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[i,c]=useState(false),l=useRef(e),p=useRef([]);return useEffect(()=>{if(p.current.forEach(clearTimeout),p.current=[],!a||e===l.current||e===void 0){o(e),l.current=e;return}let u=l.current??0,d=e,m=d-u,f=r/n;c(true);for(let v=1;v<=n;v++){let b=setTimeout(()=>{let h=v/n,y=1-Math.pow(1-h,3),x=Math.round(u+m*y);o(x),v===n&&(c(false),o(d));},f*v);p.current.push(b);}return l.current=e,()=>{p.current.forEach(clearTimeout),p.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:i}}function qg(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,i]=useState(0),c=useRef(null),l=useRef(null),p=useCallback(m=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(m),i(0);let f=Date.now();l.current=setInterval(()=>{let v=Date.now()-f,b=Math.min(v/a*100,100);i(b);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(m),s(null),i(0);},a);},[a,e]),u=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:p,cancelChange:u}}function Xg({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,i]=useState(false),[c,l]=useState(""),p=useRef(null),{isFlashing:u,triggerFlash:d}=Ds(),{displayValue:m,isAnimating:f}=Ol(e,{enabled:n,duration:300,steps:6}),v=w=>{if(r||!t)return;w.stopPropagation();let C=w.currentTarget.getBoundingClientRect(),P=w.clientX-C.left,O=Math.round(P/C.width*100),T=Math.max(0,Math.min(100,O));T!==e&&(t(T),s&&d());},b=useCallback(w=>{r||!t||(w.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{o&&p.current&&(p.current.focus(),p.current.select());},[o]);let h=useCallback(()=>{i(false);let w=parseInt(c,10);if(!isNaN(w)&&t){let C=Math.max(0,Math.min(100,w));C!==e&&(t(C),s&&d());}},[c,t,e,s,d]),y=useCallback(w=>{w.key==="Enter"&&h(),w.key==="Escape"&&i(false);},[h]),x=m??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",u&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:w=>w.stopPropagation(),children:[jsx("input",{ref:p,value:c,onChange:w=>l(w.target.value.replace(/[^0-9]/g,"")),onBlur:h,onKeyDown:y,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:b,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[x,"%"]})]})}function Zg({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let p=()=>{i!==e&&t?.(i),o(false);},u=d=>{d.key==="Enter"?p():d.key==="Escape"&&(c(e),o(false));};return n||!t?jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:i,onChange:d=>c(d.target.value),onBlur:p,onKeyDown:u,onClick:d=>d.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:d=>{d.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function a0({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,p]=useState(false),[u,d]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:v}=Ds(),{displayValue:b,isAnimating:h}=Ol(e,{enabled:i&&!l});useEffect(()=>{l&&m.current&&(m.current.focus(),m.current.select());},[l]),useEffect(()=>{d(e?.toString()||"");},[e]);let y=()=>{let w=parseFloat(u);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),c&&v());}p(false);},x=w=>{w.key==="Enter"?y():w.key==="Escape"&&(d(e?.toString()||""),p(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500",h&&"font-medium"),children:b!==void 0?b:r}):l?jsx("input",{ref:m,type:"number",value:u,onChange:w=>d(w.target.value),onBlur:y,onKeyDown:x,onClick:w=>w.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:w=>{w.stopPropagation(),p(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",b===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),h&&"font-medium scale-105"),children:b!==void 0?b:r})}function r0({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,i]=useState(false),c=useRef(null),l=xo(c,o,220);return useEffect(()=>{let p=u=>{c.current&&!c.current.contains(u.target)&&i(false);};return o&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[o]),s||!a?jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:p=>{p.stopPropagation(),i(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("absolute z-50 left-0 "+(l?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(p=>jsxs("button",{onClick:u=>{u.stopPropagation(),a(p),i(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:p}),e===p&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},p))})]})}function o0({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:i,progress:c,startChange:l,cancelChange:p}=qg(t,{delay:s}),u=m=>{m.stopPropagation(),!r&&t&&(n?i?p():l(!e):t(!e));},d=i?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:u,disabled:r||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",d?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&d&&"ring-green-500/50",i&&!d&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&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:d?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):d?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:m=>{m.stopPropagation(),p();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function s0({value:e=[],options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:i=2}){let[c,l]=useState(false),p=useRef(null),u=xo(p,c,220);useEffect(()=>{let h=y=>{p.current&&!p.current.contains(y.target)&&l(false);};return c&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[c]);let d=e.slice(0,i),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!a)return jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:f});let v=h=>{let y=e.includes(h),x=y?e.filter(w=>w!==h):[...e,h];!y&&o!=null&&e.length>=o||a(x);},b=o!=null&&e.length>=o;return jsxs("div",{ref:p,className:"relative",children:[jsxs("button",{onClick:h=>{h.stopPropagation(),l(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",e.length===0&&(r?"text-white/30":"text-gray-400")),children:f}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),c&&jsx("div",{className:g("absolute z-50 left-0 "+(u?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(h=>{let y=e.includes(h),x=!y&&b;return jsxs("button",{disabled:x,onClick:w=>{w.stopPropagation(),v(h);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":r?"hover:bg-white/[0.05]":"hover:bg-gray-100",y&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:h}),y&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},h)})})]})}function Xk(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 c0({value:e,isDark:t,placeholder:a="-",onOpen:r}){let n=Xk(e);if(n.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:a});let s=n[0],o=n.length-1,i=o>0?`${s.name} +${o}`:s.name;return r?jsxs("button",{onClick:c=>{c.stopPropagation(),r(s);},title:n.map(c=>c.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:i})]}):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"}),i]})}function p0({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className: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 Zk(e,t="en"){if(e==null||e===0||!e||Number(e)===0)return "-";let a=Math.floor(e/60),r=e%60;return a===0?`${r}m`:r===0?`${a}h`:`${a}h ${r}m`}function e1(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}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 Gr({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0,financialOverride:p}){let[u,d]=useState(false),[m,f]=useState(""),v=useRef(null),{isFlashing:b,triggerFlash:h}=Ds(),y=c==="financial"&&(l>0||p!=null),x=p??(e?e/60*l:0),w=y&&(p!=null?p>0:e)?`$${Math.round(x).toLocaleString("en-US")}`:Zk(e,r);useEffect(()=>{u&&v.current&&(v.current.focus(),v.current.select());},[u]),useEffect(()=>{if(e){let T=Math.floor(e/60),D=e%60;T>0&&D>0?f(`${T}h ${D}m`):T>0?f(`${T}h`):f(`${D}m`);}else f("");},[e,u]);let C=()=>{let T=e1(m);T!==e&&(t?.(T),o&&h()),d(false);},P=T=>{T.key==="Enter"?C():T.key==="Escape"&&d(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let O=y?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(O,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:w})]}):u?jsx("input",{ref:v,type:"text",value:m,onChange:T=>f(T.target.value),onBlur:C,onKeyDown:P,onClick:T=>T.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400")}):jsxs("button",{onClick:T=>{T.stopPropagation(),d(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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",b&&(a?"bg-green-500/30":"bg-green-500/20")),children:[e!=null&&e>0&&jsx(O,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:w})]})}function b0({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let o=c=>c.toLocaleDateString(n==="es"?"es-ES":"en-US",{month:"short",day:"numeric"}),i=()=>{if(a==null)return null;let c=n==="es";return a===0?s?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"#10B981",fontWeight:600},children:c?"En Tiempo":"On Track"}):jsx("span",{className:"font-mono",style:{fontSize:"10px",color:r?"rgba(255,255,255,0.3)":"#94A3B8",fontWeight:500},children:c?"Tiempo no asignado":"No time allocated"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",c?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",c?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?o(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?o(t):"\u2014"]}),i()]})}function y0({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:i="hours",hourlyRate:c=0}){let l=a==="es",p=i==="financial"&&c>0,u=W=>p?`$${Math.round(W*c).toLocaleString("en-US")}`:`${W}h`,[d,m]=useState(false),[f,v]=useState(false),[b,h]=useState(null),y=useRef(null),x=e.timeLoggedMinutes||0,w=e.effortMinutes||0,C=e.soldEffortMinutes||0,P=Math.round(x/60*10)/10,O=Math.round(w/60*10)/10,T=w>0?x/w*100:0,D=T>100?Math.round((x-w)/60*10)/10:0,M=T>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!f&&!b)return;let W=Ce=>{y.current&&!y.current.contains(Ce.target)&&(v(false),h(null));};return document.addEventListener("mousedown",W),()=>document.removeEventListener("mousedown",W)},[f,b]);let N=W=>{if(W.stopPropagation(),r&&!n&&!s){h("log");return}if(r||n||s){v(Ce=>!Ce),h(null);return}o&&o(e);},z=W=>{v(false),h(W);},$=async(W,Ce)=>{b==="log"&&r&&W?r(e,W,Ce):b==="estimate"&&n?n(e,W):b==="quoted"&&s&&s(e,W),h(null);},Y=r||n||s||o,A=[{mode:"log",icon:Clock,label:l?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:l?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:l?"T. Ofertado":"Quoted time",show:!!s}].filter(W=>W.show),Se=b==="estimate"?w:b==="quoted"?C:void 0;return w===0&&x===0&&C===0?jsxs("div",{ref:y,className:"relative flex items-center gap-2",onClick:W=>W.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),d&&Y&&jsx("button",{onClick:N,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:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:l?"+ 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:A.map(W=>jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),z(W.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:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsx(AnimatePresence,{children:b&&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(Pn,{mode:b,locale:a,isDark:t,currentValue:Se||void 0,onSave:$,onClose:()=>h(null)})})})})]}):jsxs("div",{ref:y,className:"relative flex items-center gap-2 w-full",onClick:W=>W.stopPropagation(),onMouseEnter:()=>m(true),onMouseLeave:()=>m(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 W=x===0,R=(w>0?x/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:W?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:u(P)}),w>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",u(O)]}),D>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:R?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:R?"rgba(239,68,68,0.15)":"transparent"},children:["+",u(D)," ",l?"Excedido":"Over"]})]})})(),w>0&&jsx("div",{className:"w-full overflow-hidden",style:{height:3,backgroundColor:t?"#333":"#E5E7EB",borderRadius:2},children:jsx("div",{style:{height:"100%",width:`${Math.min(T,100)}%`,backgroundColor:M,borderRadius:2,transition:"width 0.3s"}})})]}),Y&&jsx("button",{onClick:N,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:d?1:0,pointerEvents:d?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",W.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:W=>{W.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",W.currentTarget.style.backgroundColor="transparent";},title:l?"+ 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:A.map(W=>jsxs("button",{onClick:Ce=>{Ce.stopPropagation(),z(W.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:Ce=>{Ce.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:Ce=>{Ce.target.style.background="transparent";},children:[jsx(W.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),W.label]},W.mode))})}),jsx(AnimatePresence,{children:b&&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(Pn,{mode:b,locale:a,isDark:t,currentValue:Se||void 0,onSave:$,onClose:()=>h(null)})})})})]})}function i1(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function l1(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 x0({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||e.name?.charAt(0)?.toUpperCase()||"?"})}function v0({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let p=i1(e);if(p.length===0)return null;let u=p.slice(0,3),d=p.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:u.map((m,f)=>jsx(x0,{assignee:m,size:24,isDark:t},m.name+f))}),d>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:p.slice(3).map(m=>m.name).join(", "),children:["+",d]})]})}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:r?"Sin asignar":"Unassigned"})]});let i=o?.percentage??0,c=!!o&&i>0,l=c?l1(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(x0,{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})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var c1={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function k0({blockers:e,isDark:t,locale:a="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:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",c1[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function T1(e){return e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2)}function N1(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function M0({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:p=[],onOpenTimeLog:u,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:b}){let h=useRef(null),y=r==="es"?N0.es:N0.en,[x,w]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{w({left:e.x,top:e.y});let D=h.current;if(!D)return;let M=D.getBoundingClientRect(),N=8,z=e.x,$=e.y;e.y+M.height>window.innerHeight-N&&($=Math.max(N,e.y-M.height)),e.x+M.width>window.innerWidth-N&&(z=Math.max(N,window.innerWidth-M.width-N)),(z!==e.x||$!==e.y)&&w({left:z,top:$});},[e.x,e.y,e.isOpen]),useEffect(()=>{let D=N=>{h.current&&!h.current.contains(N.target)&&t();},M=N=>{N.key==="Escape"&&t();};return document.addEventListener("mousedown",D),document.addEventListener("keydown",M),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",M);}},[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}),i&&(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:()=>{i({...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:()=>{i({...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:()=>{i({...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:()=>{i({...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:()=>{i({...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:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:y.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),p.length>0&&D.push({id:"assign",label:y.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:p.slice(0,5).map(M=>({id:`assign-${M.id}`,label:M.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:M.name.charAt(0).toUpperCase()}),onClick:()=>{let N=e.task.assignees||[],$=N.some(Y=>Y.name===M.name)?N.filter(Y=>Y.name!==M.name):[...N,{name:M.name,initials:T1(M.name),color:M.color||N1(M.name),avatar:M.avatarUrl}];i({...e.task,assignees:$}),t();}}))})),u&&D.push({id:"log-time",label:y.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{u(e.task),t();}}),d&&D.push({id:"report-blocker",label:y.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&D.push({id:"copy-link",label:y.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{m(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||v||b)&&(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();}})),v&&D.push({id:"indent",label:y.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),b&&D.push({id:"outdent",label:y.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{b(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 l&&(D.push({id:"sort-asc",label:y.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),D.push({id:"sort-desc",label:y.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&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:()=>{c(e.columnId),t();}})),D},O=e.type==="task"?C():P(),T={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:h,style:T,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:O.map(D=>D.separator?jsx("div",{className:g("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},D.id):D.submenu?jsx(D1,{item:D,isDark:a},D.id):jsxs("button",{onClick:D.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",D.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:g(D.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:D.icon}),D.label]},D.id))})}function D1({item:e,isDark:t}){let[a,r]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className: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")})]}),a&&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(i=>jsxs("button",{onClick:i.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:i.icon}),i.label]},i.id))})]})}var N0={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 $0={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"})},G1=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function H0({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:i,locale:c}){let[l,p]=useState(""),[u,d]=useState(null),[m,f]=useState(null),v=useRef(null),b=c==="es"?O0.es:O0.en;useLayoutEffect(()=>{if(!e||!v.current)return;let D=()=>{if(!v.current)return;let M=v.current.parentElement;if(M){let Y=M.getBoundingClientRect();f({top:Y.bottom+4,right:window.innerWidth-Y.right});}let N=v.current.getBoundingClientRect(),$=window.innerHeight-N.top-20;d(Math.max(300,$));};return requestAnimationFrame(D),window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[e]),useEffect(()=>{if(!e)return;let D=setTimeout(()=>{let M=z=>{v.current&&!v.current.contains(z.target)&&t();},N=z=>{z.key==="Escape"&&t();};document.addEventListener("mousedown",M),document.addEventListener("keydown",N),v._cleanup=()=>{document.removeEventListener("mousedown",M),document.removeEventListener("keydown",N);};},100);return ()=>{clearTimeout(D),v._cleanup&&v._cleanup();}},[e,t]);let h=useMemo(()=>{let D=new Set([...G1]);return a.forEach(M=>{M.type&&M.type!=="assignees"&&D.add(M.type);}),Array.from(D)},[a]);if(!e)return null;let y=D=>{let M=b.columns[D];if(M)return M;let N=a.find(z=>z.type===D);return N?.label?N.label:D},x=D=>{if(D==="name")return;let M=a.map(N=>N.id===D?{...N,visible:!N.visible}:N);n(M);},w=(D,M)=>{let N=a.find($=>$.type===D&&(!M||$.customFieldId===M));if(N){x(N.id);return}let z={id:M||D,type:D,label:M?r.find($=>$.id===M)?.name||D:y(D),width:120,visible:true,sortable:true,resizable:true,customFieldId:M};n([...a,z]);},C=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],P=h.filter(D=>D!=="assignees"&&(o||!C.includes(D))&&y(D).toLowerCase().includes(l.toLowerCase())),O=r.filter(D=>D.name.toLowerCase().includes(l.toLowerCase())),T=i?"#00E5FF":"#00E5CC";return jsxs("div",{ref:v,style:{...u?{maxHeight:`${u}px`}:{},...m?{top:m.top,right:m.right}:{},background:i?"#111114":"#FFFFFF",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:i?"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 ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:i?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:b.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:D=>{D.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",D.currentTarget.style.color=i?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:D=>{D.currentTarget.style.backgroundColor="transparent",D.currentTarget.style.color=i?"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:i?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:l,onChange:D=>p(D.target.value),placeholder:b.searchPlaceholder,style:{fontSize:12,background:i?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:i?"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:D=>{D&&D.style.setProperty("--focus-border",T);},onFocus:D=>{D.currentTarget.style.borderColor=T,D.currentTarget.style.background=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:D=>{D.currentTarget.style.borderColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",D.currentTarget.style.background=i?"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:D=>D.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:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:b.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:P.map(D=>{let M=a.find($=>$.type===D&&!$.customFieldId),N=M?.visible??false,z=D==="name";return jsxs("button",{onClick:()=>{z||(M?x(M.id):w(D));},disabled:z,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:z?.4:1,cursor:z?"not-allowed":"pointer"},onMouseEnter:$=>{z||($.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:$=>{$.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:N?T:"transparent",border:N?`1.5px solid ${T}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${T}40`:"none"},children:N&&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:N?T:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:$0[D]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:N?500:400,color:N?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:y(D),children:y(D)})]},D)})})]}),O.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:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:b.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:O.map(D=>{let N=a.find(z=>z.customFieldId===D.id)?.visible??false;return jsxs("button",{onClick:()=>w(D.type,D.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:z=>{z.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:z=>{z.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:N?T:"transparent",border:N?`1.5px solid ${T}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:N?`0 0 6px ${T}40`:"none"},children:N&&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:N?T:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:$0[D.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:N?500:400,color:N?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:D.name})]},D.id)})})]})]})]})}var O0={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 Q1=[{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 z0({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[i,c]=useState("text"),[l,p]=useState([""]),u=n==="es"?W0.es:W0.en;useEffect(()=>{e&&(o(""),c("text"),p([""]));},[e]),useEffect(()=>{let b=h=>{h.key==="Escape"&&t();};return e&&document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]);let d=()=>{if(!s.trim())return;let b={name:s.trim(),type:i};i==="dropdown"&&(b.options=l.filter(h=>h.trim())),a(b),t();},m=()=>{p([...l,""]);},f=(b,h)=>{let y=[...l];y[b]=h,p(y);},v=b=>{l.length>1&&p(l.filter((h,y)=>y!==b));};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",r?"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",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",r?"text-white":"text-gray-900"),children:u.title}),jsx("button",{onClick:t,className:g("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:u.fieldName}),jsx("input",{type:"text",value:s,onChange:b=>o(b.target.value),placeholder:u.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:u.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:Q1.map(b=>jsxs("button",{onClick:()=>c(b.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===b.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:b.icon}),jsx("span",{className:g("text-xs",i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:u.types[b.type]})]},b.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:u.options}),jsxs("div",{className:"space-y-2",children:[l.map((b,h)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:b,onChange:y=>f(h,y.target.value),placeholder:`${u.option} ${h+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>v(h),className:g("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},h)),jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),u.addOption]})]})]})]}),jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:u.cancel}),jsx("button",{onClick:d,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:u.create})]})]})]}):null}var W0={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 j0={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 _0({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,i]=useState(false),c=useRef(null),l=useRef(0),p=s==="es"?j0.es:j0.en;useEffect(()=>{if(!o)return;let m=v=>{Date.now()-l.current<100||c.current&&!c.current.contains(v.target)&&i(false);},f=v=>{v.key==="Escape"&&i(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let u=[{value:"all",label:p.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:p.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:p.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:p.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o||(l.current=Date.now()),i(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",d&&(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"}),p.filters,d&&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:p.filterByStatus})}),jsx("div",{className:"py-2",children:u.map(m=>{let f=e===m.value&&!t,v=()=>m.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"}):m.icon;return jsxs("button",{onClick:()=>{a(m.value),r(false),i(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?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.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 m=!t;r(m),m&&a("all"),i(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:p.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function K0(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function Co(e){return `$${Math.round(e).toLocaleString("es-CO")}`}function q0({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s}){let o=a==="es",i=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:i?o?"SALUD FINANCIERA":"FINANCIAL HEALTH":o?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,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"})})})]}),i&&(e.totalOffered!==void 0||e.totalEstimated!==void 0)&&(()=>{let c=e.totalOffered??0,l=e.totalEstimated??0,p=e.totalExecuted??0,u=c-p,d=c>0?Math.round(u/c*100):0,m=c-l,f=c>0?Math.round(m/c*100):0,v=c>0?Math.min(Math.round(p/c*100),120):0,b=p>c&&c>0,h=b?"#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:Co(c)})]}),(()=>{let y=e.totalEstimatedLabor??0,x=e.totalEstimatedEquipment??0,w=e.totalEstimatedTravel??0,C=x>0||w>0,P=(O,T)=>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:O}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Co(T)})]});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:Co(l)})]}),C&&jsxs(Fragment,{children:[P(o?"Mano de obra":"Labor",y),x>0&&P(o?"Activos":"Equipment",x),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),p>0&&(()=>{let y=e.totalExecutedLabor??0,x=e.totalExecutedEquipment??0,w=e.totalExecutedTravel??0,C=x>0||w>0,P=(O,T)=>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:O}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:Co(T)})]});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",b?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:Co(p)})]}),C&&jsxs(Fragment,{children:[P(o?"Mano de obra":"Labor",y),x>0&&P(o?"Activos":"Equipment",x),w>0&&P(o?"Vi\xE1ticos":"Travel",w)]})]})})(),c>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(v,100)}%`,backgroundColor:h}})}),l>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",m>=0?t?"bg-[#00E5CC]/10 text-[#00E5CC]":"bg-emerald-50 text-emerald-600":t?"bg-[#F87171]/10 text-[#F87171]":"bg-red-50 text-red-600"),children:[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:[m>=0?"+":"",Co(m),c>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",m>=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:[u>=0?`+${Co(u)} ${o?"disponible (caja)":"available (cash)"}`:`${Co(Math.abs(u))} ${o?"sobregirado":"overdrawn"}`,c>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d,"%)"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let c=e.totalHoursSpentMinutes??0,l=e.totalHoursAllocatedMinutes??0,p=l>0?Math.min(Math.round(c/l*100),100):0,m=(l>0?c/l:0)>1.1?"#F87171":p>=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:K0(c)})]}),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:K0(l)})]}),l>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:`${p}%`,backgroundColor:m}})})]})]})})(),(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(c=>jsxs("button",{onClick:()=>s?.(c.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:c.name})]},c.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 c=e.scheduleVarianceDays??0,l=c>0,p=c<0,u=e.scheduleVarianceLabel||(l?`+${c} ${o?"D\xEDas ADELANTE":"Days AHEAD"}`:p?`${c} ${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",l&&"bg-[#3BF06E]/15 text-[#3BF06E]",p&&"bg-[#F87171]/15 text-[#F87171]",!l&&!p&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:u})})()]}),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((c,l)=>{let p=c.utilizationPercent>=100?"#F87171":c.utilizationPercent>=80?"#FFD60A":c.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:c.name}),jsxs("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:[c.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(c.utilizationPercent,100)}%`,backgroundColor:p}})})]},`${c.name}-${l}`)})})]})]})}var gC=[{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 ef(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...ef(n.subtasks,t+1,s));}return r}function fC(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let p=Math.max(0,Math.min(a.getTime()-o,c))/c*100;if(p<=0)continue;let u=(s.progress||0)/p;r+=u,n++;}return n>0?r/n:null}function Fs(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=Fs(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function Ps(e){if(e<=0)return "0h";let t=Math.floor(e/60),a=e%60;return a>0?`${t}h ${a}m`:`${t}h`}function bC({value:e,onChange:t,isDark:a}){let[r,n]=useState(false),[s,o]=useState(String(e||""));return r?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:s,onClick:i=>i.stopPropagation(),onChange:i=>o(i.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let i=parseFloat(s);!isNaN(i)&&i>=0&&i<=100?t(i):s===""&&t(0),n(false);},onKeyDown:i=>{i.key==="Enter"&&i.target.blur(),i.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",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:i=>{i.stopPropagation(),o(String(e||"")),n(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?`${e}%`:"\u2014"})}function Z0(e){if(e.length===0)return 0;let t=0,a=0,r=0;for(let i of e){let c=i.weight||0;c>0&&(t+=(i.progress||0)*c,a+=c,r+=1);}let n=r/e.length;if(a>=99&&n>=.95)return Math.round(t/a*10)/10;if(e.reduce((i,c)=>i+(c.effort_minutes||0),0)>0){let i=0,c=0;for(let l of e){let p=l.effort_minutes||60;i+=(l.progress||0)*p,c+=p;}return Math.round(i/c*10)/10}let o=e.reduce((i,c)=>i+(c.progress||0),0);return Math.round(o/e.length*10)/10}function uu(e,t=[]){for(let a of e)a.subtasks&&a.subtasks.length>0?uu(a.subtasks,t):t.push({progress:a.progress||0,weight:a.weight||0,effort_minutes:a.effort_minutes??a.effortMinutes});return t}function tf({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:i=[],customFields:c=[],toolbarRightContent:l,onColumnHeaderClick:p,columnsWithFilter:u,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:b=true,showHierarchy:h=true,tableColumns:y,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:w=true,allowColumnCustomization:C=true,allowColumnResize:P=true,enableContextMenu:O=true,showCreateTaskButton:T=false,onCreateTask:D,persistFilter:M=false,financialBlur:N,healthSidebar:z,lens:$="hours",hourlyRate:Y=0,rateMap:A,aggregateParentHours:Se=false,showProjectTotals:W=false,totalsDollarOverride:Ce}=t,R=t.rowDensity==="compact",we=Ll(f,v),G=m==="dark",Ve=k=>{if(!A||!k.assignees||k.assignees.length===0)return Y;let _=0,X=0;for(let de of k.assignees){let We=de.id?A[de.id]:void 0;if(We==null||We<=0)continue;let Q=typeof de.estimatedMinutes=="number"?de.estimatedMinutes:0;Q>0&&(_+=We*Q,X+=Q);}if(X>0)return _/X;let ne=k.assignees.map(de=>de.id?A[de.id]:void 0).filter(de=>de!=null&&de>0);return ne.length===0?Y:ne.reduce((de,We)=>de+We,0)/ne.length},oe=k=>{let _=0,X=0,ne=0,de=We=>{for(let Q of We)if(Q.subtasks&&Q.subtasks.length>0){let De={s:_,a:X,q:ne};if(de(Q.subtasks),_-De.s+(X-De.a)+(ne-De.q)===0){let Ke=Ve(Q);_+=(Q.timeLoggedMinutes??0)/60*Ke,X+=(Q.effortMinutes??0)/60*Ke,ne+=(Q.soldEffortMinutes??0)/60*Ke;}}else {let De=Ve(Q);_+=(Q.timeLoggedMinutes??0)/60*De,X+=(Q.effortMinutes??0)/60*De,ne+=(Q.soldEffortMinutes??0)/60*De;}};return k.subtasks&&de(k.subtasks),{dollarSpent:_,dollarAllocated:X,dollarQuoted:ne}},Be=useCallback(()=>{if(!M||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let k=localStorage.getItem(M);if(k){let _=JSON.parse(k);return {statusFilter:_.statusFilter||"all",hideCompleted:_.hideCompleted||!1}}}catch(k){console.error("Error loading persisted filter:",k);}return {statusFilter:"all",hideCompleted:false}},[M]),le=useMemo(()=>{function k(_){let X=0,ne=0,de=0,We=0,Q=0,De=0;for(let Re of _)if(Re.subtasks&&Re.subtasks.length>0){let Ke=k(Re.subtasks);if(Ke.spent+Ke.allocated+Ke.quoted>0)X+=Ke.spent,ne+=Ke.allocated,de+=Ke.quoted,We+=Ke.dollarSpent,Q+=Ke.dollarAllocated,De+=Ke.dollarQuoted;else {let ut=Re.timeLoggedMinutes??0,ct=Re.effortMinutes??0,Zt=Re.soldEffortMinutes??0;X+=ut,ne+=ct,de+=Zt;let it=Ve(Re);We+=ut/60*it,Q+=ct/60*it,De+=Zt/60*it;}}else {let Ke=Re.timeLoggedMinutes??0,$t=Re.effortMinutes??0,ut=Re.soldEffortMinutes??0;X+=Ke,ne+=$t,de+=ut;let ct=Ve(Re);We+=Ke/60*ct,Q+=$t/60*ct,De+=ut/60*ct;}return {spent:X,allocated:ne,quoted:de,dollarSpent:We,dollarAllocated:Q,dollarQuoted:De}}return k(e)},[e]),He=useMemo(()=>{let k=new Map;function _(X){let ne=0;for(let de of X)if(de.subtasks&&de.subtasks.length>0){let We=_(de.subtasks);k.set(de.id,We),ne+=We;}else ne+=de.weight||0;return ne}return _(e),k},[e]),$e=useMemo(()=>!z?.enabled||!z.data?z:{...z,data:{...z.data,totalHoursSpentMinutes:le.spent,totalHoursAllocatedMinutes:le.allocated}},[z,le]),[Pe,je]=useState(true),[tt,ee]=useState(null),[Ae,ot]=useState("position"),[Ie,zt]=useState("asc"),[st,bt]=useState(""),[Ee,Dt]=useState(()=>Be().statusFilter),[ht,_e]=useState(()=>Be().hideCompleted),[dt,L]=useState(y||gC),[J,xe]=useState(false),[I,j]=useState(false),[ke,Ue]=useState({isOpen:false,x:0,y:0,type:"task"}),[ue,at]=useState(null),[yt,Ye]=useState(false),[vt,Xt]=useState(null),[wt,Ut]=useState(null),[Ht,he]=useState(null),Fe=useRef(0),Qe=useRef(false),rt=!!(a.onTaskMove||a.onTaskReparent),[Tt,Ft]=useState(null),[kt,Da]=useState(null),aa=k=>{let _=k.type;return k.customFieldId?_==="file"?null:{kind:"customField",fieldId:k.customFieldId}:_==="assignees"||_==="teamLoad"?"assignees":_==="startDate"?"startDate":_==="endDate"?"endDate":null},cr=(k,_)=>typeof k=="string"||typeof _=="string"?k===_:k.fieldId===_.fieldId,Xe=useRef([]),et=useCallback((k,_)=>{rt&&(_.preventDefault(),Fe.current=_.clientY,at(k),Qe.current=false,Ye(false),he({x:_.clientX,y:_.clientY}));},[rt]),Sa=useCallback(k=>{if(!ue||(Math.abs(k.clientY-Fe.current)>5&&!Qe.current&&(Qe.current=true,Ye(true)),he({x:k.clientX,y:k.clientY}),!Qe.current))return;let X=document.querySelectorAll("[data-listview-row]"),ne=null,de=null;X.forEach(We=>{let Q=We.getBoundingClientRect(),De=We.getAttribute("data-listview-row");if(De&&De!==ue&&k.clientY>=Q.top&&k.clientY<=Q.bottom){ne=De;let Re=k.clientY-Q.top,Ke=Q.height;de=Re<Ke*.25?"above":Re>Ke*.75?"below":"child";}}),Xt(ne),Ut(de);},[ue]),Ia=useCallback(()=>{if(Qe.current&&ue&&vt&&wt){if(wt==="child"&&a.onTaskReparent)a.onTaskReparent(ue,vt);else if(wt==="above"||wt==="below"){let k=(ne,de,We=null)=>{for(let Q of ne){if(Q.id===de)return We;if(Q.subtasks){let De=k(Q.subtasks,de,Q.id);if(De!==void 0)return De}}},_=k(e,ue,null),X=k(e,vt,null);if(a.onTaskReparent){let ne=(Ke,$t)=>{if($t===null)return Ke;for(let ut of Ke){if(ut.id===$t)return ut.subtasks||[];if(ut.subtasks){let ct=ne(ut.subtasks,$t);if(ct.length>0||ut.subtasks.some(Zt=>Zt.id===$t))return ct}}return []},de=ne(e,X??null),We=de.findIndex(Ke=>Ke.id===vt),Q=_===X,De=Q?de.findIndex(Ke=>Ke.id===ue):-1,Re=wt==="below"?We+1:We;Q&&De!==-1&&De<We&&(Re-=1),a.onTaskReparent(ue,X??null,Math.max(0,Re));}}}at(null),Xt(null),Ut(null),he(null),Qe.current=false,Ye(false);},[ue,vt,wt,e,a]),dr=(k,_)=>typeof _!="string"?k.customFields?.find(ne=>ne.fieldId===_.fieldId)?.value:_==="assignees"?k.assignees:_==="startDate"?k.startDate:k.endDate,xr=(k,_,X,ne)=>{k.preventDefault(),k.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let de=Array.from(document.querySelectorAll("[data-listview-row]")),We=de.map(pt=>pt.getAttribute("data-listview-row")||""),Q=Math.max(0,We.indexOf(_)),De=pt=>We.slice(Q,pt+1);Da({sourceTaskId:_,column:X,sourceIndex:ne,targetIndex:ne,rangeIds:new Set([_])});let Ke=(pt=>{let At=pt?.parentElement??null;for(;At;){let Pr=window.getComputedStyle(At).overflowY;if((Pr==="auto"||Pr==="scroll")&&At.scrollHeight>At.clientHeight)return At;At=At.parentElement;}let Ba=document.scrollingElement;return Ba&&Ba.scrollHeight>Ba.clientHeight?Ba:null})(k.currentTarget),$t=pt=>{let At=Q,Ba=false;de.forEach((Pr,ur)=>{let Ka=Pr.getBoundingClientRect();pt>=Ka.top&&pt<=Ka.bottom&&(At=ur,Ba=true);});let kr=de[de.length-1];if(!Ba&&kr){let Pr=kr.getBoundingClientRect();pt>Pr.bottom&&(At=de.length-1);}return At<Q&&(At=Q),At},ut=k.clientY,ct=null,Zt=()=>{ct!==null&&(cancelAnimationFrame(ct),ct=null);},it=()=>{let pt=$t(ut),At=new Set(De(pt));Da(Ba=>Ba&&{...Ba,targetIndex:pt,rangeIds:At});},ea=()=>{if(Zt(),!Ke)return;let pt=Ke,Ba=pt===document.scrollingElement?{top:0,bottom:window.innerHeight}:pt.getBoundingClientRect(),kr=60,Pr=12,ur=ut-Ba.top,Ka=Ba.bottom-ut,to=pt.scrollHeight-pt.clientHeight;if(Ka<kr&&pt.scrollTop<to){let ts=Math.max(1,Math.round(Pr*(1-Math.max(0,Ka)/kr))),Cr=()=>{pt.scrollTop+=ts,it(),pt.scrollTop<pt.scrollHeight-pt.clientHeight&&(ct=requestAnimationFrame(Cr));};ct=requestAnimationFrame(Cr);}else if(ur<kr&&pt.scrollTop>0){let ts=Math.max(1,Math.round(Pr*(1-Math.max(0,ur)/kr))),Cr=()=>{pt.scrollTop-=ts,it(),pt.scrollTop>0&&(ct=requestAnimationFrame(Cr));};ct=requestAnimationFrame(Cr);}},xt=pt=>{ut=pt.clientY,it(),ea();},Lt=pt=>{window.removeEventListener("mousemove",xt),window.removeEventListener("mouseup",Lt),Zt(),document.body.style.cursor="",document.body.style.userSelect="",Da(null);let At=$t(pt.clientY),Ba=new Map(Xe.current.map(Ka=>[Ka.id,Ka])),kr=Ba.get(_);if(!kr)return;let Pr=dr(kr,X),ur=[];for(let Ka of De(At)){if(Ka===_)continue;let to=Ba.get(Ka);to&&(to.subtasks&&to.subtasks.length>0||ur.push(Ka));}ur.length>0&&a.onBulkFill?.(ur,X,Pr);};window.addEventListener("mousemove",xt),window.addEventListener("mouseup",Lt);},Ra=k=>kt?kt.rangeIds.has(k):false;useEffect(()=>{if(ue)return document.addEventListener("mousemove",Sa),document.addEventListener("mouseup",Ia),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Sa),document.removeEventListener("mouseup",Ia),document.body.style.cursor="",document.body.style.userSelect="";}},[ue,Sa,Ia]);let[Ja,se]=useState("all"),[me,q]=useState(false),pe=useRef(null),ce=useRef(null),B=useMemo(()=>{let k=0;function _(X,ne){for(let de of X)ne>k&&(k=ne),de.subtasks?.length&&_(de.subtasks,ne+1);}return _(e,1),k},[e]);useEffect(()=>{if(!me)return;let k=_=>{pe.current?.contains(_.target)||ce.current?.contains(_.target)||q(false);};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[me]),useEffect(()=>{if(Ja==="all"){let X=function(ne){for(let de of ne)de.subtasks?.length&&(de.isExpanded===false&&a.onTaskToggleExpand?.(de.id),X(de.subtasks));};X(e);}else {let X=function(ne,de){for(let We of ne)if(We.subtasks?.length){let Q=de<Ja,De=We.isExpanded!==false;Q!==De&&a.onTaskToggleExpand?.(We.id),X(We.subtasks,de+1);}};X(e,1);}},[Ja]);let[re,be]=useState(null),[S,H]=useState(0),[Z,Te]=useState(0),gt=useRef(null),[fe,Ne]=useState(null),[ye,lt]=useState(null);useEffect(()=>{y&&L(k=>{if(k.length===y.length){let _=true;for(let X=0;X<k.length;X++){let ne=k[X],de=y[X];if(!ne||!de||ne.id!==de.id||ne.visible!==de.visible||ne.width!==de.width||ne.label!==de.label){_=false;break}}if(_)return k}return y});},[y]),useEffect(()=>{if(!(!M||typeof window>"u"))try{localStorage.setItem(M,JSON.stringify({statusFilter:Ee,hideCompleted:ht}));}catch(k){console.error("Error persisting filter state:",k);}},[M,Ee,ht]);let Et=useMemo(()=>{let k=new Set;function _(X){for(let ne of X)ne.subtasks?.length&&(ne.isExpanded!==false&&k.add(ne.id),_(ne.subtasks));}return _(e),k},[e]),Qt=useMemo(()=>dt.filter(k=>k.visible),[dt]),ja=useCallback(k=>{a.onTaskToggleExpand?.(k);},[a]),Er=useCallback(k=>{Ae===k?zt(_=>_==="asc"?"desc":"asc"):(ot(k),zt("asc")),a.onSortChange?.({column:k,direction:Ie==="asc"?"desc":"asc"});},[Ae,Ie,a]),_a=useCallback(k=>{L(k),a.onColumnsChange?.(k);},[a]),Mr=useCallback(k=>{let _=dt.map(X=>X.id===k?{...X,visible:false}:X);_a(_);},[dt,_a]),xa=useCallback((k,_)=>{ot(k),zt(_);},[]),On=useCallback((k,_,X)=>{O&&(k.preventDefault(),Ue({isOpen:true,x:k.clientX,y:k.clientY,type:_?"task":"header",task:_,columnId:X}));},[O]),Vr=useCallback(()=>{Ue(k=>({...k,isOpen:false}));},[]),Rs=useCallback((k,_)=>{if(!P)return;k.preventDefault(),k.stopPropagation();let X=dt.find(ne=>ne.id===_);X&&(be(_),H(k.clientX),Te(X.width));},[dt,P]);useEffect(()=>{if(!re)return;let k=dt,_=ne=>{let de=ne.clientX-S,We=Math.max(50,Z+de);k=k.map(Q=>Q.id===re?{...Q,width:We}:Q),L(k);},X=()=>{a.onColumnsChange?.(k),be(null);};return document.addEventListener("mousemove",_),document.addEventListener("mouseup",X),()=>{document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",X);}},[re,S,Z,a]);let Xr=useCallback((k,_)=>{if(_==="name"){k.preventDefault();return}Ne(_),k.dataTransfer.effectAllowed="move",k.dataTransfer.setData("text/plain",_),k.currentTarget instanceof HTMLElement&&(k.currentTarget.style.opacity="0.5");},[]),Pi=useCallback(k=>{k.currentTarget instanceof HTMLElement&&(k.currentTarget.style.opacity="1"),Ne(null),lt(null);},[]),Qo=useCallback((k,_)=>{k.preventDefault(),_!=="name"&&(k.dataTransfer.dropEffect="move",lt(_));},[]),Fi=useCallback(()=>{lt(null);},[]),Qa=useCallback((k,_)=>{if(k.preventDefault(),!fe||fe===_||_==="name")return;let X=[...dt],ne=X.findIndex(Q=>Q.id===fe),de=X.findIndex(Q=>Q.id===_);if(ne===-1||de===-1)return;let We=X.splice(ne,1);We[0]&&(X.splice(de,0,We[0]),_a(X),Ne(null),lt(null));},[fe,dt,_a]),Bs=useCallback(async k=>{if(a.onCreateCustomField){let _={...k,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(_);}j(false);},[a]),eo=useCallback(k=>k.progress===100||k.status==="completed"?"completed":k.progress&&k.progress>0||k.status==="in-progress"?"in-progress":"todo",[]),$s=t.groupBy==="status",vr=t.groupStateKey?`listview-grupos-plegados:${t.groupStateKey}`:null,[Jr,Hn]=useState(()=>{let k=new Set(t.defaultCollapsedGroups??["completed"]);if(!vr)return k;try{let _=localStorage.getItem(vr);return _?new Set(JSON.parse(_)):k}catch{return k}}),Os=useCallback(k=>{Hn(_=>{let X=new Set(_);if(X.has(k)?X.delete(k):X.add(k),vr)try{localStorage.setItem(vr,JSON.stringify([...X]));}catch{}return X});},[vr]),cn=!!t.selectable,[Hs,Li]=useState(new Set),Un=useMemo(()=>t.selectedIds?new Set(t.selectedIds):Hs,[t.selectedIds,Hs]),Ai=useRef(null),{lista:$r,cabeceras:Zo,todas:wr}=useMemo(()=>{let k=ef(e);if(st.trim()){let X=st.toLowerCase();k=k.filter(ne=>ne.name.toLowerCase().includes(X));}let _=t.showStatusFilter!==false;if(_&&Ee!=="all"){let X=new Set(k.filter(ne=>eo(ne)===Ee).flatMap(ne=>ne.parentPath));k=k.filter(ne=>X.has(ne.id));}if(_&&ht){let X=new Set(k.filter(ne=>eo(ne)!=="completed").flatMap(ne=>ne.parentPath));k=k.filter(ne=>X.has(ne.id));}if(t.groupBy==="assignee"||t.groupBy==="due"){let X=t.groupBy==="assignee",ne=[],de=(it,ea,xt,Lt)=>{for(let pt of it){let At=[...xt,pt.id];ne.push({...pt,level:ea,hasChildren:(pt.subtasks?.length||0)>0,parentPath:At,...Lt?{__padre:Lt}:{}}),pt.subtasks?.length&&de(pt.subtasks,ea+1,At,pt.name);}};de(e,0,[]);let We=st.trim().toLowerCase(),Q=We?ne.filter(it=>it.name.toLowerCase().includes(We)):ne,De=f==="es",Re=[["overdue","Vencidas","Overdue"],["today","Hoy","Today"],["week","Esta semana","This week"],["later","M\xE1s adelante","Later"],["past","Anteriores","Earlier"],["none","Sin fecha","No date"]],Ke=new Map;for(let it of Q){let ea=X?(()=>{let xt=(it.assignees??[]).map(Lt=>Lt.name).filter(Boolean);return xt.length?xt:["__sin"]})():[t.dueBucket?.(it)??"none"];for(let xt of ea){let Lt=X?`user:${xt}`:`due:${xt}`,pt=X?xt==="__sin"?De?"Sin responsable":"Unassigned":xt:Re.find(At=>At[0]===xt)?.[De?1:2]??xt;Ke.has(Lt)||Ke.set(Lt,{titulo:pt,filas:[]}),Ke.get(Lt).filas.push({...it,level:0,hasChildren:false,__claveFila:`${Lt}|${it.id}`});}}let $t=X?[...Ke.keys()].sort((it,ea)=>it==="user:__sin"?1:ea==="user:__sin"?-1:Ke.get(it).titulo.localeCompare(Ke.get(ea).titulo)):Re.map(it=>`due:${it[0]}`).filter(it=>Ke.has(it)),ut=it=>it.endDate?new Date(it.endDate).getTime():1/0,ct=[],Zt=new Map;for(let it of $t){let ea=Ke.get(it),xt=Jr.has(it);Zt.set(ct.length,[...Zt.get(ct.length)??[],{clave:it,cuenta:ea.filas.length,plegado:xt,titulo:ea.titulo}]),xt||ct.push(...ea.filas.sort((Lt,pt)=>ut(Lt)-ut(pt)));}return {lista:ct,cabeceras:Zt,todas:Q}}if($s){let X=["todo","in-progress","completed"],ne=new Map,de=[];for(let Re of k){let Ke=Re.parentPath[0]??Re.id;Re.level===0&&de.push(Re),ne.has(Ke)||ne.set(Ke,[]),ne.get(Ke).push(Re);}let We=Re=>Re.endDate?new Date(Re.endDate).getTime():1/0,Q=[],De=new Map;for(let Re of X){let Ke=de.filter(it=>eo(it)===Re).sort((it,ea)=>We(it)-We(ea)),$t=Ke.flatMap(it=>ne.get(it.id)??[it]),ut=$t.filter(it=>!it.hasChildren).length;if(ut===0&&Ke.length===0)continue;let ct=Jr.has(Re),Zt=Q.length;De.set(Zt,[...De.get(Zt)??[],{clave:Re,cuenta:ut,plegado:ct}]),ct||Q.push(...$t);}return {lista:Q,cabeceras:De,todas:k}}return k.sort((X,ne)=>{let de,We;switch(Ae){case "name":de=X.name.toLowerCase(),We=ne.name.toLowerCase();break;case "startDate":de=X.startDate?.getTime()||0,We=ne.startDate?.getTime()||0;break;case "endDate":de=X.endDate?.getTime()||0,We=ne.endDate?.getTime()||0;break;case "progress":de=X.progress||0,We=ne.progress||0;break;case "status":de=X.status||"todo",We=ne.status||"todo";break;case "priority":let Q={urgent:0,high:1,medium:2,low:3,none:4};de=Q[X.priority]??4,We=Q[ne.priority]??4;break;case "position":return 0;default:return 0}return de<We?Ie==="asc"?-1:1:de>We?Ie==="asc"?1:-1:0}),{lista:k,cabeceras:new Map,todas:k}},[e,st,Ee,ht,Ae,Ie,eo,t.showStatusFilter,$s,Jr,t.groupBy,t.dueBucket,f]);Xe.current=$r;let No=(k,_)=>{let X=new Set(Un),ne=Ai.current,de=Xe.current.map(We=>We.id);if(_&&ne&&ne!==k&&de.includes(ne)&&de.includes(k)){let We=de.indexOf(ne),Q=de.indexOf(k),De=Math.min(We,Q),Re=Math.max(We,Q),Ke=!Un.has(k);for(let $t of de.slice(De,Re+1))Ke?X.add($t):X.delete($t);}else X.has(k)?X.delete(k):X.add(k);Ai.current=k,t.selectedIds||Li(X),a.onSelectionChange?.([...X]);},Do=Un.size>0,oa=k=>jsx("div",{className:"w-6 flex-shrink-0 flex items-center justify-center",onClick:_=>_.stopPropagation(),children:jsx("input",{type:"checkbox","data-casilla-fila":k,"aria-label":f==="es"?"Seleccionar tarea":"Select task",checked:Un.has(k),onChange:()=>{},onClick:_=>{_.stopPropagation(),No(k,_.shiftKey);},className:g("w-3.5 h-3.5 cursor-pointer transition-opacity",Do?"opacity-100":"opacity-0 group-hover:opacity-100 focus:opacity-100")})}),dc={todo:{es:"Por hacer",en:"To do"},"in-progress":{es:"En curso",en:"In progress"},completed:{es:"Completadas",en:"Completed"}},Us=(k,_)=>{let X=Zo.get(k);if(!X?.length)return _;let ne=X.map(de=>jsx("div",{"data-grupo-de-estado":de.clave,"data-plegado":de.plegado?"true":"false",className:g("flex items-center gap-2 px-4 h-9 border-b select-none",G?"border-[#222] bg-[#111]":"border-gray-200 bg-white"),children:jsxs("button",{type:"button",onClick:()=>Os(de.clave),"aria-expanded":!de.plegado,className:g("inline-flex items-center gap-1.5 text-[12px] font-semibold rounded px-1 -ml-1",G?"text-white/80 hover:bg-white/[0.05]":"text-gray-700 hover:bg-gray-100"),children:[de.plegado?jsx(ChevronRight,{className:"w-3.5 h-3.5"}):jsx(ChevronDown,{className:"w-3.5 h-3.5"}),de.titulo??dc[de.clave]?.[f==="es"?"es":"en"]??de.clave,jsx("span",{className:g("font-normal tabular-nums",G?"text-white/40":"text-gray-400"),children:de.cuenta})]})},`grupo-${de.clave}`));return _?[...ne,_]:ne},es=useCallback((k,_)=>{let X=We=>{a.onTaskUpdate?.({...k,...We});},ne=We=>We?k.customFields?.find(De=>De.fieldId===We)?.value:void 0,de=(We,Q)=>{if(!We)return;let Re=[...k.customFields||[]],Ke=Re.findIndex($t=>$t.fieldId===We);Ke>=0?Re[Ke]={fieldId:We,value:Q}:Re.push({fieldId:We,value:Q}),X({customFields:Re});};switch(_.type){case "name":return null;case "status":return jsx(Hg,{value:k.status||(k.progress===100?"completed":k.progress&&k.progress>0?"in-progress":"todo"),onChange:Q=>{X({status:Q,progress:Q==="completed"?100:Q==="in-progress"?50:0});},isDark:G,locale:f,translations:we.status});case "priority":return jsx(Wg,{value:k.priority,onChange:Q=>X({priority:Q}),isDark:G,locale:f});case "assignees":{let Q=k.hasChildren,De=k.assignees||[];if(Q&&k.subtasks?.length){let Re=new Map,Ke=$t=>{($t||[]).forEach(ut=>{(ut.assignees||[]).forEach(ct=>{Re.has(ct.name)||Re.set(ct.name,ct);}),ut.subtasks?.length&&Ke(ut.subtasks);});};Ke(k.subtasks),De=Array.from(Re.values());}else Q&&(De=[]);return jsx(Rl,{value:De,availableUsers:i,onChange:Re=>X({assignees:Re}),isDark:G,locale:f,disabled:Q})}case "startDate":return jsx($l,{value:k.startDate,onChange:Q=>X({startDate:Q}),isDark:G,locale:f,dateField:"start",startDate:k.startDate,endDate:k.endDate});case "endDate":{let Q=jsx($l,{value:k.endDate,onChange:De=>X({endDate:De}),isDark:G,locale:f,dateField:"end",startDate:k.startDate,endDate:k.endDate});return t.isTaskOverdue?.(k)?jsxs("span",{"data-vencida":"true",className:"inline-flex items-center gap-1",style:{color:G?"#FF7A7F":"#C22F35"},children:[jsx(AlertCircle,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":true}),Q]}):Q}case "progress":{let Q=!!(k.subtasks&&k.subtasks.length>0),De=Q?Z0(uu(k.subtasks||[])):k.progress||0;return jsx(Xg,{value:De,onChange:Q?void 0:Re=>{let Ke=Re===100?"completed":Re>0?"in-progress":"todo";X({progress:Re,status:Ke});},isDark:G,disabled:Q})}case "tags":return jsx(p0,{value:k.tags||[],isDark:G});case "text":return jsx(Zg,{value:ne(_.customFieldId)||"",onChange:Q=>de(_.customFieldId,Q),isDark:G});case "number":return jsx(a0,{value:ne(_.customFieldId)||0,onChange:Q=>de(_.customFieldId,Q),isDark:G});case "date":let We=ne(_.customFieldId);return jsx($l,{value:We?new Date(We):void 0,onChange:Q=>de(_.customFieldId,Q),isDark:G,locale:f});case "dropdown":return jsx(r0,{value:ne(_.customFieldId)||"",options:_.options||[],onChange:Q=>de(_.customFieldId,Q),isDark:G});case "checkbox":return jsx(o0,{value:ne(_.customFieldId)||false,onChange:Q=>de(_.customFieldId,Q),isDark:G});case "multiselect":return jsx(s0,{value:ne(_.customFieldId)||[],options:_.options||[],onChange:Q=>de(_.customFieldId,Q),isDark:G,maxSelectable:_.maxSelectable});case "person":{let Q=ne(_.customFieldId)||[];return jsx(Rl,{value:Q.map(De=>({name:De.name,avatar:De.avatar,initials:De.initials||(De.name||"?").slice(0,2).toUpperCase(),color:De.color||"#00E5CC"})),availableUsers:i,onChange:De=>de(_.customFieldId,De),isDark:G,locale:f})}case "file":return jsx(c0,{value:ne(_.customFieldId),isDark:G,onOpen:Q=>{Q.url&&window.open(Q.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let Q=k.status==="completed"||k.progress===100;return jsx(Gr,{value:k.estimatedTime,onChange:De=>X({estimatedTime:De}),isDark:G,locale:f,disabled:Q,lens:$,hourlyRate:Ve(k)})}case "quotedTime":{let Q=k.status==="completed"||k.progress===100,De=N?.enabled&&(!N.columns||N.columns.includes("quotedTime"));return jsx(Gr,{value:k.quotedTime,onChange:Re=>X({quotedTime:Re}),isDark:G,locale:f,disabled:Q,isBlurred:De,lens:$,hourlyRate:Ve(k)})}case "elapsedTime":{let Q=k.status==="completed"||k.progress===100,De=k.executedDollarsCanonical;return jsx(Gr,{value:k.elapsedTime,onChange:Re=>X({elapsedTime:Re}),isDark:G,locale:f,disabled:Q,lens:$,hourlyRate:Ve(k),financialOverride:De})}case "effortMinutes":{if(Se&&k.subtasks&&k.subtasks.length>0){let{allocated:$t}=Fs(k);if($==="financial"){let ut=oe(k),ct=Math.round(ut.dollarAllocated),Zt=Math.round(ut.dollarQuoted),it=Zt-ct;return jsxs("div",{className:"flex flex-col",children:[ct>0?jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",ct.toLocaleString("es-CO")]}):null,it!==0&&ct>0&&Zt>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",it>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[it>0?"+":"",Math.abs(it)>=1e3?`$${(it/1e3).toFixed(1)}K`:`$${it}`]})]})}return jsx(Gr,{value:$t>0?$t:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Y})}let Q=k.status==="completed"||k.progress===100,De=k.effortMinutes||0,Re=k.soldEffortMinutes||0,Ke=Ve(k);if($==="financial"&&Ke&&De>0&&Re>0){let $t=Math.round(De/60*Ke),ct=Math.round(Re/60*Ke)-$t;return jsxs("div",{className:"flex flex-col",children:[jsx(Gr,{value:De,onChange:Zt=>X({effortMinutes:Zt}),isDark:G,locale:f,disabled:Q,lens:$,hourlyRate:Ve(k)}),ct!==0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ct>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[ct>0?"+":"",Math.abs(ct)>=1e3?`$${(ct/1e3).toFixed(1)}K`:`$${ct}`]})]})}return jsx(Gr,{value:De,onChange:$t=>X({effortMinutes:$t}),isDark:G,locale:f,disabled:Q,lens:$,hourlyRate:Ve(k)})}case "timeLoggedMinutes":{let Q=k.executedDollarsCanonical;if(Se&&k.subtasks&&k.subtasks.length>0){let{spent:Re}=Fs(k);return jsx(Gr,{value:Re>0?Re:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k),financialOverride:Q})}let De=k.status==="completed"||k.progress===100;return jsx(Gr,{value:k.timeLoggedMinutes,onChange:a.onLogTime?Re=>{a.onLogTime?.(k,Re);}:void 0,isDark:G,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:De,lens:$,hourlyRate:Ve(k),financialOverride:Q})}case "soldEffortMinutes":{if(Se&&k.subtasks&&k.subtasks.length>0){let{quoted:Re}=Fs(k),Ke=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(Gr,{value:Re>0?Re:void 0,isDark:G,locale:f,disabled:true,isBlurred:Ke,lens:$,hourlyRate:Ve(k)})}let Q=k.status==="completed"||k.progress===100,De=N?.enabled&&(!N.columns||N.columns.includes("soldEffortMinutes"));return jsx(Gr,{value:k.soldEffortMinutes,onChange:Re=>X({soldEffortMinutes:Re}),isDark:G,locale:f,disabled:Q,isBlurred:De,lens:$,hourlyRate:Ve(k)})}case "scheduleVariance":{let Q=k.effortMinutes||0,De=k.soldEffortMinutes||0,Re=k.timeLoggedMinutes||0,Ke=Q>0||De>0||Re>0;return jsx(b0,{startDate:k.startDate,endDate:k.endDate,scheduleVariance:k.scheduleVariance,isDark:G,locale:f,hasTimeAllocated:Ke})}case "hoursBar":{if(Se&&k.hasChildren){let{spent:Q,allocated:De,quoted:Re}=Fs(k),Ke=Q>De&&De>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",G?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",Ke?"text-[#FF453A]":G?"text-white/80":"text-gray-800"),children:Ps(Q)}),De>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:G?"text-white/60":"text-gray-600",children:Ps(De)})]}),Re>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:G?"text-amber-400/70":"text-amber-600",children:Ps(Re)})]})]})}return jsx(y0,{task:k,isDark:G,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:$,hourlyRate:Ve(k)})}case "teamLoad":return k.hasChildren||k.subtasks&&k.subtasks.length>0?jsx(v0,{task:k,isDark:G,locale:f}):jsx(Rl,{value:k.assignees||[],availableUsers:i,onChange:De=>{a.onTaskUpdate?.({...k,assignees:De});},isDark:G,locale:f});case "blockers":return jsx(k0,{blockers:k.blockers,isDark:G,locale:f});case "weight":{let Q=He.get(k.id);if(Q!==void 0)return jsx("span",{className:g("text-xs font-mono",Q>0?G?"text-white/50":"text-gray-400":G?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q>0?`${Number(Q.toFixed(2))}%`:"\u2014"});let De=k.weight||0;return jsx(bC,{value:De,onChange:Re=>X({weight:Re}),isDark:G})}default:return jsx("span",{className:g("text-sm",G?"text-white/60":"text-gray-500"),children:"-"})}},[a,G,f,i,we,Se,He]),Ws=useCallback(k=>{let X={name:we.columns.name,status:we.columns.status,priority:we.columns.priority,assignees:we.columns.assignees,startDate:we.columns.startDate,endDate:we.columns.endDate,progress:we.columns.progress,tags:we.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:we.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:we.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:we.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:we.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:we.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:we.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:we.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:we.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),teamLoad:we.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:we.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:we.columns.weight||(f==="es"?"Peso":"Weight")}[k.type]||k.label;return typeof X=="string"?X:String(X||k.type)},[we,f]),Wn=useMemo(()=>{let X=Qt.reduce((de,We)=>de+We.width,0)+(C?48:0),ne={};for(let de of Qt)ne[de.id]=`${de.width/X*100}%`;return ne},[Qt,C]);return r?jsx("div",{className:g("flex-1 flex items-center justify-center",G?"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",G?"text-white/60":"text-gray-600"),children:[we.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",G?"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",G?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",G?"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",G?"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",G?"text-white":"text-gray-900"),children:we.empty.noTasks}),jsx("p",{className:g("text-sm",G?"text-white/60":"text-gray-600"),children:we.empty.addFirstTask})]})}):jsxs("div",{ref:gt,className:g(G?"bg-[#0D0D0D]":"bg-white",re&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let k=!!t.toolbarContainer,_=jsx("div",{className:k?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",G?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:k?"flex items-center gap-2":"flex items-center gap-4",children:[jsx("div",{className:g("text-sm whitespace-nowrap",G?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let X=wr.filter(We=>(We.subtasks?.length??0)>0).length,ne=wr.length-X,de=f==="es";return jsxs(Fragment,{children:[ne," ",we.pagination.tasks,X>0&&jsxs(Fragment,{children:[" \xB7 ",X," ",de?X===1?"tarea padre":"tareas padre":X===1?"parent task":"parent tasks"]})]})})()}),b&&!k&&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",G?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:st,onChange:X=>bt(X.target.value),placeholder:we.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",G?"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")})]}),!k&&jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),h&&B>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:pe,onClick:()=>q(!me),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",G?me?"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]":me?"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"}),Ja==="all"?f==="es"?"Todos":"All":`L${Ja}`]}),me&&jsx("div",{ref:ce,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",G?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(B,5)},(X,ne)=>({value:ne+1,label:`L${ne+1}`}))].map(X=>jsxs("button",{onClick:()=>{se(X.value),q(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",G?Ja===X.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":Ja===X.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:X.label}),Ja===X.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(X.value)))})]}),t.showStatusFilter!==false&&jsx(_0,{value:Ee,hideCompleted:ht,onChange:Dt,onHideCompletedChange:_e,isDark:G,locale:f}),$e?.enabled&&$e.data&&!Pe&&jsx("button",{onClick:()=>je(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",G?"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,T&&D&&!k&&jsxs(motion.button,{onClick:D,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:we.toolbar.newTask})]})]})});return k?createPortal(_,t.toolbarContainer):_})(),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",G?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[cn&&jsx("div",{className:"w-6 flex-shrink-0"}),rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(k=>{let _=k.id!=="name",X=ye===k.id&&fe!==k.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",G?"text-white/60":"text-gray-500",_&&"cursor-grab",k.type!=="name"&&"justify-center",fe===k.id&&"opacity-50",X&&(G?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Wn[k.id],minWidth:k.minWidth},draggable:_,onDragStart:_?ne=>Xr(ne,k.id):void 0,onDragEnd:_?Pi:void 0,onDragOver:_?ne=>Qo(ne,k.id):void 0,onDragLeave:_?Fi:void 0,onDrop:_?ne=>Qa(ne,k.id):void 0,onContextMenu:ne=>On(ne,void 0,k.id),children:[_&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",G?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),p?jsxs("button",{draggable:false,onClick:ne=>{let de=ne.currentTarget.getBoundingClientRect();p(k.id,de);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[Ws(k),u?.includes(k.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),Ae===k.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):k.sortable?jsxs("button",{draggable:false,onClick:()=>Er(k.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[Ws(k),u?.includes(k.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",Ae===k.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[Ws(k),u?.includes(k.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),P&&k.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:ne=>Rs(ne,k.id),children:jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",re===k.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},k.id)}),C&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:k=>{k.stopPropagation(),xe(_=>!_);},className:g("p-0.5 rounded transition-colors",G?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",J&&(G?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(H0,{isOpen:J,onClose:()=>xe(false),columns:dt,customFields:c,mostrarColumnasDensas:w,onColumnsChange:_a,onCreateCustomField:()=>{xe(false),j(true);},isDark:G,locale:f})]})]}),jsxs(AnimatePresence,{mode:"popLayout",children:[$r.map((k,_)=>Us(_,(()=>{let X=Et.has(k.id),ne=Math.min(_*.01,.2),de=k.hasChildren&&k.level===0,We=k.subtasks?.length||0;if(de){let{spent:ut,allocated:ct,quoted:Zt}=Fs(k),it=fC(k);return jsxs(motion.div,{"data-task-id":k.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ne},className:g("flex items-center border-y cursor-pointer transition-colors duration-500 group",G?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",tt===k.id&&(G?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(k),children:[cn&&oa(k.id),rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(ea=>jsx("div",{className:g("flex items-center px-4",R?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",ea.type!=="name"&&"justify-center"),style:{width:Wn[ea.id],minWidth:ea.minWidth},children:ea.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{onClick:xt=>{xt.stopPropagation(),ja(k.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",G?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:X?jsx(ChevronDown,{className:g("w-4 h-4",G?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",G?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:xt=>{xt.stopPropagation(),ja(k.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:X?jsx(FolderOpen,{className:"w-4 h-4",style:{color:G?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:G?"#FFD60A":"#B45309"}})}),k.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:G?"#FFD60A":"#B45309"},children:k.wbsCode}),jsxs("div",{className:g("flex min-w-0",R?"flex-row items-baseline gap-2":"flex-col"),children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",R&&"truncate",G?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:k.name}),jsxs("span",{className:g(R?"text-[12px] flex-shrink-0":"text-[10px] font-mono",G?"text-white/30":"text-gray-500"),children:["(",We," ",f==="es"?We===1?"Tarea":"Tareas":We===1?"Item":"Items",")"]}),it!==null&&x&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",it>=1?"text-[#32D74B] bg-[#32D74B]/10":it>=.8?"text-[#FFD60A] bg-[#FFD60A]/10":"text-[#FF453A] bg-[#FF453A]/10"),children:["Avg SPI: ",it.toFixed(2)]})]})]}):ea.type==="timeLoggedMinutes"?$==="financial"?(()=>{let xt=k.executedDollarsCanonical,Lt=xt!=null?Math.round(xt):Math.round(oe(k).dollarSpent);return Lt>0?jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",Lt.toLocaleString("en-US")]}):null})():jsx(Gr,{value:ut>0?ut:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):ea.type==="soldEffortMinutes"?$==="financial"?(()=>{let xt=oe(k),Lt=Math.round(xt.dollarQuoted);return Lt>0?jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",Lt.toLocaleString("en-US")]}):null})():jsx(Gr,{value:Zt>0?Zt:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):ea.type==="effortMinutes"?$==="financial"?(()=>{let xt=oe(k),Lt=Math.round(xt.dollarAllocated),pt=Math.round(xt.dollarQuoted),At=pt-Lt;return jsxs("div",{className:"flex flex-col",children:[Lt>0?jsxs("span",{className:g("text-sm font-mono",G?"text-white/60":"text-gray-500"),children:["$",Lt.toLocaleString("es-CO")]}):null,At!==0&&Lt>0&&pt>0&&jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`]})]})})():jsx(Gr,{value:ct>0?ct:void 0,isDark:G,locale:f,disabled:true,lens:$,hourlyRate:Ve(k)}):es(k,ea)},ea.id)),C&&jsx("div",{className:"w-12 flex-shrink-0"})]},k.id)}let Q=ue===k.id,De=vt===k.id,Re=De&&wt==="above",Ke=De&&wt==="below",$t=De&&wt==="child";return jsxs(motion.div,{"data-task-id":k.id,"data-listview-row":k.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:ne},className:g("flex items-center border-b transition-colors relative group",G?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",tt===k.id&&(G?"!bg-[#FFD60A]/15":"!bg-yellow-100"),cn&&Un.has(k.id)&&(G?"bg-white/[0.06]":"bg-blue-50/60")),"data-seleccionada":cn&&Un.has(k.id)?"true":void 0,style:{opacity:Q?.4:1,backgroundColor:$t?G?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:$t?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(k),onDoubleClick:()=>a.onTaskDoubleClick?.(k),onContextMenu:ut=>On(ut,k),onMouseEnter:()=>Ft(k.id),onMouseLeave:()=>Ft(ut=>ut===k.id?null:ut),children:[Re&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),Ke&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),cn&&oa(k.id),rt&&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:ut=>et(k.id,ut),style:{color:G?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),Qt.map(ut=>{let ct=!!(k.subtasks&&k.subtasks.length>0),Zt=aa(ut),ea=!!Zt&&!ct&&Tt===k.id&&!kt,xt=!!kt&&!!Zt&&cr(kt.column,Zt)&&Ra(k.id);return jsx("div",{className:g("flex items-center px-4",R?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",ut.type!=="name"&&"justify-center"),style:{width:Wn[ut.id],minWidth:ut.minWidth,position:"relative",backgroundColor:xt?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:xt?"inset 0 0 0 1px rgba(0, 229, 204, 0.45)":void 0},children:ut.type==="name"?jsxs("div",{className:"flex items-center gap-2 min-w-0 w-full",children:[h&&k.level>0&&jsx("div",{style:{width:`${k.level*24}px`},className:"flex-shrink-0"}),h&&k.hasChildren&&jsx("button",{onClick:Lt=>{Lt.stopPropagation(),ja(k.id);},className:g("p-0.5 rounded flex-shrink-0",G?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:X?jsx(ChevronDown,{className:g("w-4 h-4",G?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",G?"text-white/60":"text-gray-400")})}),h&&!k.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:g("flex min-w-0 flex-1",R?"flex-row items-center gap-2":"flex-col"),children:[(k.wbsCode||k.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[k.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",G?"text-[#00E5CC]":"text-[#00C4AE]"),children:k.wbsCode}),k.taskCode&&jsx("span",{"data-codigo-tarea":true,className:g(R?"text-[12px] whitespace-nowrap":"text-[10px] font-mono",G?"text-white/40":"text-gray-400"),style:R&&!G?{color:"var(--pj-texto-3, #646B78)"}:void 0,children:k.taskCode})]}),jsxs("span",{className:g("truncate",k.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",k.progress===100?t.completedStyle==="dim"?G?"text-white/45":"text-gray-400":G?"line-through text-white/50":"line-through text-gray-400":k.hasChildren?G?"text-white":"text-gray-900":G?"text-[#D1D5DB]":"text-gray-600"),children:[k.__padre&&jsxs("span",{"data-prefijo-padre":true,className:G?"text-white/35":"text-gray-400",children:[k.__padre," \u203A "]}),k.name]}),k.tags?.[0]&&jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",R&&"flex-shrink-0"),style:{backgroundColor:`${k.tags[0].color}20`,color:k.tags[0].color},children:k.tags[0].name})]})]}):ea&&Zt?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[es(k,ut),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:Lt=>xr(Lt,k.id,Zt,_),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):es(k,ut)},ut.id)}),C&&jsx("div",{className:"w-12 flex-shrink-0"})]},k.__claveFila??k.id)})())),Us($r.length,null)]}),W&&$r.length>0&&(()=>{let{spent:k,allocated:_,quoted:X}=le,ne=_-k,de=ne<0,We=de?`+${Ps(Math.abs(ne))} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${Ps(ne)} ${f==="es"?"AHORRADO":"SAVED"}`,Q=$==="financial"&&Y>0,De=Ce?.breakdown,Re=!!De&&((De.equipment??0)>0||(De.travel??0)>0),Ke=De?.laborSpent!=null?De.laborSpent:Ce?.spent!=null?Ce.spent:le.dollarSpent,$t=De?.laborAllocated!=null?De.laborAllocated:Ce?.allocated!=null?Ce.allocated:le.dollarAllocated,ut=Ce?.quoted!=null?Ce.quoted:le.dollarQuoted,ct=(xt,Lt)=>{if(Q){let pt=Lt??xt/60*Y;return `$${Math.round(pt).toLocaleString("es-CO")}`}return Ps(xt)},Zt=Q?Math.abs($t-Ke):0,it=Q?`+$${Zt.toLocaleString("es-CO",{minimumFractionDigits:0,maximumFractionDigits:0})} ${de?f==="es"?"EXCEDIDO":"OVER":f==="es"?"AHORRADO":"SAVED"}`:We,ea=Q&&Re?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",G?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:G?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[cn&&jsx("div",{className:"w-6 flex-shrink-0"}),rt&&jsx("div",{className:"w-5 flex-shrink-0"}),Qt.map(xt=>jsx("div",{className:g("flex items-center px-4 py-3",xt.type!=="name"&&"justify-center"),style:{width:Wn[xt.id],minWidth:xt.minWidth},children:xt.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),ea&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",G?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),ea]})]}):xt.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",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ct(k,Q?Ke:void 0)}),jsx("span",{className:g("text-[11px]",G?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",G?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:ct(_,Q?$t:void 0)})]}),_>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",de?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q?it:We})]}):xt.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:X>0?ct(X,Q?ut:void 0):"\u2013"}):xt.type==="effortMinutes"?(()=>{if(Q&&X>0&&_>0){let Lt=Math.round(ut),pt=Math.round($t),At=Lt-pt,Ba=Lt>0?Math.round(At/Lt*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ct(_,$t)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",At>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[At>=0?"+":"",Math.abs(At)>=1e3?`$${(At/1e3).toFixed(1)}K`:`$${At}`,jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Ba,"%)"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:_>0?ct(_,Q?$t:void 0):"\u2013"})})():xt.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",G?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:k>0?ct(k,Q?Ke:void 0):"\u2013"}):xt.type==="progress"?(()=>{let Lt=Z0(uu(e||[]));return jsxs("span",{className:g("text-[12px] font-bold font-mono",G?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Lt,"%"]})})():xt.type==="weight"?(()=>{let Lt=e||[],pt=[],At=ur=>{for(let Ka of ur)pt.push(Ka),Ka.subtasks?.length&&At(Ka.subtasks);};At(Lt);let kr=pt.filter(ur=>!ur.subtasks?.length||ur.subtasks.length===0).reduce((ur,Ka)=>ur+(Ka.weight||0),0),Pr=Math.abs(kr-100)<.1;return jsxs("span",{className:g("text-[12px] font-bold font-mono",Pr?G?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:[Number(kr.toFixed(1)),"%"]})})():jsx("span",{className:g("text-[11px]",G?"text-white/30":"text-gray-300"),children:"\u2013"})},xt.id)),C&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),$r.length===0&&st&&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",G?"text-white/30":"text-gray-400")}),jsx("p",{className:g(G?"text-white/60":"text-gray-600"),children:we.empty.noResults})]})})]})}),$e?.enabled&&$e.data&&Pe&&jsx(q0,{data:$e.data,isDark:G,locale:f,onClose:()=>je(false),lens:t?.lens,onUnassignedTaskClick:k=>{let _=document.querySelector(`[data-task-id="${k}"]`);_&&(_.scrollIntoView({behavior:"smooth",block:"center"}),ee(k),setTimeout(()=>ee(null),2e3));}})]}),jsx(M0,{state:ke,onClose:Vr,isDark:G,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:Mr,onColumnSort:xa,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),yt&&Ht&&ue&&createPortal(jsx("div",{style:{position:"fixed",left:Ht.x+12,top:Ht.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let _=Me.flattenTasks(e).find(X=>X.id===ue);return _?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:G?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${G?"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:G?"#e6edf3":"#111827"},children:_.name})]}):null})()}),document.body),jsx(z0,{isOpen:I,onClose:()=>j(false),onSave:Bs,isDark:G,locale:f})]})}var af=[{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}],rf=[{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"}],nf=[{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 pu={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"},mu={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"},gu={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"},Kl={dark:pu,light:mu,neutral:gu};function of(e){return Kl[e]||Kl.dark}function ql(e,t,a,r,n=5){let s=[],o=[],i=e.filter(m=>m.endSerial>=a&&m.startSerial<=r).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of i){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,r),b=0;for(;(s[b]||[]).some(([h,y])=>!(v<h||f>y));)b++;(s[b]=s[b]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:b,contL:m.startSerial<a,contR:m.endSerial>r});}let c={};for(let m=a;m<=r;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let l=[],p=[],u={};t.filter(m=>m.serial>=a&&m.serial<=r).forEach(m=>{(u[m.serial]=u[m.serial]||[]).push(m);}),Object.keys(u).forEach(m=>{let f=+m,v=u[f],b=[];for(let h=0;h<n;h++)c[f].has(h)||b.push(h);if(v.length<=b.length)v.forEach((h,y)=>l.push({it:h,day:f,lane:b[y]}));else {let h=Math.max(b.length-1,0);v.slice(0,h).forEach((y,x)=>l.push({it:y,day:f,lane:b[x]})),p.push({day:f,lane:b[h]!=null?b[h]:n-1,count:v.length-h,items:v.slice(h)});}});let d=s.length;return l.forEach(m=>{d=Math.max(d,m.lane+1);}),p.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:l,more:p,laneCount:Math.max(d,1)}}var hC=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],yC=["MON","TUE","WED","THU","FRI","SAT","SUN"];function sf(e){return e==="es"?hC:yC}function lf(e){return (e.getDay()+6)%7}function cf(e,t){let a=new Date(e,t,1),r=lf(a),n=new Date(e,t,1-r),s=[];for(let u=0;u<6;u++)s.push({ws:u*7+1,we:u*7+7});let o=u=>{let d=new Date(n);return d.setDate(n.getDate()+(u-1)),d},i=u=>{let d=u.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=i(a),l=new Date(e,t+1,0),p=i(l);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:i,monthStartSerial:c,monthEndSerial:p}}function wi(e,t){return lf(e.serialToDate(t))>=5}function df(e,t,a,r,n){let s=[],o=[],i=[],c=Math.max(1,n),l=0;for(let p=a;p<=r;p++){let u=e.filter(b=>!b.container&&b.endSerial===p).sort((b,h)=>+!!b.done-+!!h.done||b.name.localeCompare(h.name)),d=t.filter(b=>b.serial===p),m=u.length+d.length;if(m===0)continue;let f=Math.min(m,c),v=0;for(let b of u.slice(0,f))s.push({t:b,s:p,e:p,lane:v++,contL:false,contR:false});for(let b of d.slice(0,Math.max(0,f-Math.min(u.length,f))))o.push({it:b,day:p,lane:v++});if(m>f){let b=d.slice(Math.max(0,f-Math.min(u.length,f)));i.push({day:p,lane:-1,count:m-f,items:b});}l=Math.max(l,v);}return {bars:s,chips:o,more:i,laneCount:Math.max(l,1)}}function xC(e){let t=[],a=(r,n,s)=>{for(let o of r){let i=n||o.id,c=s||o.name;t.push({t:o,phaseId:i,phaseName:c}),o.subtasks?.length&&a(o.subtasks,i,c);}};return a(e,"",""),t}function uf(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function pf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function Yl(e){let{tasks:t,grid:a,projectColor:r,hourlyRate:n,projectId:s}=e,o=xC(t),i=42,c=[];for(let{t:p,phaseId:u,phaseName:d}of o){let m=uf(p.startDate),f=uf(p.endDate);if(!m||!f)continue;let v=a.dateToSerial(m),b=a.dateToSerial(f);if(b<1||v>i)continue;let h=p.effortMinutes??0,y=Math.round(h/60*10)/10,x=p.costAtCompletion,w=x!=null?pf(x):pf(y*n),C=p.assignees?.[0],P=C?.initials||(C?.name?kC(C.name):void 0),O=p.displayId||p.wbsCode||"",T=wC(O||p.id)?"":O||p.id;c.push({uid:p.id,id:T,name:p.name,projectId:s,color:p.color,startSerial:Math.max(v,1),endSerial:Math.min(b,i),hrs:y,cost:w,critical:!!p.isCriticalPath,who:P,realStart:m,realEnd:f,phaseId:u,phaseName:d,done:p.progress===100||p.status==="completed",overdue:!(p.progress===100||p.status==="completed")&&(()=>{let D=new Date;D.setHours(0,0,0,0);let M=new Date(f);return M.setHours(0,0,0,0),M<D})(),milestone:!!p.isMilestone,container:!!(p.subtasks&&p.subtasks.length>0)});}let l=[];return {calTasks:c,dayItems:l,isEmpty:c.length===0&&l.length===0}}var vC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function wC(e){return vC.test(e)||/^task-\d+/.test(e)}function kC(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 CC=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],TC=["January","February","March","April","May","June","July","August","September","October","November","December"];function mf(e,t,a){return `${(a==="es"?CC:TC)[t]} ${e}`}var fu=26,NC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Xl({locale:e}){let t=sf(e);return jsx("div",{className:"cal-dow",children:t.map((a,r)=>jsx("div",{className:r>=5?"wknd":"",children:a},a))})}function Jl({bar:e,ws:t,money:a,projColor:r,slotH:n=fu,due:s=false,showValues:o=true}){let{t:i}=e,c=e.s-t,l=e.e-e.s+1,p="cal-bar"+(i.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":"")+(s?" due":"")+(s&&i.done?" done":"")+(s&&i.overdue?" overdue":"")+(s&&i.milestone?" hito":""),u=a==="$"?i.cost:`${i.hrs}h`,d=o&&(a==="$"||i.hrs>0),m={"--proj":e.color??i.color??r,left:`calc(${c}/7*100% + 3px)`,width:`calc(${l}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:p,style:m,children:[i.critical&&l>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s&&i.done?jsx("span",{className:"ico","aria-hidden":true,children:"\u2713"}):null,s&&i.overdue?jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 12 12","aria-hidden":true,children:[jsx("circle",{cx:"6",cy:"6",r:"5.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"6",y1:"3.4",x2:"6",y2:"6.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"8.6",r:"0.8",fill:"currentColor"})]}):null,s&&i.milestone?jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 24 24","aria-hidden":true,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]}):null,i.id?jsx("span",{className:"tk",children:i.id}):null,jsx("span",{className:"nom",children:i.name}),l>=3&&d?jsx("span",{className:"val",children:u}):null,s&&i.overdue?jsx("span",{className:"sr-only",children:"Overdue"}):null]})}function Ql({chip:e,ws:t,slotH:a=fu}){let r=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${r}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*a}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:NC[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Zl({more:e,ws:t,slotH:a=fu,onClick:r,enCabecera:n=false,locale:s="es"}){let o=e.day-t,i=n?{left:`calc(${o+1}/7*100% - 4px)`,top:"-25px",transform:"translateX(-100%)"}:{left:`calc(${o}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxs("div",{className:n?"cal-more en-cabecera":"cal-more",style:i,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>r(e):void 0,children:["+",e.count," ",s==="en"?"more":"m\xE1s"]})}function gf({projects:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-legend",children:[e.map(r=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:r.color}}),r.id?`${r.id} `:"",r.name]},r.id||r.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",a?"Critical path":"Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",a?"Milestone":"Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",a?"Due date":"Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",a?"External event":"Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",a?"Absence":"Ausencia"]})]})}var MC=[{id:"mes",es:"Mes",en:"Month",key:"M"},{id:"semana",es:"Semana",en:"Week",key:"W"},{id:"lookahead",es:"Lookahead",en:"Lookahead",key:"2"},{id:"agenda",es:"Agenda",en:"Agenda",key:"A"}];function bu({view:e,onViewChange:t,money:a,onMoneyChange:r,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:i=false,hiddenViews:c=[]}){let l=o==="en",p=MC.filter(u=>!c.includes(u.id));return i?jsxs(Fragment,{children:[jsx("div",{className:"cal-seg",children:p.map(u=>jsx("button",{type:"button",className:e===u.id?"on":"",onClick:()=>t(u.id),title:`${l?u.en:u.es} (${u.key})`,children:l?u.en:u.es},u.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]}):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:p.map(u=>jsxs("button",{type:"button",className:e===u.id?"on":"",onClick:()=>t(u.id),children:[l?u.en:u.es,jsx("span",{className:"key",children:u.key})]},u.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]})}function ff({monthLabel:e,onPrev:t,onNext:a,onToday:r,layersOpen:n,onToggleLayers:s,layersOff:o,phases:i,phaseFilter:c="all",onPhaseChange:l,locale:p="es",children:u}){let d=o?o.length:0,[m,f]=useState(false),v=useRef(null),b=p==="es";useEffect(()=>{if(!m)return;let y=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[m]);let h=c==="all"?b?"Todas":"All":i?.find(y=>y.id===c)?.name??(b?"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:a,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:r,children:b?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),i&&i.length>0&&l?jsxs("div",{className:"relative",ref:v,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(y=>!y),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:b?"Fase":"Phase"})," ",h," \u25BE"]}),m?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:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{l("all"),f(false);},children:jsx("span",{className:"nm",children:b?"Todas las fases":"All phases"})}),i.map(y=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===y.id?"var(--cyan)":"var(--txt)"},onClick:()=>{l(y.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:y.name})},y.id))]}):null]}):null,u,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",b?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-d,"/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 bf({off:e,onToggle:t}){let a=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:PC.map(r=>{let n=a.includes(r.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(r.id),children:[jsx("span",{className:"sw",style:{background:r.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:r.nm}),jsx("div",{className:"sub",children:r.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},r.id)})})}var IC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},RC={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function yf({dayLabel:e,items:t,tasks:a=[],itemValue:r,onClose:n,style:s,locale:o="es"}){let i=o==="en",c=useRef(null);useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&n();}function m(f){f.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let l=a.length+t.length,u=r||(d=>{switch(d.type){case "hito":return i?"Milestone":"Hito";case "desembolso":return i?"Disb.":"Desemb.";case "deadline":return i?"Due":"Vence";case "aus":return i?"Absence":"Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:c,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} ${i?"items":"elementos"}`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",i?l===1?"item":"items":l===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[a.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:RC[d.type]},children:IC[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:u(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var hf={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 xf({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:r,irAPrimera:n}){let s=hf[a]||hf.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:s.title}),jsxs("p",{children:[s.body,jsx("br",{}),jsx("b",{children:e})]}),n?jsx("button",{type:"button","data-ir-a-primera":true,className:"cal-empty-crear",onClick:n.onClick,children:a==="en"?`Go to the first (${n.mes}) \u2192`:`Ir a la primera (${n.mes}) \u2192`}):null,r?jsx("button",{type:"button",className:"cal-empty-crear",onClick:r,children:s.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:s.upcoming}),t.map((o,i)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(o.type==="deadline"?"rd":"cy"),children:o.type==="deadline"?"\u2691":"\u25C6"}),o.label,jsx("span",{className:"d",children:o.date})]},i))]}):null]})}function wf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function OC(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 vf=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function HC(e){return vf[e%vf.length]}function UC(e){return e>1?"over":e>=.9?"warn":"ok"}var hu="\xA0";function _o(e){let t=Math.round(e*10)/10;return Number.isInteger(t)?String(t):t.toFixed(1)}function kf(e,t,a){let r=new Map,n=new Set;for(let i of t)i.isWeekend||i.isHoliday||n.add(wf(i.date));if(n.size===0)return r;let s=new Map;e.forEach((i,c)=>{s.set(i.userId,{color:HC(c),initials:OC(i.name)});});let o=new Map;for(let i of e)for(let c of i.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let l=o.get(c.date);l.set(i.userId,(l.get(i.userId)??0)+(c.hours||0));}for(let i of n){let c=o.get(i)??new Map,l=e.map(u=>{let d=s.get(u.userId);return {name:u.name,initials:d.initials,color:d.color,hours:Math.round((c.get(u.userId)??0)*100)/100,capacity:a}}),p=l.reduce((u,d)=>u+d.hours,0);r.set(i,{assigned:Math.round(p*100)/100,capacity:a*e.length,perPerson:l});}return r}function Cf({days:e,capByDay:t,selectedKey:a,onSelectDay:r}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=wf(n.date),o=n.isWeekend||n.isHoliday,i=o?void 0:t.get(s),c=!!i&&i.capacity>0,l=c?i.assigned/i.capacity:0,u="cal-cap-cell "+(o?"off":UC(l))+(a===s?" sel":""),d=n.date.toLocaleDateString("es",{weekday:"short",day:"numeric",month:"short"});return jsxs("div",{className:u,role:c&&r?"button":void 0,tabIndex:c&&r?0:void 0,title:o?void 0:d,onClick:m=>{!c||!r||r(s,d,m.currentTarget);},onKeyDown:m=>{!c||!r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r(s,d,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`0h${hu}/${hu}\u2014`}):jsxs(Fragment,{children:[jsxs("b",{children:[_o(i.assigned),"h"]}),jsxs("span",{children:["/",hu,_o(i.capacity),"h"]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(l*100,100)+"%"}}):null})]},n.serial)})})}function Tf({dayLabel:e,perPerson:t,onClose:a,style:r}){let n=useRef(null);useEffect(()=>{let l=u=>{u.key==="Escape"&&a();},p=u=>{n.current&&!n.current.contains(u.target)&&a();};return document.addEventListener("keydown",l),document.addEventListener("mousedown",p),()=>{document.removeEventListener("keydown",l),document.removeEventListener("mousedown",p);}},[a]);let s=t.reduce((l,p)=>l+p.hours,0),o=t.reduce((l,p)=>l+p.capacity,0),i=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...r},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:i?{color:"var(--red)"}:void 0,children:[_o(s),"h asignadas / ",_o(o),"h"]}),i?jsx("div",{className:"rng",children:jsxs("b",{children:["+",_o(c),"h sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(l=>{let p=l.capacity>0&&l.hours>l.capacity,u=l.capacity>0?l.capacity:1;return jsxs("div",{className:p?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:l.color},children:l.initials}),jsx("span",{className:"nm",title:l.name,children:l.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(l.hours/u*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[_o(l.hours),"h / ",_o(l.capacity),"h"]})]},l.name)})})]})}var yu=28,zC=182;function Df({grid:e,weeks:t,tasks:a,items:r,money:n,projColor:s,todaySerial:o,locale:i,capRows:c,teamSize:l,onTaskOpen:p,onMore:u,onCapDay:d}){let m=i==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,v)=>jsxs("div",{style:{display:"contents"},children:[jsx(GC,{grid:e,ws:f.ws,we:f.we,tasks:a,items:r,money:n,projColor:s,todaySerial:o,onTaskOpen:p,onMore:u}),c&&c[v]?jsx(Cf,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:d}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",l!=null?` \xB7 ${l} ${m?l===1?"persona":"personas":l===1?"person":"people"}`:""]}),jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function GC({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,onTaskOpen:c,onMore:l}){let p=useMemo(()=>ql(r,n,t,a),[r,n,t,a]),u=useMemo(()=>new Set(n.filter(f=>f.type==="deadline").map(f=>f.serial)),[n]),d=[];for(let f=t;f<=a;f++)d.push(f);let m={height:`${zC}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:m,children:[jsx("div",{className:"cal-week-bg",children:d.map(f=>{let v=e.serialToDate(f),b=f>=e.monthStartSerial&&f<=e.monthEndSerial,h="cal-day";return wi(e,f)&&(h+=" wknd"),b||(h+=" out"),f===i&&(h+=" today"),u.has(f)&&(h+=" deadline-day"),jsx("div",{className:h,children:jsx("span",{className:"cal-day-num",children:v.getDate()})},f)})}),jsxs("div",{className:"cal-items",children:[p.bars.map((f,v)=>jsx("div",{onClick:()=>c?.(f.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(Jl,{bar:f,ws:t,money:s,projColor:o,slotH:yu})},`b${v}`)),p.chips.map((f,v)=>jsx(Ql,{chip:f,ws:t,slotH:yu},`c${v}`)),p.more.map((f,v)=>jsx(Zl,{more:f,ws:t,slotH:yu,onClick:()=>l(f.day,f.items,r.filter(b=>b.startSerial<=f.day&&b.endSerial>=f.day))},`m${v}`))]})]})}var VC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function jC(e){return VC.test(e)||/^task-\d+/.test(e)}function _C(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 Sf(e){return e>=1e3?`$${(e/1e3).toFixed(1).replace(/\.0$/,"")}k`:`$${Math.round(e)}`}function KC(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Ef(e,t){let a=KC(e),r=[];for(let n of a){if(n.startDate&&n.endDate)continue;let s=n.effortMinutes??0,o=Math.round(s/60*10)/10,i=n.costAtCompletion,c=i!=null?Sf(i):Sf(o*t),l=n.assignees?.[0],p=l?.initials||(l?.name?_C(l.name):void 0),u=n.displayId||n.wbsCode||"",d=jC(u||n.id)?"":u||n.id;r.push({taskId:n.id,id:d,name:n.name,hrs:o,cost:c,who:p,projColor:n.color});}return r}function Mf({items:e,onItemClick:t,onCollapse:a,money:r,projColor:n,locale:s="es"}){let o=s==="en";return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsxs("span",{className:"t",children:["\u26A1 Backlog \xB7 ",o?"No date":"Sin fecha"]}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:a,title:o?"Collapse panel":"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:o?"Drag onto the calendar":"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(i=>{let c=r==="$"?i.cost:`${i.hrs}h`;return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(i.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i.taskId));},children:[jsxs("div",{className:"row1",children:[i.id?jsx("span",{className:"tk",children:i.id}):null,jsx("span",{className:"pdot",style:{background:i.projColor||n}})]}),jsx("div",{className:"nom",children:i.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsxs("b",{children:[i.hrs,"h"]})," est"]}),jsx("span",{children:c}),i.who?jsx("span",{className:"cal-ava",children:i.who}):null]})]},i.taskId)})]})}function Pf({onExpand:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),e());},title:a?"Expand backlog":"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",a?"Status":"Estado"]})]})}function As(e,t){return e.toLocaleDateString(t==="es"?"es-CO":"en-US",{day:"numeric",month:"short"})}function Ff({taskName:e,taskId:t,sim:a,busy:r,locale:n,onConfirm:s,onCancel:o,style:i}){let c=useRef(null),l=n==="es";useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let p=a.wasCritical,u=a.projectEndDeltaDays,d=u>0?`+${u} ${l?u===1?"d\xEDa":"d\xEDas":u===1?"day":"days"} \xB7 ${As(a.oldProjectEnd,n)} \u2192 ${As(a.newProjectEnd,n)}`:`+0 ${l?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${l?"holgura":"slack"} ${a.slackDays}d`:""}`,m=u>0?l?`Confirmar +${u} ${u===1?"d\xEDa":"d\xEDas"}`:`Confirm +${u} ${u===1?"day":"days"}`:l?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...i},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:l?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[As(a.oldStart,n)," \u2013 ",As(a.oldEnd,n)," \u2192 ",jsxs("b",{children:[As(a.newStart,n)," \u2013 ",As(a.newEnd,n)]})]})]}),p?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",l?"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:l?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:a.movedSuccessors.length===0?l?"Ninguna":"None":`${a.movedSuccessors.length}${a.movedSuccessors.length<=2?" \xB7 "+a.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Fin de proyecto":"Project end"}),jsx("span",{className:u>0?"v bad":"v good",children:d})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:a.stillCritical?l?"Sigue en CPM":"Stays critical":a.wasCritical?l?"Sale de CPM":"Leaves critical":l?`No entra \xB7 holgura ${a.slackDays}d`:`Not critical \xB7 slack ${a.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:r,children:l?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:p||u>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:r,children:r?l?"Guardando\u2026":"Saving\u2026":m})]})]})}var JC={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Lf({grid:e,tasks:t,items:a,money:r,projColor:n,todaySerial:s,locale:o,onTaskOpen:i}){let c=o==="es",l=useMemo(()=>{let u=new Map,d=m=>(u.has(m)||u.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),u.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of a)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...u.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,a,e]);if(l.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:c?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let p=u=>u.toLocaleDateString(c?"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:l.map(u=>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:u.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[p(u.date),u.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),u.tasks.map(d=>jsxs("button",{type:"button",onClick:()=>i?.(d.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:d.color??n,flex:"none"}}),d.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,d.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:d.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:r==="$"?d.cost:`${d.hrs}h`})]},d.uid)),u.items.map((d,m)=>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:JC[d.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},u.serial))})}function QC(e){let t=[],a=r=>r.forEach(n=>{t.push(n),n.subtasks?.length&&a(n.subtasks);});return a(e),t}function ec(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function xu(e){let t=e.startDate?new Date(e.startDate):null,a=e.endDate?new Date(e.endDate):null;return !t||!a?1:Math.max(1,Math.round((a.getTime()-t.getTime())/864e5))}function Af(e,t){let a=new Map(e.map(l=>[l.id,l])),r=new Map;for(let l of e)for(let p of ec(l))r.has(p)||r.set(p,[]),r.get(p).push(l.id);let n=new Map,s=new Map,o=new Set,i=l=>{if(s.has(l))return s.get(l);if(o.has(l))return s.get(l)??0;o.add(l);let p=a.get(l);if(!p)return o.delete(l),0;let u=ec(p).filter(f=>a.has(f)),d=t.has(l)?t.get(l):p.startDate?new Date(p.startDate).getTime():0;for(let f of u){let v=i(f);v>d&&(d=v);}let m=xu(p)*864e5;return n.set(l,d),s.set(l,d+m),o.delete(l),s.get(l)};for(let l of e)i(l.id);let c=0;return s.forEach(l=>{l>c&&(c=l);}),{finish:s,start:n,projectEnd:c}}function If(e,t,a){let r=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let l of ec(c))n.has(l)||n.set(l,[]),n.get(l).push(c.id);let s=new Map,o=[...e].sort((c,l)=>(t.get(l.id)??0)-(t.get(c.id)??0));for(let c of o){let l=n.get(c.id)??[];if(l.length===0)s.set(c.id,a);else {let p=1/0;for(let u of l){let d=s.get(u),m=r.get(u);d!=null&&m&&(p=Math.min(p,d-xu(m)*864e5));}s.set(c.id,p===1/0?a:p);}}let i=new Set;for(let c of e){let l=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(l)<864e5/2&&ec(c).length+(n.get(c.id)?.length??0)>0&&i.add(c.id);}return i}function tc(e,t,a,r){let n=QC(e),s=n.find(h=>h.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),i=new Date(s.endDate),c=Af(n,new Map),l=If(n,c.finish,c.projectEnd),p=n.map(h=>h.id===t?{...h,startDate:a,endDate:r}:h),u=Af(p,new Map([[t,a.getTime()]])),d=If(p,u.finish,u.projectEnd),m=new Map(p.map(h=>[h.id,h])),f=[];for(let h of n){if(h.id===t)continue;let y=c.start.get(h.id),x=u.start.get(h.id);if(y!=null&&x!=null&&Math.abs(x-y)>=864e5/2){let w=xu(m.get(h.id))*864e5;f.push({id:h.id,name:h.name,newStart:new Date(x),newEnd:new Date(x+w)});}}let v=Math.round((u.projectEnd-c.projectEnd)/864e5),b=l.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:i,newStart:a,newEnd:r,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(u.projectEnd),wasCritical:l.has(t),stillCritical:d.has(t),slackDays:b}}function Bf(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var Of=132,ac=26,wu=20,e2="#5B7FD4";function Hf({tasks:e,projectName:t,projectId:a,projectColor:r,locale:n,themeMode:s,hourlyRate:o,money:i,onMoneyChange:c,onTaskOpen:l,toolbarContainer:p,hiddenViews:u,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:b,members:h=[],holidayDates:y=[],timesheetSettings:x,onVisibleRangeChange:w,monthMode:C="span",showValues:P=true,openOnToday:O=false}){let T=useRef(null),[D,M]=useState(0);useEffect(()=>{if(C!=="due")return;let he=T.current;if(!he||typeof ResizeObserver>"u")return;let Fe=new ResizeObserver(()=>M(he.clientHeight));return Fe.observe(he),M(he.clientHeight),()=>Fe.disconnect()});let[N,z]=useState("mes"),[$,Y]=useState(()=>{let he=new Date,Fe={y:he.getFullYear(),m:he.getMonth()};if(O)return Fe;let Qe=(e??[]).map(Ft=>Ft.startDate?new Date(Ft.startDate):null).filter(Ft=>!!Ft&&!isNaN(Ft.getTime()));if(Qe.length===0||(e??[]).some(Ft=>{let kt=Ft.startDate?new Date(Ft.startDate):null,Da=Ft.endDate?new Date(Ft.endDate):kt;if(!kt||isNaN(kt.getTime()))return false;let aa=new Date(Fe.y,Fe.m,1),cr=new Date(Fe.y,Fe.m+1,0,23,59,59);return kt<=cr&&(Da??kt)>=aa}))return Fe;let Tt=Qe.reduce((Ft,kt)=>Ft<kt?Ft:kt);return {y:Tt.getFullYear(),m:Tt.getMonth()}}),[A,Se]=useState(false),[W,Ce]=useState([]),[R,we]=useState("all"),[G,Ve]=useState(null),[oe,Be]=useState(null),[le,He]=useState(false),[$e,Pe]=useState(null),[je,tt]=useState(false),ee=useMemo(()=>cf($.y,$.m),[$.y,$.m]),Ae=r||e2,ot=useMemo(()=>{let he=new Set;for(let Fe of y){let Qe=new Date(`${Fe}T12:00:00`),rt=ee.dateToSerial(Qe);rt>=1&&rt<=42&&he.add(rt);}return he},[y,ee]);useEffect(()=>{w?.({start:Bf(ee.serialToDate(1)),end:Bf(ee.serialToDate(42))});},[$.y,$.m]);let Ie=h.length,zt=useMemo(()=>{let he=x?.hoursPerDay;if(!he)return 8;let Fe=[he.monday,he.tuesday,he.wednesday,he.thursday,he.friday].map(Qe=>Qe||0).filter(Qe=>Qe>0);return Fe.length?Math.round(Fe.reduce((Qe,rt)=>Qe+rt,0)/Fe.length*10)/10:8},[x]),st=useMemo(()=>Yl({tasks:e,grid:ee,projectColor:()=>Ae,hourlyRate:o,projectId:a}),[e,ee,Ae,o,a]),bt=useMemo(()=>{if(d===false)return [];let he=new Map;for(let Fe of st.calTasks)Fe.phaseId&&Fe.phaseName&&he.set(Fe.phaseId,Fe.phaseName);return [...he.entries()].map(([Fe,Qe])=>({id:Fe,name:Qe})).sort((Fe,Qe)=>Fe.name.localeCompare(Qe.name))},[st.calTasks,d]),Ee=!W.includes("tareas"),Dt=!W.includes("cpm"),ht=useMemo(()=>{let he=Ee?st.calTasks:[];return R!=="all"&&(he=he.filter(Fe=>Fe.phaseId===R)),Dt||(he=he.map(Fe=>Fe.critical?{...Fe,critical:false}:Fe)),he},[st.calTasks,Ee,Dt,R]),_e=useMemo(()=>{let he=new Set;return W.includes("hitos")&&(he.add("hito"),he.add("desembolso")),W.includes("ext")&&he.add("ext"),W.includes("aus")&&he.add("aus"),st.dayItems.filter(Fe=>!he.has(Fe.type))},[st.dayItems,W]),dt=!W.includes("festivos"),L=new Date,J=ee.dateToSerial(new Date(L.getFullYear(),L.getMonth(),L.getDate())),xe=he=>Ce(Fe=>Fe.includes(he)?Fe.filter(Qe=>Qe!==he):[...Fe,he]),I=()=>Y(he=>{let Fe=new Date(he.y,he.m-1,1);return {y:Fe.getFullYear(),m:Fe.getMonth()}}),j=()=>Y(he=>{let Fe=new Date(he.y,he.m+1,1);return {y:Fe.getFullYear(),m:Fe.getMonth()}}),ke=()=>{let he=new Date;Y({y:he.getFullYear(),m:he.getMonth()});},Ue=useMemo(()=>{let he=(e??[]).flatMap(Fe=>[Fe.startDate,Fe.endDate]).map(Fe=>Fe?new Date(Fe):null).filter(Fe=>!!Fe&&!isNaN(Fe.getTime()));return he.length?he.reduce((Fe,Qe)=>Fe<Qe?Fe:Qe):null},[e]),ue=(he,Fe,Qe)=>{if(!v||Fe===0)return;let rt=st.calTasks.find(aa=>aa.uid===he);if(!rt)return;let Tt=Fe*864e5,Ft=new Date(rt.realStart.getTime()+Tt),kt=new Date(rt.realEnd.getTime()+Tt),Da=tc(e,he,Ft,kt);Da&&Pe({uid:he,taskId:rt.id,taskName:rt.name,sim:Da,anchor:Qe});},at=async()=>{if(!$e||!b)return;tt(true);let he=[{id:$e.uid,startDate:$e.sim.newStart,endDate:$e.sim.newEnd},...$e.sim.movedSuccessors.map(Qe=>({id:Qe.id,startDate:Qe.newStart,endDate:Qe.newEnd}))],Fe=await b(he);tt(false),Fe&&Pe(null);},yt=mf($.y,$.m,n),Ye=[{id:"",name:t,color:Ae}],vt=useMemo(()=>Ef(e,o),[e,o]),Xt=useMemo(()=>{if(N==="lookahead"){let he=ee.weeks.find(Qe=>J>=Qe.ws&&J<=Qe.we)??ee.weeks[0],Fe=ee.weeks.indexOf(he);return ee.weeks.slice(Fe,Fe+2)}return N==="semana"?[ee.weeks.find(Fe=>J>=Fe.ws&&J<=Fe.we)??ee.weeks[0]]:[]},[N,ee.weeks,J]),wt=useMemo(()=>{let he={};return Xt.forEach((Fe,Qe)=>{let rt=[];for(let Ft=Fe.ws;Ft<=Fe.we;Ft++)rt.push({serial:Ft,date:ee.serialToDate(Ft),isWeekend:wi(ee,Ft),isHoliday:ot.has(Ft)});let Tt=kf(h,rt,zt);he[Qe]={days:rt,capByDay:Tt};}),he},[Xt,ee,ot,h,zt]),Ut=N==="semana"||N==="lookahead",Ht=N==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[p?createPortal(jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsx(bu,{enCabecera:true,hiddenViews:u,view:N,onViewChange:z,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:he=>c(he==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),p):jsx(bu,{view:N,onViewChange:z,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:he=>c(he==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:u}),jsx(ff,{monthLabel:yt,onPrev:I,onNext:j,onToday:ke,layersOpen:A,onToggleLayers:()=>Se(he=>!he),layersOff:W,phases:bt,phaseFilter:R,onPhaseChange:we,locale:n,children:A?jsx(bf,{off:W,onToggle:xe}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:Ht?"hidden":void 0},children:[Ht?jsx(Lf,{grid:ee,tasks:ht,items:_e,money:i,projColor:Ae,todaySerial:J,locale:n,onTaskOpen:l}):Ut?jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx(Df,{grid:ee,weeks:Xt,tasks:ht,items:_e,money:i,projColor:Ae,todaySerial:J,locale:n,capRows:wt,teamSize:Ie,onTaskOpen:l,onMore:(he,Fe,Qe)=>Ve({day:he,items:Fe,tasks:Qe}),onCapDay:(he,Fe,Qe)=>{for(let rt of Object.keys(wt)){let Tt=wt[+rt].capByDay.get(he);if(Tt){Be({dayLabel:Fe,perPerson:Tt.perPerson,anchor:Qe.getBoundingClientRect()});break}}}})]}):st.isEmpty?jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx("div",{className:"cal-weeks",children:ee.weeks.map(he=>jsx("div",{className:"cal-week",style:{minHeight:C==="due"?0:`${Of}px`},children:jsx(Uf,{grid:ee,ws:he.ws,we:he.we,todaySerial:J,showFestivos:dt,holidaySerials:ot,locale:n,deadlineDays:new Set})},he.ws))}),jsx(xf,{monthLabel:yt,locale:n,onCreateTask:f,irAPrimera:Ue?{mes:Ue.toLocaleDateString(n==="en"?"en":"es",{month:"long",year:Ue.getFullYear()!==new Date().getFullYear()?"numeric":void 0}),onClick:()=>Y({y:Ue.getFullYear(),m:Ue.getMonth()})}:void 0})]}):jsxs(Fragment,{children:[jsx(Xl,{locale:n}),jsx("div",{className:"cal-weeks",ref:T,style:C==="due"?{minHeight:0,overflow:"hidden"}:void 0,children:ee.weeks.map(he=>jsx(t2,{due:C==="due",slots:D>0?Math.max(1,Math.floor((D/ee.weeks.length-26)/wu)):2,showValues:P,grid:ee,ws:he.ws,we:he.we,tasks:ht,items:_e,money:i,projColor:Ae,todaySerial:J,showFestivos:dt,holidaySerials:ot,locale:n,onTaskOpen:l,onMore:(Fe,Qe,rt)=>Ve({day:Fe,items:Qe,tasks:rt}),canReschedule:v,onDragReschedule:ue,pendingGhost:$e?{uid:$e.uid,days:Math.round(($e.sim.newStart.getTime()-$e.sim.oldStart.getTime())/864e5)}:null},he.ws))})]}),G?jsx(yf,{dayLabel:`${ee.serialToDate(G.day).getDate()}`,items:G.items,tasks:G.tasks.map(he=>({swatch:Ae,taskId:he.id,label:he.name,critical:he.critical,value:i==="$"?he.cost:`${he.hrs}h`})),onClose:()=>Ve(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,oe?jsx(Tf,{dayLabel:oe.dayLabel,perPerson:oe.perPerson,onClose:()=>Be(null),style:{position:"fixed",top:`${oe.anchor.top-8}px`,left:`${oe.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,$e?jsx(Ff,{taskName:$e.taskName,taskId:$e.sim.taskId,sim:$e.sim,busy:je,locale:n,onConfirm:at,onCancel:()=>Pe(null),style:{position:"fixed",top:`${$e.anchor.top+12}px`,left:`${Math.min($e.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),le?jsx(Mf,{items:vt,money:i,projColor:Ae,onItemClick:he=>l?.(he),onCollapse:()=>He(false),locale:n==="en"?"en":"es"}):jsx(Pf,{onExpand:()=>He(true),locale:n==="en"?"en":"es"})]}),jsx(gf,{projects:Ye,locale:n==="en"?"en":"es"})]})}function Uf({grid:e,ws:t,we:a,todaySerial:r,showFestivos:n,holidaySerials:s,deadlineDays:o}){let i=[];for(let c=t;c<=a;c++)i.push(c);return jsx("div",{className:"cal-week-bg",children:i.map(c=>{let l=e.serialToDate(c),p=c>=e.monthStartSerial&&c<=e.monthEndSerial,u=n&&s.has(c),d="cal-day";return wi(e,c)&&(d+=" wknd"),u&&(d+=" festivo"),p||(d+=" out"),c===r&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxs("div",{className:d,children:[jsx("span",{className:"cal-day-num",children:l.getDate()}),u?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function t2({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,showFestivos:c,holidaySerials:l,locale:p,onTaskOpen:u,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v,due:b=false,slots:h=2,showValues:y=true}){let x=useMemo(()=>b?df(r,n,t,a,h):ql(r,n,t,a),[r,n,t,a,b,h]),w=useMemo(()=>new Set(n.filter(M=>M.type==="deadline").map(M=>M.serial)),[n]),C=b?0:Math.max(Of,x.laneCount*ac+36),P=useRef(null),[O,T]=useState(null),D=(M,N)=>{if(!m||!f){u?.(N);return}M.preventDefault();let z=P.current;if(!z)return;let $=z.getBoundingClientRect().width/7,Y=M.clientX,A=0,Se=Ce=>{let R=Math.round((Ce.clientX-Y)/$);A=R,T({id:N,days:R});},W=Ce=>{if(window.removeEventListener("pointermove",Se),window.removeEventListener("pointerup",W),T(null),A===0){u?.(N);return}let R=new DOMRect(Ce.clientX,Ce.clientY,0,0);f(N,A,R);};window.addEventListener("pointermove",Se),window.addEventListener("pointerup",W);};return jsxs("div",{ref:P,className:"cal-week",style:{minHeight:`${C}px`},children:[jsx(Uf,{grid:e,ws:t,we:a,todaySerial:i,showFestivos:c,holidaySerials:l,locale:p,deadlineDays:w}),jsxs("div",{className:"cal-items",children:[x.bars.map((M,N)=>{let z=O?.id===M.t.uid?O.days:null,$=v?.uid===M.t.uid?v.days:null,Y=z??$??0,A=z==null&&$!=null,Se=Y!==0?{...M,s:M.s+Y,e:M.e+Y}:M;return jsx("div",{onPointerDown:W=>D(W,M.t.uid),style:{cursor:m?"grab":u?"pointer":"default",display:"contents",opacity:A?.6:1},children:jsx(Jl,{bar:Se,ws:t,money:s,projColor:o,slotH:b?wu:ac,due:b,showValues:y})},`b${N}`)}),x.chips.map((M,N)=>jsx(Ql,{chip:M,ws:t,slotH:ac},`c${N}`)),x.more.map((M,N)=>jsx(Zl,{more:M,ws:t,slotH:b?wu:ac,enCabecera:b,locale:p,onClick:()=>d(M.day,M.items,b?r.filter(z=>!z.container&&z.endSerial===M.day):r.filter(z=>z.startSerial<=M.day&&z.endSerial>=M.day))},`m${N}`))]})]})}function r2({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:i}){let[c,l]=useState(false),p=useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),u=useMemo(()=>{let m=p.length,f=new Set(p.flatMap(h=>h.assignedUserIds||[])).size,v=p.map(h=>h.priority).filter(Boolean),b=new Set(p.flatMap(h=>h.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:b}},[p]),d=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:d,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:u.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"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:m=>{m.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:[u.uniqueAssignees," assignees"]})]}),u.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:[u.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:p.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:p.map(m=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(m),children:a(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(m),children:[jsx("h4",{children:m.title}),m.description&&jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.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"})]})})]},m.id))})})]})}var zf={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function Ci(e){switch(e.type){case "created":return "Created card";case "status_changed":return `Changed status from "${e.changes.status?.from}" to "${e.changes.status?.to}"`;case "assignee_changed":return "Changed assignee";case "priority_changed":return `Changed priority from ${e.changes.priority?.from} to ${e.changes.priority?.to}`;case "moved":return `Moved from ${e.metadata?.fromColumn||"unknown"} to ${e.metadata?.toColumn||"unknown"}`;case "title_updated":return "Updated title";case "description_updated":return "Updated description";case "dates_changed":return "Changed dates";case "labels_changed":return "Updated labels";case "dependency_added":return "Added dependency";case "dependency_removed":return "Removed dependency";case "comment_added":return "Added comment";case "archived":return "Archived card";case "restored":return "Restored card";default:return "Updated card"}}function Ti(e){return {created:"\u2728",status_changed:"\u{1F504}",assignee_changed:"\u{1F464}",priority_changed:"\u{1F3AF}",moved:"\u27A1\uFE0F",title_updated:"\u270F\uFE0F",description_updated:"\u{1F4DD}",dates_changed:"\u{1F4C5}",labels_changed:"\u{1F3F7}\uFE0F",dependency_added:"\u{1F517}",dependency_removed:"\u26D3\uFE0F\u200D\u{1F4A5}",comment_added:"\u{1F4AC}",archived:"\u{1F4E6}",restored:"\u267B\uFE0F"}[e]||"\u{1F4CC}"}function Gf(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 Vf({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:i}){let c=useMemo(()=>({...zf,...o}),[o]),[l,p]=useState(new Set),u=useRef(null),d=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let y=new Map;return e.forEach(x=>{let w=x.timestamp.toISOString().split("T")[0],C=y.get(w);C?C.push(x):y.set(w,[x]);}),Array.from(y.entries()).sort((x,w)=>w[0].localeCompare(x[0])).map(([x,w])=>({date:new Date(x),events:w.sort((C,P)=>P.timestamp.getTime()-C.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=useMemo(()=>{let y=new Set,x=new Set;return e.forEach(w=>{y.add(w.userId),x.add(w.type);}),{uniqueUsers:Array.from(y),uniqueTypes:Array.from(x)}},[e]),v=y=>{p(x=>{let w=new Set(x);return w.has(y)?w.delete(y):w.add(y),w});},b=y=>{let w=new Date().getTime()-y.getTime(),C=Math.floor(w/6e4),P=Math.floor(w/36e5),O=Math.floor(w/864e5);return C<1?"just now":C<60?`${C}m ago`:P<24?`${P}h ago`:O<7?`${O}d ago`:y.toLocaleDateString()},h=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&&u.current){let y=u.current.querySelector(`[data-event-id="${s}"]`);y&&y.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",i),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",c.compact&&"compact",i),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 x=y.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(y=>jsxs("option",{value:y,children:[Ti(y)," ",y.replace("_"," ")]},y))]}),m.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:y=>{let x=y.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),m.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=>a({...t,searchTerm:y.target.value})})]}),h>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",h,")"]})]}),jsx("div",{className:"history-timeline-container",ref:u,children:d.map(y=>jsxs("div",{className:"history-timeline-group",children:[c.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((x,w)=>{let C=l.has(x.id),P=s===x.id,O=Gf(x.type);return jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",C&&"expanded",P&&"selected"),onClick:()=>n?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:O},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:Ti(x.type)})}),w<y.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:O}})]}),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:[c.showAvatars&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:Ci(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?b(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:T=>{T.stopPropagation(),v(x.id);},children:[C?"\u25BC":"\u25B6"," Show changes"]}),C&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([T,D])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[T,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(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)})]})]},T)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([T,D])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[T,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(D)})]},T))]})]})]})]},x.id)})})]},y.date?.toISOString()||"all"))})]})}function _f({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:i,onSpeedChange:c,className:l}){let p=[.5,1,1.5,2,3],u=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("history-replay-empty",l),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",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:u&&Ti(u.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:u&&Ci(u)}),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:u&&u.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:m=>i(parseInt(m.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>i(f),title:Ci(m)},m.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:p.map(m=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:u&&u.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(m=>jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function ku(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 Cu(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 qf(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function c2(e,t,a,r,n,s=100){let o=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;o.forEach(p=>{let u=a/2,d=r/2;p.vx+=(u-p.x)*n.centerForce*l,p.vy+=(d-p.y)*n.centerForce*l,o.forEach(m=>{if(p.id===m.id)return;let f=p.x-m.x,v=p.y-m.y,b=Math.sqrt(f*f+v*v)||1,h=n.chargeStrength*l/(b*b);p.vx+=f/b*h,p.vy+=v/b*h;});}),t.forEach(p=>{let u=i.get(typeof p.source=="string"?p.source:p.source.id),d=i.get(typeof p.target=="string"?p.target:p.target.id);if(!u||!d)return;let m=d.x-u.x,f=d.y-u.y,v=Math.sqrt(m*m+f*f)||1,b=(v-n.linkDistance)/v*n.forceStrength*l;u.vx+=m*b,u.vy+=f*b,d.vx-=m*b,d.vy-=f*b;}),o.forEach(p=>{p.fx!==null&&p.fx!==void 0?(p.x=p.fx,p.vx=0):p.x+=p.vx,p.fy!==null&&p.fy!==void 0?(p.y=p.fy,p.vy=0):p.y+=p.vy,p.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,p.x)),p.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,p.y)),p.vx*=.9,p.vy*=.9;});}return o}function Yf({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:i,className:c}){let l=useRef(null),[p,u]=useState([]),[d,m]=useState(null),[f,v]=useState(null),[b,h]=useState(null),[y,x]=useState(1),[w,C]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let $=c2(e,t,a.width,a.height,a,150);u($);},[e,t,a]);let P=useCallback(($,Y)=>{a.enableDragging&&(Y.stopPropagation(),m($));},[a.enableDragging]),O=useCallback($=>{if(!d||!l.current)return;let A=l.current.getBoundingClientRect(),Se=($.clientX-A.left-w.x)/y,W=($.clientY-A.top-w.y)/y;u(Ce=>Ce.map(R=>R.id===d?{...R,x:Se,y:W,fx:Se,fy:W}:R));},[d,y,w]),T=useCallback(()=>{m(null);},[]),D=useCallback(($,Y)=>{Y.stopPropagation(),i?.({type:"node-click",node:$,position:{x:Y.clientX,y:Y.clientY}});},[i]),M=useCallback(($,Y)=>{Y.stopPropagation(),i?.({type:"edge-click",edge:$,position:{x:Y.clientX,y:Y.clientY}});},[i]),N=useCallback($=>{let Y=p.find(A=>A.id===$);return Y?{x:Y.x,y:Y.y}:{x:0,y:0}},[p]),z=useCallback($=>{if($.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return $.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let Y=$.card.priority;return Y==="URGENT"?"#ef4444":Y==="HIGH"?"#f59e0b":Y==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return $.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",c),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",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.min($+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(y*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x($=>Math.max($-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),C({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map($=>$.type))).map($=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:ku($)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[Kf($)," ",Cu($)]})]},$))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:O,onMouseUp:T,onMouseLeave:T,children:[jsxs("g",{transform:`translate(${w.x}, ${w.y}) scale(${y})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map($=>{let Y=N(typeof $.source=="string"?$.source:$.source.id),A=N(typeof $.target=="string"?$.target:$.target.id),Se=qf($.type),W=b===$.id,Ce=$.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",W&&"hovered",Ce&&"critical"),onMouseEnter:()=>h($.id),onMouseLeave:()=>h(null),onClick:R=>M($,R),children:[jsx("line",{x1:Y.x,y1:Y.y,x2:A.x,y2:A.y,stroke:ku($.type),strokeWidth:Ce?a.edgeWidth*2:a.edgeWidth,strokeOpacity:W?1:.6,markerEnd:Se?"url(#arrowhead)":void 0}),a.showEdgeLabels&&W&&jsx("text",{x:(Y.x+A.x)/2,y:(Y.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:Cu($.type)})]},$.id)})}),jsx("g",{className:"relationships-graph-nodes",children:p.map($=>{let Y=f===$.id,A=$.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",Y&&"hovered",A&&"critical"),transform:`translate(${$.x}, ${$.y})`,onMouseDown:Se=>P($.id,Se),onMouseEnter:()=>v($.id),onMouseLeave:()=>v(null),onClick:Se=>D($,Se),children:[jsx("circle",{r:A?a.nodeSize*1.2:a.nodeSize,fill:z($),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:Y?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:$.card.title.length>20?$.card.title.substring(0,20)+"...":$.card.title})]},$.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 Qf({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[i,c]=useState(false),[l,p]=useState(null),[u,d]=useState(null),m=useRef(null),f=i||n;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let y=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[e,f]);let v=()=>{f||(o(""),p(null),d(null),t());},b=async()=>{if(!(!s.trim()||f)){c(true),p(null),d(null);try{let y=await r(s.trim());d(y);}catch(y){p(y instanceof Error?y.message:"Failed to generate plan");}finally{c(false);}}},h=()=>{u&&(a(u),v());};return e?jsxs(ga,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),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:v,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:u?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!"})]}),u.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:u.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",u.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:u.columns.map((y,x)=>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},x))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",u.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[u.cards.slice(0,10).map((y,x)=>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})]})},x)),u.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",u.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:m,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."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),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,x)=>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},x))})]})]})}),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:v,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"}),u?jsx("button",{onClick:h,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:b,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 Tu={"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 u2={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},p2={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 m2(e,t,a){let r=Tu[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function Ni(e){return `$${e.toFixed(4)}`}var Nu=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=m2(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(u=>u.timestamp>=t.start&&u.timestamp<=t.end));let r=a.length,n=a.reduce((u,d)=>u+d.cost,0),s=a.reduce((u,d)=>u+d.inputTokens,0),o=a.reduce((u,d)=>u+d.outputTokens,0),i=a.filter(u=>u.success),c=a.reduce((u,d)=>u+d.duration,0),l={},p={};return a.forEach(u=>{l[u.feature]=(l[u.feature]||0)+1,p[u.feature]=(p[u.feature]||0)+u.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:l,costsByFeature:p,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let i=this.operations.filter(p=>p.timestamp>=o).length,c=Math.max(0,n-i),l=i/n*100;return {used:i,limit:n,remaining:c,percentUsed:l,isExceeded:i>=n}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},qo=new Nu;function tb({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(qo.getStats()),[s,o]=useState(qo.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(qo.getStats()),o(qo.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=qo.getRecentOperations(5);return jsxs(ga,{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:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:Ni(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let p=r.costsByFeature[c]||0,u=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ni(p)})]})]}),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:`${u}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.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:i.map(c=>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:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:Ni(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.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 nb({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,i]=useState(""),[c,l]=useState(""),[p,u]=useState(""),[d,m]=useState(false),[f,v]=useState(null),[b,h]=useState(null),[y,x]=useState(null),w=useRef(null),C=d||n;useEffect(()=>{e&&w.current&&w.current.focus();},[e]),useEffect(()=>{let M=N=>{N.key==="Escape"&&!C&&P();};if(e)return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,C]);let P=()=>{C||(i(""),l(""),u(""),v(null),h(null),x(null),t());},O=async()=>{if(!(!o.trim()||C)){m(true),v(null),h(null),x(null);try{let M=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:p||void 0});h(M.tasks.tasks),x({from_cache:M.from_cache,tokens_used:M.tokens_used,mock_mode:M.mock_mode,similarity:M.similarity,tokens_saved:M.tokens_saved});}catch(M){v(M instanceof Error?M.message:"Failed to generate tasks");}finally{m(false);}}},T=()=>{b&&(a(b),P());};if(!e)return null;let D=y?.similarity?((y.similarity||0)*100).toFixed(0):"0";return jsxs(ga,{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:M=>M.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[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:b?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:[b.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((M,N)=>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:["#",N+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:M.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"})]}),M.start," \u2192 ",M.end]}),jsxs("span",{children:[M.duration," days"]}),M.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",M.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${M.priority==="high"?"bg-red-500/20 text-red-400":M.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:M.priority})]})},M.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:M=>i(M.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:c,onChange:M=>l(M.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:p,onChange:M=>u(M.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((M,N)=>jsx("button",{onClick:()=>i(M),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:M},N))})]})]})}),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"}),b?jsx("button",{onClick:T,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Tasks to Gantt"}):jsx("button",{onClick:O,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 oc({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(b=>{t&&Hi(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(h,y,x)=>{console.warn(`Retry attempt ${y} after ${x}ms: ${h.message}`);}}).then(h=>{h.success||console.error(`Failed to persist board after ${h.attempts} attempts:`,h.error);});},[t]),s=useCallback(async(b,h,y)=>{r(x=>{let w=x.cards.find(M=>M.id===b);if(!w)return x;let C=w.columnId,P={...w,columnId:h,position:y},O=x.cards.map(M=>M.id===b?P:M),T=x.columns.map(M=>{if(M.id===C)return {...M,cardIds:M.cardIds.filter(N=>N!==b)};if(M.id===h){let N=O.filter(z=>z.columnId===h).sort((z,$)=>z.position-$.position);return {...M,cardIds:N.map(z=>z.id)}}return M}),D={...x,cards:O,columns:T};return n(D),D});},[n]),o=useCallback(async(b,h)=>{r(y=>{let x=y.cards.map(C=>C.id===b?{...C,...h}:C),w={...y,cards:x};return n(w),w});},[n]),i=useCallback(async b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...b,id:h},w=y.columns.map(P=>P.id===b.columnId?{...P,cardIds:[...P.cardIds,h]}:P),C={...y,cards:[...y.cards,x],columns:w};return n(C),C});},[n]),c=useCallback(async b=>{r(h=>{let y=h.cards.find(P=>P.id===b);if(!y)return h;let x=h.cards.filter(P=>P.id!==b),w=h.columns.map(P=>P.id===y.columnId?{...P,cardIds:P.cardIds.filter(O=>O!==b)}:P),C={...h,cards:x,columns:w};return n(C),C});},[n]),l=useCallback(async b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(y=>{let x={...b,id:h,cardIds:[]},w={...y,columns:[...y.columns,x]};return n(w),w});},[n]),p=useCallback(async(b,h)=>{r(y=>{let x=y.columns.map(C=>C.id===b?{...C,...h}:C),w={...y,columns:x};return n(w),w});},[n]),u=useCallback(async b=>{r(h=>{let y=h.cards.filter(C=>C.columnId!==b),x=h.columns.filter(C=>C.id!==b),w={...h,cards:y,columns:x};return n(w),w});},[n]),d=useCallback(b=>{let h=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(b),h},[i]),m=useCallback(b=>{let h=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(b),h},[l]),f=useCallback(()=>{r(b=>{let h={...b,cards:[],columns:[]};return n(h),h});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:p,onColumnDelete:u},setBoard:r,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:u,clearBoard:f}}}function sb({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=oc({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(c,l,p={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(u=>u.columnId===c).length,...p});},addColumn:(c,l)=>{let p=r.columns.length>0?Math.max(...r.columns.map(u=>u.position)):0;s.addColumn({title:c,position:l??p+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var Di={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},lb={by:"none",order:"asc"};function cb({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...Di,...e}),[s,o]=useState({...lb,...t}),i=useCallback(v=>{n(b=>({...b,...v}));},[]),c=useCallback(v=>{o(b=>({...b,...v}));},[]),l=useCallback(()=>{n(Di),o(lb);},[]),p=useCallback(()=>{a&&n({...Di,assignees:[a]});},[a]),u=useCallback(()=>{n({...Di,dateFilter:"overdue"});},[]),d=useCallback(()=>{n({...Di,priorities:["HIGH","URGENT"]});},[]),m=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),f=useCallback(v=>{let b=[...v];if(r.search){let h=r.search.toLowerCase();b=b.filter(y=>y.title.toLowerCase().includes(h)||y.description?.toLowerCase().includes(h));}if(r.dateFilter!=="all"){let h=new Date,y=h.getFullYear(),x=String(h.getMonth()+1).padStart(2,"0"),w=String(h.getDate()).padStart(2,"0"),C=`${y}-${x}-${w}`;b=b.filter(P=>{if(!P.endDate&&!P.dueDate)return false;let O=P.endDate||P.dueDate;if(!O)return false;let T;if(typeof O=="string")T=O.split("T")[0]||O;else {let D=O.getUTCFullYear(),M=String(O.getUTCMonth()+1).padStart(2,"0"),N=String(O.getUTCDate()).padStart(2,"0");T=`${D}-${M}-${N}`;}switch(r.dateFilter){case "overdue":return T<C;case "today":return T===C;case "this-week":let D=new Date(C+"T00:00:00"),M=new Date(T+"T00:00:00"),N=new Date(D);return N.setDate(N.getDate()+7),M>=D&&M<=N;case "custom":if(r.dateRange){let z=typeof O=="string"?new Date(O):O;return z>=r.dateRange.start&&z<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(b=b.filter(h=>h.priority&&r.priorities.includes(h.priority))),r.assignees.length>0&&(b=b.filter(h=>(h.assignedUserIds||(h.assigneeId?[h.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(b=b.filter(h=>h.labels&&h.labels.some(y=>r.labels.includes(y)))),r.columns.length>0&&(b=b.filter(h=>r.columns.includes(h.columnId))),s.by!=="none"&&b.sort((h,y)=>{let x=0;switch(s.by){case "created":let w=h.createdAt?new Date(h.createdAt).getTime():0,C=y.createdAt?new Date(y.createdAt).getTime():0;x=w-C;break;case "priority":let P={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},O=P[h.priority||"LOW"],T=P[y.priority||"LOW"];x=O-T;break;case "dueDate":let D=h.endDate||h.dueDate,M=y.endDate||y.dueDate;if(!D)return 1;if(!M)return -1;let N=typeof D=="string"?new Date(D).getTime():D.getTime(),z=typeof M=="string"?new Date(M).getTime():M.getTime();x=N-z;break;case "title":x=h.title.localeCompare(y.title);break;case "estimate":let $=h.estimatedTime||0,Y=y.estimatedTime||0;x=$-Y;break;default:x=0;}return s.order==="asc"?x:-x}),b},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:p,filterOverdue:u,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var ub,pb;if(typeof window<"u")try{let e=Bi("ai");ub=e.generateObject,pb=e.generateText;}catch{}function mb(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(ub&&pb&&e.apiKey),o=useCallback(async u=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",u),{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: ${u}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw n(m),m}finally{a(false);}},[s]),i=useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",u.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(m),m}finally{a(false);}},[s]),c=useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{a(false);}},[s]),l=useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",u.title),[{title:`Subtask 1 for: ${u.title}`,position:u.position+.1,columnId:u.columnId},{title:`Subtask 2 for: ${u.title}`,position:u.position+.2,columnId:u.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{a(false);}},[s]),p=useCallback(async u=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",u.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:p,isAvailable:s,isLoading:t,error:r}}function Su(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function gb(e){let{cards:t}=e,[a,r]=Su(),n=useCallback(u=>a.selectedCardIds.includes(u),[a.selectedCardIds]),s=useCallback((u,d)=>{if(!d){r({selectedCardIds:[u],lastSelectedCardId:u});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)a.selectedCardIds.includes(u)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==u),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,u],lastSelectedCardId:u});else if(f&&a.lastSelectedCardId){let v=t.find(h=>h.id===u),b=t.find(h=>h.id===a.lastSelectedCardId);if(v&&b&&v.columnId===b.columnId){let h=t.filter(T=>T.columnId===v.columnId).sort((T,D)=>T.position-D.position),y=h.findIndex(T=>T.id===a.lastSelectedCardId),x=h.findIndex(T=>T.id===u),[w,C]=y<x?[y,x]:[x,y],P=h.slice(w,C+1).map(T=>T.id),O=Array.from(new Set([...a.selectedCardIds,...P]));r({selectedCardIds:O,lastSelectedCardId:u});}else r({selectedCardIds:[u],lastSelectedCardId:u});}else r({selectedCardIds:[u],lastSelectedCardId:u});},[t,a,r]),o=useCallback(u=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==u),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(u=>u.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(u=>{a.selectedCardIds.includes(u)?o(u):r({selectedCardIds:[...a.selectedCardIds,u],lastSelectedCardId:u});},[a,o,r]),p=useCallback(()=>t.filter(u=>a.selectedCardIds.includes(u.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:p}}var fb={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function bb(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...fb,...a}),[a]),[s,o]=useState([]),i=useCallback((v,b,h,y,x)=>{if(b.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:v,cardIds:b,columnId:h,strategy:y,color:x,isExpanded:true,position:s.filter(C=>C.columnId===h).length,createdAt:new Date};o(C=>[...C,w]);},[n.minCardsPerStack,s]),c=useCallback(v=>{o(b=>b.filter(h=>h.id!==v));},[]),l=useCallback(v=>{o(b=>b.map(h=>h.id===v?{...h,isExpanded:!h.isExpanded}:h));},[]),p=useCallback((v,b)=>{o(h=>h.map(y=>y.id===v&&!y.cardIds.includes(b)?{...y,cardIds:[...y.cardIds,b]}:y));},[]),u=useCallback((v,b)=>{o(h=>h.map(y=>{if(y.id===v){let x=y.cardIds.filter(w=>w!==b);return x.length<n.minCardsPerStack?null:{...y,cardIds:x}}return y}).filter(y=>y!==null));},[n.minCardsPerStack]),d=useCallback(v=>s.filter(b=>b.columnId===v).sort((b,h)=>b.position-h.position),[s]),m=useCallback(async v=>{let b=t.filter(C=>C.columnId===v);if(b.length<n.minCardsPerStack*2)return [];let h=[],y=new Map;b.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&&h.push({stack:{title:`\u{1F4CC} ${P}`,cardIds:C.map(O=>O.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${C.length} cards with label "${P}"`,confidence:.85});});let x=new Map;b.forEach(C=>{C.assignedUserIds&&C.assignedUserIds.length>0&&C.assignedUserIds.forEach(P=>{x.has(P)||x.set(P,[]),x.get(P).push(C);});}),x.forEach((C,P)=>{C.length>=n.minCardsPerStack&&h.push({stack:{title:`\u{1F464} Assigned to user-${P.slice(-4)}`,cardIds:C.map(O=>O.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${C.length} cards assigned to the same user`,confidence:.8});});let w=new Map;if(b.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 O={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[P.toLowerCase()]||"\u26AA";h.push({stack:{title:`${O} ${P} Priority`,cardIds:C.map(T=>T.id),columnId:v,strategy:"priority",color:P==="high"||P==="urgent"?"#ef4444":"#10b981"},reason:`${C.length} cards with ${P} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let C of b){let O=(await r.findSimilar(C,b)).filter(T=>T.similarity>=n.autoStackConfidenceThreshold);if(O.length>=n.minCardsPerStack-1){let T=[C.id,...O.map(M=>M.card.id)],D=O.reduce((M,N)=>M+N.similarity,0)/O.length;h.push({stack:{title:`\u2728 Similar to "${C.title.substring(0,30)}${C.title.length>30?"...":""}"`,cardIds:T,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${O.length+1} similar tasks`,confidence:D});}}return h.filter(C=>C.confidence>=n.autoStackConfidenceThreshold).sort((C,P)=>P.confidence-C.confidence).slice(0,5)},[t,n,r]),f=useCallback(v=>{i(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[i]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let h=await m(b),y=h[0];h.length>0&&y&&y.confidence>=.9&&f(y);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:p,removeFromStack:u,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var hb=createContext(null);function yb({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:l}=Bi("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=Bi("@libxai/core");o.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=Bi("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(hb.Provider,{value:{store:n},children:e})}function sc(){let e=useContext(hb);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function Ei(){let e=sc(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let i=useCallback(y=>{e.updateBoard(y);},[e]),c=useCallback(y=>{e.addColumn(y);},[e]),l=useCallback((y,x)=>{e.updateColumn(y,x);},[e]),p=useCallback(y=>{e.deleteColumn(y);},[e]),u=useCallback(y=>e.getColumn(y),[e]),d=useCallback(y=>{e.addCard(y);},[e]),m=useCallback((y,x)=>{e.updateCard(y,x);},[e]),f=useCallback(y=>{e.deleteCard(y);},[e]),v=useCallback((y,x,w)=>{e.moveCard(y,x,w);},[e]),b=useCallback(y=>e.getCard(y),[e]),h=useCallback(y=>e.getCardsByColumn(y),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:p,getColumn:u,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:b,getCardsByColumn:h}}function vb(e){let{cards:t}=Ei();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function wb(e="position",t="asc"){let{cards:a}=Ei();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?i[n.priority]:0,l=s.priority?i[s.priority]:0;o=c-l;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var ic=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=np.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let i=await Promise.resolve(o.apply(s,a));i!==void 0&&(n=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},P2=new ic;function Cb({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:i=0,getItemKey:c}){let l=useRef(null),p=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:i}),u=p.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${p.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${p.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:d,className:n,children:jsx("div",{style:m,children:u.map(f=>{let v=e[f.index];if(!v)return null;let b=c?c(v,f.index):f.index,h={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:h,"data-index":f.index,children:r(v,f.index)},b)})})})}function Tb(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 Db({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:i=16,getItemKey:c,horizontal:l=true}){let p=useRef(null),u=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>p.current,estimateSize:()=>r,overscan:o,gap:i}),d=u.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${u.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:p,style:m,className:s,children:jsx("div",{style:f,children:d.map(v=>{let b=e[v.index];if(!b)return null;let h=c?c(b,v.index):v.index,y={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsx("div",{style:y,"data-index":v.index,children:n(b,v.index)},h)})})})}function Sb(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 Eb(e,t=10){return e>t}var Fu={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Lu={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Au={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},Ru={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Bu={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},$u={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},Ou={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)"},Hu={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)"},Uu={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wu={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}},zu={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}},lc={spacing:Fu,borderRadius:Lu,fontSize:Au,fontWeight:Iu,lineHeight:Ru,zIndex:Bu,duration:$u,easing:Ou,shadows:Hu,opacity:Uu,kanban:Wu,gantt:zu};function Mb(e,t,a){return e[t]??a}function Gu(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?Gu(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function A2(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function Vu(e="asakaa"){let t=Gu(lc),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=A2(n);a.push(` ${s}: ${o};`);}return `:root {
|
|
413
|
+
Today's date: ${new Date().toISOString().split("T")[0]}`}function rf(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Co(e,t){let a=rf(e),r=t.toLowerCase().trim(),n=a.find(i=>i.name.toLowerCase()===r);if(n)return n;let s=a.find(i=>i.name.toLowerCase().includes(r));if(s)return s;let o=r.split(/\s+/);return a.find(i=>{let c=i.name.toLowerCase();return o.every(l=>c.includes(l))})}function Lu(e,t=new Date){let a=e.toLowerCase().trim(),r=new Date(t);if(r.setHours(0,0,0,0),a==="today"||a==="hoy")return r;if(a==="tomorrow"||a==="ma\xF1ana"){let d=new Date(r);return d.setDate(d.getDate()+1),d}if(a==="yesterday"||a==="ayer"){let d=new Date(r);return d.setDate(d.getDate()-1),d}if(a==="next week"||a==="la pr\xF3xima semana"){let d=new Date(r);return d.setDate(d.getDate()+7),d}let n=a.match(/(?:next\s+)?(monday|tuesday|wednesday|thursday|friday|saturday|sunday|lunes|martes|miércoles|miercoles|jueves|viernes|sábado|sabado|domingo)/i);if(n){let m={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(m!==void 0){let f=new Date(r),v=f.getDay(),b=m-v;return b<=0&&(b+=7),f.setDate(f.getDate()+b),f}}let s=a.match(/in\s+(\d+)\s+(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(s&&s[1]&&s[2]){let d=parseInt(s[1],10),m=s[2].toLowerCase(),f=new Date(r);return m==="day"||m==="d\xEDa"||m==="dias"?f.setDate(f.getDate()+d):m==="week"||m==="semana"||m==="semanas"?f.setDate(f.getDate()+d*7):(m==="month"||m==="mes"||m==="meses")&&f.setMonth(f.getMonth()+d),f}if(a.match(/(\d{4})-(\d{2})-(\d{2})/))return new Date(a);let i=a.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/);if(i&&i[1]&&i[2]&&i[3]){let d=parseInt(i[1],10),m=parseInt(i[2],10)-1,f=parseInt(i[3],10);return new Date(f,m,d)}let c={enero:0,febrero:1,marzo:2,abril:3,mayo:4,junio:5,julio:6,agosto:7,septiembre:8,octubre:9,noviembre:10,diciembre:11},l=a.match(/(\d{1,2})\s+de\s+(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)(?:\s+de\s+(\d{4}))?/i);if(l&&l[1]&&l[2]){let d=parseInt(l[1],10),m=c[l[2].toLowerCase()],f=l[3]?parseInt(l[3],10):r.getFullYear();if(m!==void 0)return new Date(f,m,d)}let u={january:0,february:1,march:2,april:3,may:4,june:5,july:6,august:7,september:8,october:9,november:10,december:11},p=a.match(/(january|february|march|april|may|june|july|august|september|october|november|december)\s+(\d{1,2})(?:,?\s+(\d{4}))?/i);if(p&&p[1]&&p[2]){let d=u[p[1].toLowerCase()],m=parseInt(p[2],10),f=p[3]?parseInt(p[3],10):r.getFullYear();if(d!==void 0)return new Date(f,d,m)}return null}function Au(e){let a=e.toLowerCase().trim().match(/(\d+)\s*(day|week|month|día|dias|semana|semanas|mes|meses)s?/i);if(a&&a[1]&&a[2]){let r=parseInt(a[1],10),n=a[2].toLowerCase();if(n==="day"||n==="d\xEDa"||n==="dias")return r;if(n==="week"||n==="semana"||n==="semanas")return r*7;if(n==="month"||n==="mes"||n==="meses")return r*30}return null}function Iu(e){let t=e.match(/(\d+)(?:\s*%)?/);if(t&&t[1]){let a=parseInt(t[1],10);return Math.max(0,Math.min(100,a))}return null}function nf(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 of(e,t){let a=e.toLowerCase().trim(),r=a.match(/(?:move|mover|mueve)\s+(?:la\s+tarea\s+)?["""]?(.+?)["""]?\s+(?:to|a|para)\s+(?:la\s+fecha\s+)?(.+)/i);if(r&&r[1]&&r[2]){let l=r[1].trim(),u=r[2].trim(),p=Co(t,l),d=Lu(u);if(!p)return {type:"move_task",taskName:l,message:`Could not find a task named "${l}". Please check the task name and try again.`,success:false,error:"Task not found"};if(!d)return {type:"move_task",taskId:p.id,taskName:p.name,message:`Could not parse the date "${u}". Try using formats like "next Monday", "in 3 days", or "2024-01-15".`,success:false,error:"Invalid date"};let m=p.startDate&&p.endDate?Math.round((p.endDate.getTime()-p.startDate.getTime())/(1e3*60*60*24)):1,f=new Date(d);return f.setDate(f.getDate()+m),{type:"move_task",taskId:p.id,taskName:p.name,updates:{startDate:d,endDate:f},message:`Moved "${p.name}" to ${d.toLocaleDateString()}.`,success:true}}let n=a.match(/(?:extend|extender|extiende|alargar)\s+["""]?(.+?)["""]?\s+(?:by|por)\s+(.+)/i);if(n&&n[1]&&n[2]){let l=n[1].trim(),u=n[2].trim(),p=Co(t,l),d=Au(u);if(!p)return {type:"resize_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"};if(!d||!p.endDate)return {type:"resize_task",taskId:p.id,taskName:p.name,message:`Could not parse the duration "${u}".`,success:false,error:"Invalid duration"};let m=new Date(p.endDate);return m.setDate(m.getDate()+d),{type:"resize_task",taskId:p.id,taskName:p.name,updates:{endDate:m},message:`Extended "${p.name}" by ${d} days. New end date: ${m.toLocaleDateString()}.`,success:true}}let s=a.match(/(?:set|establecer|poner)\s+["""]?(.+?)["""]?\s+(?:progress|progreso)\s+(?:to|a|en)\s+(.+)/i);if(s&&s[1]&&s[2]){let l=s[1].trim(),u=s[2].trim(),p=Co(t,l),d=Iu(u);return p?d===null?{type:"set_progress",taskId:p.id,taskName:p.name,message:`Could not parse the progress value "${u}".`,success:false,error:"Invalid progress"}:{type:"set_progress",taskId:p.id,taskName:p.name,updates:{progress:d},message:`Set "${p.name}" progress to ${d}%.`,success:true}:{type:"set_progress",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let o=a.match(/(?:rename|renombrar|cambiar nombre de)\s+["""]?(.+?)["""]?\s+(?:to|a|por)\s+["""]?(.+?)["""]?$/i);if(o&&o[1]&&o[2]){let l=o[1].trim(),u=o[2].trim(),p=Co(t,l);return p?{type:"rename_task",taskId:p.id,taskName:p.name,updates:{name:u},message:`Renamed "${p.name}" to "${u}".`,success:true}:{type:"rename_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}let i=a.match(/(?:link|vincular|conectar)\s+["""]?(.+?)["""]?\s+(?:to|a|con)\s+["""]?(.+?)["""]?$/i);if(i&&i[1]&&i[2]){let l=i[1].trim(),u=i[2].trim(),p=Co(t,l),d=Co(t,u);return p?d?{type:"link_tasks",taskId:d.id,taskName:d.name,dependencyFrom:p.id,dependencyTo:d.id,message:`Linked "${p.name}" \u2192 "${d.name}".`,success:true}:{type:"link_tasks",taskName:u,message:`Could not find a task named "${u}".`,success:false,error:"Target task not found"}:{type:"link_tasks",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Source task not found"}}let c=a.match(/(?:delete|eliminar|borrar|remove|quitar)\s+["""]?(.+?)["""]?$/i);if(c&&c[1]){let l=c[1].trim(),u=Co(t,l);return u?{type:"delete_task",taskId:u.id,taskName:u.name,message:`Deleted "${u.name}".`,success:true}:{type:"delete_task",taskName:l,message:`Could not find a task named "${l}".`,success:false,error:"Task not found"}}return null}function sf(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 _k(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 Kk(e){switch(e){case "todo":return "TODO";case "in-progress":return "IN_PROGRESS";case "completed":return "DONE";default:return e||"TODO"}}function Cc(e,t=[],a=[]){let r=e.assignedUserIds?.map(u=>{let p=a.find(d=>d.id===u);return p?{name:p.name,initials:p.initials,color:p.color}:null}).filter(u=>u!==null),n=t.filter(u=>u.metadata?.parentCardId===e.id).map(u=>Cc(u,t,a)),s;e.dependencies&&(typeof e.dependencies[0]=="string"?s=e.dependencies:s=e.dependencies.filter(u=>u.type==="finish-to-start").map(u=>u.taskId));let o=u=>{if(u)return typeof u=="string"?new Date(u):u},i=o(e.startDate),c=o(e.endDate),l=e.metadata?.isMilestone===true||i&&c&&Math.abs(c.getTime()-i.getTime())<=864e5;return {id:e.id,name:e.title,startDate:i,endDate:c,progress:e.progress||0,status:_k(e.metadata?.status),assignees:r?.length?r:void 0,dependencies:s?.length?s:void 0,subtasks:n?.length?n:void 0,isExpanded:e.metadata?.isExpanded===true,isMilestone:l,isCriticalPath:e.metadata?.isCriticalPath===true}}function lf(e,t=[]){let a;return e.assignees&&e.assignees.length>0&&(a=e.assignees.map(r=>t.find(s=>s.name===r.name||s.initials===r.initials)?.id).filter(r=>r!==void 0)),{id:e.id,title:e.name,startDate:e.startDate,endDate:e.endDate,progress:e.progress,assignedUserIds:a?.length?a:void 0,metadata:{status:Kk(e.status),isExpanded:e.isExpanded,isMilestone:e.isMilestone,isCriticalPath:e.isCriticalPath}}}function cf(e,t=[]){return e.filter(r=>!r.metadata?.parentCardId).map(r=>Cc(r,e,t))}function Ru(e){return e.minWidth!=null?e.minWidth:e.type==="name"?Math.min(e.width,220):e.width}function df(e,t){return e.reduce((a,r)=>a+Ru(r),0)+t}var Bu={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)",costBar:"Cost (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"}},$u={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)",costBar:"Costo (Ejecutado / 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:"Completada"},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"}},Tc={en:Bu,es:$u};function Ou(e){return Tc[e]||Tc.en}function Dc(e,t){let a=Ou(e);return t?{columns:{...a.columns,...t.columns},toolbar:{...a.toolbar,...t.toolbar},filters:{...a.filters,...t.filters},status:{...a.status,...t.status},actions:{...a.actions,...t.actions},empty:{...a.empty,...t.empty},pagination:{...a.pagination,...t.pagination},bulk:{...a.bulk,...t.bulk}}:a}var Hu=[{value:"todo",icon:Circle,color:"text-gray-400"},{value:"in-progress",icon:PlayCircle,color:"text-[#3B9EFF]"},{value:"completed",icon:CheckCircle2,color:"text-[#3BF06E]"}];function uf(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 pf({value:e,onChange:t,isDark:a,translations:r,disabled:n=false}){let[s,o]=useState(false),i=useRef(null);useEffect(()=>{let m=f=>{i.current&&!i.current.contains(f.target)&&o(false);};return s&&document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[s]);let c=uf(e),l=Hu[0],u=Hu.find(m=>m.value===c)??l,p=u.icon,d=m=>{switch(uf(m)){case "completed":return r.completed;case "in-progress":return r.inProgress;default:return r.todo}};return n||!t?jsxs("div",{className:"flex items-center gap-2",children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)})]}):jsxs("div",{ref:i,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o(!s);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx(p,{className:g("w-4 h-4 flex-shrink-0",u.color)}),jsx("span",{className:g("text-sm whitespace-nowrap",a?"text-white/60":"text-gray-500"),children:d(e)}),jsx(ChevronDown,{className:g("w-3 h-3",a?"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]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Hu.map(m=>{let f=m.icon;return jsxs("button",{onClick:v=>{v.stopPropagation(),t(m.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",c===m.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx(f,{className:g("w-4 h-4",m.color)}),jsx("span",{className:a?"text-white":"text-gray-900",children:d(m.value)})]},m.value)})})]})}function Jo(e,t,a=320){let[r,n]=useState(false);return useLayoutEffect(()=>{if(!t)return;let s=e.current?.getBoundingClientRect();if(!s)return;let o=12,i=s.bottom+a+o<=window.innerHeight,c=s.top-a-o>=0;n(!i&&c);},[t,a,e]),r}var Wu=[{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 gf({value:e="none",onChange:t,isDark:a,locale:r,disabled:n=false}){let[s,o]=useState(false),i=useRef(null),c=Jo(i,s,180);useEffect(()=>{let p=d=>{i.current&&!i.current.contains(d.target)&&o(false);};return s&&document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[s]);let l=Wu.find(p=>p.value===e)??Wu[4],u=r==="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",a?"text-white/60":"text-gray-500"),children:l.label[u]})]}):jsxs("div",{ref:i,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",a?"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",a?"text-white/60":"text-gray-500"),children:l.label[u]}),jsx(ChevronDown,{className:g("w-3 h-3",a?"text-white/30":"text-gray-400")})]}),s&&jsx("div",{className:g("absolute z-50 left-0 "+(c?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px]",a?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:Wu.map(p=>jsxs("button",{onClick:d=>{d.stopPropagation(),t(p.value),o(false);},className:g("w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===p.value&&(a?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("div",{className:g("w-2 h-2 rounded-full",p.bg)}),jsx("span",{className:a?"text-white":"text-gray-900",children:p.label[u]})]},p.value))})]})}function Xi(e){return ba(e)}function zu(e){let t=["bg-[#00E5CC]","bg-green-500","bg-purple-500","bg-pink-500","bg-yellow-500","bg-red-500","bg-indigo-500","bg-[#00E5CC]"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"bg-[#00E5CC]"}function Ec({value:e=[],availableUsers:t=[],onChange:a,isDark:r,locale:n,disabled:s=false}){let[o,i]=useState(false),[c,l]=useState(""),u=useRef(null),p=useRef(null),d=Jo(u,o);useEffect(()=>{let b=w=>{u.current&&!u.current.contains(w.target)&&(i(false),l(""));};return o&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[o]),useEffect(()=>{o&&p.current&&p.current.focus();},[o]);let m=t.filter(b=>b.name.toLowerCase().includes(c.toLowerCase())),f=b=>e.some(w=>w.name===b),v=b=>{if(a){if(f(b.name))a(e.filter(w=>w.name!==b.name));else {let w={name:b.name,initials:Xi(b.name),color:b.color||zu(b.name).replace("bg-","").replace("-500",""),avatar:b.avatarUrl,id:b.id};a([...e,w]);}i(false),l("");}};return s||!a?e.length===0?jsx("span",{className:g("text-sm",r?"text-white/30":"text-gray-400"),children:"-"}):jsxs("div",{className:"flex items-center -space-x-2",children:[e.slice(0,3).map((b,w)=>jsx("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium text-white border-2",r?"border-[#0D0D0D]":"border-white",!b.avatar&&zu(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,title:b.name,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xi(b.name)},`${b.name}-${w}`)),e.length>3&&jsxs("div",{className:g("w-7 h-7 rounded-full flex items-center justify-center text-xs font-medium border-2",r?"bg-[#1A1A1A] border-[#0D0D0D] text-white":"bg-gray-200 border-white text-gray-600"),children:["+",e.length-3]})]}):jsxs("div",{ref:u,className:"relative",children:[jsx("button",{type:"button","aria-label":e.length===0?n==="es"?"Asignar responsable":"Assign":n==="es"?`Responsables: ${e.map(b=>b.name).join(", ")}`:`Assignees: ${e.map(b=>b.name).join(", ")}`,onClick:b=>{b.stopPropagation(),i(!o);},className:g("flex items-center gap-1 px-2 py-1 rounded transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:e.length===0?jsxs(Fragment,{children:[jsx(User,{className:g("w-4 h-4",r?"text-white/30":"text-gray-400")}),jsx(Plus,{className:g("w-3 h-3",r?"text-white/30":"text-gray-400")})]}):jsxs("div",{className:"flex items-center -space-x-1",children:[e.slice(0,2).map((b,w)=>jsx("div",{className:g("w-6 h-6 rounded-full flex items-center justify-center text-[10px] font-medium text-white border",r?"border-[#0D0D0D]":"border-white",!b.avatar&&zu(b.name)),style:b.color&&!b.avatar?{backgroundColor:b.color}:void 0,children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xi(b.name)},`${b.name}-${w}`)),e.length>2&&jsxs("span",{className:g("text-xs ml-1",r?"text-white/60":"text-gray-500"),children:["+",e.length-2]})]})}),o&&jsxs("div",{className:g("absolute z-50 left-0 rounded-lg overflow-hidden",d?"bottom-full mb-1.5":"top-full mt-1.5"),style:{width:260,backgroundColor:r?"rgba(17, 17, 17, 0.98)":"rgba(255, 255, 255, 0.98)",border:`1px solid ${r?"rgba(255,255,255,0.10)":"rgba(0,0,0,0.1)"}`,boxShadow:r?"0 8px 24px rgba(0,0,0,0.5)":"0 8px 24px rgba(0,0,0,0.12)"},children:[jsxs("div",{className:"flex items-center gap-1.5",style:{padding:"8px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:[jsx(Search,{className:"flex-shrink-0",style:{width:14,height:14,color:r?"rgba(255,255,255,0.20)":"#94A3B8"}}),jsx("input",{ref:p,type:"text",value:c,onChange:b=>l(b.target.value),placeholder:n==="es"?"Buscar miembros...":"Search members...",onClick:b=>b.stopPropagation(),style:{flex:1,fontSize:12,color:r?"rgba(255,255,255,0.92)":"#0F172A",backgroundColor:"transparent",border:"none",outline:"none",fontFamily:"Inter, sans-serif"}})]}),e.length>0&&jsx("div",{className:"flex flex-wrap gap-1",style:{padding:"6px 10px",borderBottom:`1px solid ${r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)"}`},children:e.map((b,w)=>jsxs("span",{className:"flex items-center gap-1",style:{fontSize:11,padding:"2px 6px 2px 4px",borderRadius:4,backgroundColor:b.color?`${b.color}20`:r?"rgba(255,255,255,0.08)":"rgba(0,0,0,0.06)",color:b.color||(r?"#fff":"#334155")},children:[jsx("span",{className:"flex items-center justify-center",style:{width:16,height:16,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:8,fontWeight:700,color:"#fff"},children:b.avatar?jsx("img",{src:b.avatar,alt:b.name,className:"w-full h-full rounded-full object-cover"}):b.initials||Xi(b.name)}),b.name.split(" ")[0],jsx("button",{onClick:h=>{h.stopPropagation(),a(e.filter(x=>x.name!==b.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}})})]},`${b.name}-${w}`))}),jsx("div",{style:{maxHeight:200,overflowY:"auto",padding:4},children:m.length===0?jsx("div",{style:{padding:"12px 10px",fontSize:12,color:"var(--pj-texto-tenue, #5b6270)",textAlign:"center"},children:n==="es"?"No se encontraron miembros":"No members found"}):m.map(b=>{let w=f(b.name);return jsxs("button",{onClick:h=>{h.stopPropagation(),v(b);},className:"flex items-center w-full",style:{gap:8,padding:"6px 10px",borderRadius:4,border:"none",cursor:"pointer",backgroundColor:w?r?"rgba(0, 229, 204, 0.12)":"rgba(0, 229, 204, 0.08)":"transparent",color:r?"rgba(255,255,255,0.92)":"#0F172A",fontSize:12,textAlign:"left",transition:"background-color 0.1s"},onMouseEnter:h=>{w||(h.currentTarget.style.backgroundColor=r?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)");},onMouseLeave:h=>{w||(h.currentTarget.style.backgroundColor="transparent");},children:[jsx("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:24,height:24,borderRadius:"50%",backgroundColor:b.color||"#00E5CC",fontSize:9,fontWeight:700,color:"#fff"},children:b.avatarUrl?jsx("img",{src:b.avatarUrl,alt:b.name,className:"w-full h-full rounded-full object-cover"}):Xi(b.name)}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:b.name}),w&&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"}})})]},b.id)})})]})]})}var ai=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function yf(e,t){let a=t.locale==="es",r=n=>n.toLocaleDateString(a?"es-ES":"en-US",{day:"numeric",month:"short"});return t.minimo&&ai(e)<ai(t.minimo)?a?`Antes del inicio del proyecto (${r(t.minimo)})`:`Before the project start (${r(t.minimo)})`:t.campo==="end"&&t.inicio&&ai(e)<ai(t.inicio)?a?`El fin no puede ser anterior al inicio (${r(t.inicio)})`:`The end can't be before the start (${r(t.inicio)})`:t.campo==="start"&&t.fin&&ai(e)>ai(t.fin)?a?`El inicio no puede ser posterior al fin (${r(t.fin)})`:`The start can't be after the end (${r(t.fin)})`:null}function wf({startDate:e,endDate:t,onChange:a,singleDateMode:r=false,singleDateField:n="end",isDark:s,locale:o,disabled:i=false,placeholder:c,minDate:l}){let[u,p]=useState(false),[d,m]=useState(n),[f,v]=useState(()=>{let R=n==="start"?e:t;if(R){let A=R instanceof Date?R:new Date(R);return new Date(A.getFullYear(),A.getMonth(),1)}return new Date(new Date().getFullYear(),new Date().getMonth(),1)}),b=useRef(null),w=useRef(null),h=useRef(null),[x,y]=useState(null),k=e?e instanceof Date?e:new Date(e):null,M=t?t instanceof Date?t:new Date(t):null;useEffect(()=>{let R=A=>{let ve=A.target;b.current&&b.current.contains(ve)||h.current&&h.current.contains(ve)||p(false);};return u&&document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[u]),useLayoutEffect(()=>{if(!u){y(null);return}let R=()=>{let A=w.current?.getBoundingClientRect();if(!A)return;let ve=520,q=360,le=window.innerHeight-A.bottom,B=le<q&&A.top>le,pe=B?A.top-4:A.bottom+4,nt=Math.min(Math.max(A.left,8),window.innerWidth-ve-8);y({top:pe,left:nt,flipUp:B});};return R(),window.addEventListener("scroll",R,true),window.addEventListener("resize",R),()=>{window.removeEventListener("scroll",R,true),window.removeEventListener("resize",R);}},[u]),useEffect(()=>{u&&m(r?n:"start");},[u,r,n]);let H=R=>R?zr(R,o==="es"?"es":"en"):c||"-",E=useCallback(()=>{let R=f.getFullYear(),A=f.getMonth(),ve=new Date(R,A,1),le=new Date(R,A+1,0).getDate(),B=ve.getDay(),pe=[],Ue=new Date(R,A,0).getDate();for(let fe=B-1;fe>=0;fe--)pe.push({date:new Date(R,A-1,Ue-fe),isCurrentMonth:false});for(let fe=1;fe<=le;fe++)pe.push({date:new Date(R,A,fe),isCurrentMonth:true});let $=42-pe.length;for(let fe=1;fe<=$;fe++)pe.push({date:new Date(R,A+1,fe),isCurrentMonth:false});return pe},[f]),N=l?l instanceof Date?l:new Date(l):null,D=R=>yf(R,{campo:r?n:d,inicio:k,fin:M,minimo:N,locale:o}),S=R=>{if(!D(R))if(r)n==="start"?a(R,M||void 0):a(k||void 0,R),p(false);else if(d==="start"){let A=M&&R>M?R:M;a(R,A||void 0),m("end");}else {let A=k&&R<k?R:k;a(A||void 0,R),p(false);}},V=()=>{let R=new Date,A=new Date(R);A.setDate(R.getDate()+1);let ve=new Date(R);ve.setDate(R.getDate()+((6-R.getDay()+7)%7||7));let q=new Date(R);q.setDate(R.getDate()+((1-R.getDay()+7)%7||7));let le=new Date(R);le.setDate(R.getDate()+(6-R.getDay()+7)%7+7);let B=new Date(R);B.setDate(R.getDate()+14);let pe=new Date(R);return pe.setDate(R.getDate()+28),[{label:o==="es"?"Hoy":"Today",date:R,display:R.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Ma\xF1ana":"Tomorrow",date:A,display:A.toLocaleDateString(o==="es"?"es-ES":"en-US",{weekday:"short"}).slice(0,3)+"."},{label:o==="es"?"Este fin de semana":"This weekend",date:ve,display:o==="es"?"s\xE1b.":"sat."},{label:o==="es"?"Pr\xF3xima semana":"Next week",date:q,display:o==="es"?"lun.":"mon."},{label:o==="es"?"Pr\xF3ximo fin de semana":"Next weekend",date:le,display:zr(le,o==="es"?"es":"en")},{label:o==="es"?"2 semanas":"2 weeks",date:B,display:zr(B,o==="es"?"es":"en")},{label:o==="es"?"4 semanas":"4 weeks",date:pe,display:zr(pe,o==="es"?"es":"en")}]};if(i){let R=r&&n==="start"?k:M;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:H(R)})]})}let W=r&&n==="start"?k:M;return jsxs("div",{ref:b,className:"relative",children:[jsxs("button",{ref:w,onClick:R=>{R.stopPropagation(),p(!u);let A=n==="start"?k:M;A&&v(new Date(A.getFullYear(),A.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:H(W)})]}),u&&x&&createPortal(jsxs("div",{ref:h,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:x.flipUp?void 0:x.top,bottom:x.flipUp?window.innerHeight-x.top:void 0,left:x.left,zIndex:10001},onClick:R=>R.stopPropagation(),children:[jsxs("div",{className:g("w-44 py-2 border-r",s?"border-[#222]":"border-gray-200"),children:[V().map((R,A)=>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:()=>S(R.date),disabled:!!D(R.date),title:D(R.date)??void 0,style:D(R.date)?{opacity:.35,cursor:"not-allowed"}:void 0,children:[jsx("span",{children:R.label}),jsx("span",{className:g("text-xs",s?"text-white/30":"text-gray-400"),children:R.display})]},A)),jsx("div",{className:g("border-t mt-2 pt-2",s?"border-[#222]":"border-gray-200"),children:jsxs("button",{onClick:()=>{r?n==="start"?a(void 0,M||void 0):a(k||void 0,void 0):a(void 0,void 0),p(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:[!r&&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:d==="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:f.toLocaleDateString(o==="es"?"es-ES":"en-US",{month:"long",year:"numeric"})}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>v(new Date),className: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:()=>v(new Date(f.getFullYear(),f.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:()=>v(new Date(f.getFullYear(),f.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(R=>jsx("div",{className:g("w-8 h-8 flex items-center justify-center text-xs",s?"text-white/30":"text-gray-400"),children:R},R))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:E().map((R,A)=>{let ve=R.date.toDateString()===new Date().toDateString(),q=k?.toDateString()===R.date.toDateString(),le=M?.toDateString()===R.date.toDateString(),B=q||le,pe=!r&&k&&M&&R.date>=k&&R.date<=M;return jsx("button",{onClick:()=>S(new Date(R.date)),disabled:!!D(R.date),title:D(R.date)??void 0,style:D(R.date)?{opacity:.3,cursor:"not-allowed"}:void 0,className:g("w-8 h-8 rounded-full flex items-center justify-center text-sm transition-colors",!R.isCurrentMonth&&(s?"text-white/20":"text-gray-300"),R.isCurrentMonth&&(s?"text-white":"text-gray-900"),ve&&"ring-2 ring-[#00E5CC]",q&&"bg-[#00E5CC] text-white",le&&!q&&"bg-[#7C3AED] text-white",pe&&!B&&(s?"bg-[#7C3AED]/20":"bg-purple-100"),!B&&(s?"hover:bg-white/[0.05]":"hover:bg-gray-100")),children:R.date.getDate()},A)})})]})]}),document.body)]})}function Pc({value:e,onChange:t,isDark:a,locale:r,disabled:n=false,dateField:s="end",startDate:o,endDate:i,minDate:c}){let l=e?e instanceof Date?e:new Date(e):null;return jsx(wf,{startDate:s==="start"?l:o||null,endDate:s==="end"?l:i||null,onChange:(m,f)=>{t&&t(s==="start"?m:f);},singleDateMode:true,singleDateField:s,isDark:a,locale:r,disabled:n||!t,placeholder:"-",minDate:c})}function ri(e=600){let[t,a]=useState(false),r=useRef(null),n=useCallback(()=>{r.current&&clearTimeout(r.current),a(true),r.current=setTimeout(()=>{a(false);},e);},[e]);return useEffect(()=>()=>{r.current&&clearTimeout(r.current);},[]),{isFlashing:t,triggerFlash:n}}function Fc(e,t={}){let{enabled:a=true,duration:r=400,steps:n=8}=t,[s,o]=useState(e),[i,c]=useState(false),l=useRef(e),u=useRef([]);return useEffect(()=>{if(u.current.forEach(clearTimeout),u.current=[],!a||e===l.current||e===void 0){o(e),l.current=e;return}let p=l.current??0,d=e,m=d-p,f=r/n;c(true);for(let v=1;v<=n;v++){let b=setTimeout(()=>{let w=v/n,h=1-Math.pow(1-w,3),x=Math.round(p+m*h);o(x),v===n&&(c(false),o(d));},f*v);u.current.push(b);}return l.current=e,()=>{u.current.forEach(clearTimeout),u.current=[];}},[e,a,r,n]),{displayValue:s,isAnimating:i}}function kf(e,t={}){let{delay:a=1500,onCancel:r}=t,[n,s]=useState(null),[o,i]=useState(0),c=useRef(null),l=useRef(null),u=useCallback(m=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(m),i(0);let f=Date.now();l.current=setInterval(()=>{let v=Date.now()-f,b=Math.min(v/a*100,100);i(b);},16),c.current=setTimeout(()=>{l.current&&clearInterval(l.current),e?.(m),s(null),i(0);},a);},[a,e]),p=useCallback(()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current),s(null),i(0),r?.();},[r]);return useEffect(()=>()=>{c.current&&clearTimeout(c.current),l.current&&clearInterval(l.current);},[]),{pendingValue:n,isPending:n!==null,progress:o,startChange:u,cancelChange:p}}function Tf({value:e=0,onChange:t,isDark:a,disabled:r=false,enableSlotMachine:n=true,enableSaveFlash:s=true}){let[o,i]=useState(false),[c,l]=useState(""),u=useRef(null),{isFlashing:p,triggerFlash:d}=ri(),{displayValue:m,isAnimating:f}=Fc(e,{enabled:n,duration:300,steps:6}),v=y=>{if(r||!t)return;y.stopPropagation();let k=y.currentTarget.getBoundingClientRect(),M=y.clientX-k.left,H=Math.round(M/k.width*100),E=Math.max(0,Math.min(100,H));E!==e&&(t(E),s&&d());},b=useCallback(y=>{r||!t||(y.stopPropagation(),l(String(e)),i(true));},[r,t,e]);useEffect(()=>{o&&u.current&&(u.current.focus(),u.current.select());},[o]);let w=useCallback(()=>{i(false);let y=parseInt(c,10);if(!isNaN(y)&&t){let k=Math.max(0,Math.min(100,y));k!==e&&(t(k),s&&d());}},[c,t,e,s,d]),h=useCallback(y=>{y.key==="Enter"&&w(),y.key==="Escape"&&i(false);},[w]),x=m??e;return jsxs("div",{className:g("flex items-center gap-2 w-full rounded px-1 py-0.5 transition-[background-color] duration-300",p&&(a?"bg-[#3BF06E]/30":"bg-[#3BF06E]/20")),children:[x>0?jsx("div",{onClick:v,className:g("flex-1 h-2 rounded-full overflow-hidden",a?"bg-white/[0.05]":"bg-gray-200",!r&&t&&"cursor-pointer"),children:jsx("div",{className:g("h-full rounded-full transition-[width]",x===100?"bg-[#3BF06E]":"bg-[#3B9EFF]",f&&"transition-none"),style:{width:`${x}%`}})}):jsx("div",{className:"flex-1"}),o?jsxs("div",{className:"flex items-center gap-0.5",onClick:y=>y.stopPropagation(),children:[jsx("input",{ref:u,value:c,onChange:y=>l(y.target.value.replace(/[^0-9]/g,"")),onBlur:w,onKeyDown:h,maxLength:3,className:g("w-8 text-xs text-right tabular-nums font-mono rounded border px-1 py-0 outline-none",a?"bg-white/10 border-white/20 text-white focus:border-[#00E5CC]":"bg-white border-gray-300 text-gray-900 focus:border-[#00E5CC]")}),jsx("span",{className:g("text-xs font-mono",a?"text-white/40":"text-gray-400"),children:"%"})]}):jsxs("span",{onClick:b,className:g("text-xs w-8 text-right tabular-nums font-mono rounded px-1",x===0?a?"text-[#6B7280]":"text-gray-400":a?"text-white/60":"text-gray-500",!r&&t&&"cursor-pointer hover:bg-white/[0.08]",f&&"font-medium scale-105"),title:!r&&t?"Click to edit":void 0,children:[x,"%"]})]})}function Sf({value:e="",onChange:t,isDark:a,placeholder:r="-",disabled:n=false}){let[s,o]=useState(false),[i,c]=useState(e),l=useRef(null);useEffect(()=>{s&&l.current&&(l.current.focus(),l.current.select());},[s]),useEffect(()=>{c(e);},[e]);let u=()=>{i!==e&&t?.(i),o(false);},p=d=>{d.key==="Enter"?u():d.key==="Escape"&&(c(e),o(false));};return n||!t?jsx("span",{className:g("text-sm truncate",a?"text-white/60":"text-gray-500"),children:e||r}):s?jsx("input",{ref:l,type:"text",value:i,onChange:d=>c(d.target.value),onBlur:u,onKeyDown:p,onClick:d=>d.stopPropagation(),className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:d=>{d.stopPropagation(),o(true);},className:g("text-sm truncate text-left w-full px-2 py-1 rounded transition-colors",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",!e&&(a?"text-white/30":"text-gray-400")),children:e||r})}function Pf({value:e,onChange:t,isDark:a,placeholder:r="-",min:n,max:s,disabled:o=false,enableSlotMachine:i=true,enableSaveFlash:c=true}){let[l,u]=useState(false),[p,d]=useState(e?.toString()||""),m=useRef(null),{isFlashing:f,triggerFlash:v}=ri(),{displayValue:b,isAnimating:w}=Fc(e,{enabled:i&&!l});useEffect(()=>{l&&m.current&&(m.current.focus(),m.current.select());},[l]),useEffect(()=>{d(e?.toString()||"");},[e]);let h=()=>{let y=parseFloat(p);if(!isNaN(y)){let k=y;n!==void 0&&(k=Math.max(n,k)),s!==void 0&&(k=Math.min(s,k)),k!==e&&(t?.(k),c&&v());}u(false);},x=y=>{y.key==="Enter"?h():y.key==="Escape"&&(d(e?.toString()||""),u(false));};return o||!t?jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500",w&&"font-medium"),children:b!==void 0?b:r}):l?jsx("input",{ref:m,type:"number",value:p,onChange:y=>d(y.target.value),onBlur:h,onKeyDown:x,onClick:y=>y.stopPropagation(),min:n,max:s,className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white":"bg-white border-[#00E5CC] text-gray-900")}):jsx("button",{onClick:y=>{y.stopPropagation(),u(true);},className:g("text-sm text-left w-full px-2 py-1 rounded transition-[background-color] duration-300",a?"text-white/60 hover:bg-white/[0.05]":"text-gray-500 hover:bg-gray-100",b===void 0&&(a?"text-white/30":"text-gray-400"),f&&(a?"bg-green-500/30":"bg-green-500/20"),w&&"font-medium scale-105"),children:b!==void 0?b:r})}function Ff({value:e,options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false}){let[o,i]=useState(false),c=useRef(null),l=Jo(c,o,220);return useEffect(()=>{let u=p=>{c.current&&!c.current.contains(p.target)&&i(false);};return o&&document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]),s||!a?jsx("span",{className:g("text-sm",r?"text-white/60":"text-gray-500"),children:e||n}):jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:u=>{u.stopPropagation(),i(!o);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",!e&&(r?"text-white/30":"text-gray-400")),children:e||n}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),o&&jsx("div",{className:g("absolute z-50 left-0 "+(l?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[120px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(u=>jsxs("button",{onClick:p=>{p.stopPropagation(),a(u),i(false);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",r?"hover:bg-white/[0.05]":"hover:bg-gray-100",e===u&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:u}),e===u&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},u))})]})}function Af({value:e=false,onChange:t,isDark:a,disabled:r=false,enableDelayedConfirm:n=true,confirmDelay:s=1500}){let{pendingValue:o,isPending:i,progress:c,startChange:l,cancelChange:u}=kf(t,{delay:s}),p=m=>{m.stopPropagation(),!r&&t&&(n?i?u():l(!e):t(!e));},d=i?o:e;return jsxs("div",{className:"relative inline-flex items-center gap-1",children:[jsxs("button",{onClick:p,disabled:r||!t,className:g("relative w-5 h-5 rounded border-2 flex items-center justify-center transition-[border-color,background-color,box-shadow]",d?"bg-[#00E5CC] border-[#00E5CC]":a?"border-[#333] hover:border-[#6B7280]":"border-gray-300 hover:border-gray-400",(r||!t)&&"opacity-50 cursor-not-allowed",i&&"ring-2 ring-offset-1",i&&d&&"ring-green-500/50",i&&!d&&"ring-red-500/50",i&&(a?"ring-offset-[#050505]":"ring-offset-white")),children:[i&&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:d?"#22C55E":"#EF4444",strokeWidth:"2",strokeDasharray:`${c/100*50.26} 50.26`,className:"transition-all duration-100"})}),i?jsx(Loader2,{className:"w-3 h-3 text-white animate-spin"}):d?jsx(Check,{className:"w-3 h-3 text-white"}):null]}),i&&jsx("button",{onClick:m=>{m.stopPropagation(),u();},className:g("w-4 h-4 rounded-full flex items-center justify-center transition-colors",a?"bg-red-500/20 hover:bg-red-500/40 text-red-400":"bg-red-100 hover:bg-red-200 text-red-500"),title:"Cancelar",children:jsx(X,{className:"w-3 h-3"})})]})}function If({value:e=[],options:t=[],onChange:a,isDark:r,placeholder:n="-",disabled:s=false,maxSelectable:o,maxVisible:i=2}){let[c,l]=useState(false),u=useRef(null),p=Jo(u,c,220);useEffect(()=>{let w=h=>{u.current&&!u.current.contains(h.target)&&l(false);};return c&&document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[c]);let d=e.slice(0,i),m=e.length-d.length,f=e.length===0?n:d.join(", ")+(m>0?` +${m}`:"");if(s||!a)return jsx("span",{className:g("text-sm truncate",r?"text-white/60":"text-gray-500"),children:f});let v=w=>{let h=e.includes(w),x=h?e.filter(y=>y!==w):[...e,w];!h&&o!=null&&e.length>=o||a(x);},b=o!=null&&e.length>=o;return jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{onClick:w=>{w.stopPropagation(),l(!c);},className:g("flex items-center gap-2 px-2 py-1 rounded transition-colors min-w-[80px]",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:[jsx("span",{className:g("text-sm flex-1 text-left truncate",r?"text-white/60":"text-gray-500",e.length===0&&(r?"text-white/30":"text-gray-400")),children:f}),jsx(ChevronDown,{className:g("w-3 h-3 flex-shrink-0",r?"text-white/30":"text-gray-400")})]}),c&&jsx("div",{className:g("absolute z-50 left-0 "+(p?"bottom-full mb-1 ":"top-full mt-1 ")+"py-1 rounded-lg shadow-lg border min-w-[140px] max-h-48 overflow-y-auto",r?"bg-[#1A1A1A] border-[#222]":"bg-white border-gray-200"),children:t.length===0?jsx("p",{className:g("px-3 py-2 text-sm",r?"text-white/30":"text-gray-400"),children:"No options"}):t.map(w=>{let h=e.includes(w),x=!h&&b;return jsxs("button",{disabled:x,onClick:y=>{y.stopPropagation(),v(w);},className:g("w-full flex items-center justify-between gap-2 px-3 py-2 text-sm transition-colors",x?"opacity-40 cursor-not-allowed":r?"hover:bg-white/[0.05]":"hover:bg-gray-100",h&&(r?"bg-white/[0.03]":"bg-gray-50")),children:[jsx("span",{className:r?"text-white":"text-gray-900",children:w}),h&&jsx(Check,{className:"w-4 h-4 text-[#00E5CC]"})]},w)})})]})}function BC(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 $f({value:e,isDark:t,placeholder:a="-",onOpen:r}){let n=BC(e);if(n.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:a});let s=n[0],o=n.length-1,i=o>0?`${s.name} +${o}`:s.name;return r?jsxs("button",{onClick:c=>{c.stopPropagation(),r(s);},title:n.map(c=>c.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:i})]}):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"}),i]})}function Wf({value:e=[],isDark:t,maxVisible:a=2}){if(e.length===0)return jsx("span",{className:g("text-sm",t?"text-white/30":"text-gray-400"),children:"-"});let r=e.slice(0,a),n=e.length-a;return jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.map(s=>jsx("span",{className:"inline-flex items-center px-2 py-0.5 text-[9px] font-mono uppercase tracking-wide rounded",style:{backgroundColor:s.color?`${s.color}20`:t?"rgba(255,255,255,0.05)":"#F3F4F6",color:s.color||(t?"rgba(255,255,255,0.5)":"#6B7280")},children:s.name},s.id)),n>0&&jsxs("span",{className: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 HC(e,t="en"){return e==null||e===0||!e||Number(e)===0?"-":un(e,t==="es"?"es":"en")}function WC(e){let t=e.trim().toLowerCase();if(!t||t==="-")return null;let a=t.match(/^(\d+):(\d+)$/);if(a&&a[1]&&a[2]){let i=parseInt(a[1],10),c=parseInt(a[2],10);return i*60+c}let r=t.match(/^(\d+\.?\d*)\s*h\s*(\d+)?\s*(m|min)?$/);if(r&&r[1]){let i=parseFloat(r[1]),c=r[2]?parseInt(r[2],10):0;return Math.round(i*60)+c}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 on({value:e,onChange:t,isDark:a,locale:r="en",placeholder:n,disabled:s=false,enableSaveFlash:o=true,isBlurred:i=false,lens:c="hours",hourlyRate:l=0,financialOverride:u,currencyCode:p}){let[d,m]=useState(false),[f,v]=useState(""),[b,w]=useState(null);useEffect(()=>{if(!b||d)return;let S=setTimeout(()=>w(null),4e3);return ()=>clearTimeout(S)},[b,d]);let h=useRef(null),{isFlashing:x,triggerFlash:y}=ri(),k=c==="financial"&&(l>0||u!=null),M=u??(e?e/60*l:0),H=k&&(u!=null?u>0:e)?Qa(Math.round(M),p,r==="es"?"es":"en"):HC(e,r);useEffect(()=>{d&&h.current&&(h.current.focus(),h.current.select());},[d]),useEffect(()=>{if(e){let S=Math.floor(e/60),V=e%60;S>0&&V>0?v(`${S}h ${V}m`):S>0?v(`${S}h`):v(`${V}m`);}else v("");},[e,d]);let E=(S=true)=>{let V=WC(f);if(f.trim()!==""&&f.trim()!=="-"&&(V==null||V<0)){w(V!=null&&V<0?r==="es"?"No puede ser negativo: no se guard\xF3":"Can't be negative: not saved":r==="es"?`\xAB${f.trim()}\xBB no es una duraci\xF3n (usa 8, 2h 30m o 2:30): no se guard\xF3`:`"${f.trim()}" is not a duration (use 8, 2h 30m or 2:30): not saved`),S&&m(false);return}w(null),V!==e&&(t?.(V),o&&y()),m(false);},N=S=>{S.key==="Enter"?E(false):S.key==="Escape"&&m(false);};if(i)return jsxs("div",{className:"flex items-center gap-1.5",title:r==="es"?"No tienes permisos para ver este dato":"You don't have permission to view this data",children:[jsx(Clock,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm select-none blur-[4px] opacity-60 pointer-events-none",a?"text-white/60":"text-gray-500"),"aria-hidden":"true",children:"\u2022\u2022\u2022\u2022"})]});let D=k?DollarSign:Clock;return s||!t?!e||e===0?null:jsxs("div",{className:"flex items-center justify-center gap-1.5",children:[jsx(D,{className:g("w-3.5 h-3.5 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:g("text-sm font-mono",a?"text-white/60":"text-gray-500"),children:H})]}):d?jsx("input",{ref:h,type:"text",value:f,onChange:S=>v(S.target.value),onBlur:()=>E(true),title:b??void 0,onKeyDown:N,onClick:S=>S.stopPropagation(),placeholder:"8 (=8h), 1h 30m",className:g("w-full px-2 py-1 text-sm rounded border outline-none",a?"bg-white/[0.03] border-[#00E5CC] text-white placeholder:text-white/30":"bg-white border-[#00E5CC] text-gray-900 placeholder:text-gray-400",b&&"!border-red-500")}):jsxs("button",{onClick:S=>{S.stopPropagation(),m(true);},title:b??void 0,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",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",e!=null&&e>0?a?"text-white/60":"text-gray-600":a?"text-white/30":"text-gray-400",x&&(a?"bg-green-500/30":"bg-green-500/20"),b&&"ring-1 ring-red-500 bg-red-500/10"),children:[e!=null&&e>0&&jsx(D,{className:g("w-3 h-3 flex-shrink-0",a?"text-white/30":"text-gray-400")}),jsx("span",{className:"truncate font-mono",children:H})]})}function Uf({startDate:e,endDate:t,scheduleVariance:a,isDark:r,locale:n="en",hasTimeAllocated:s=true,sinEmpezar:o=false}){if(!e&&!t)return jsx("span",{className:g("text-[11px] font-mono",r?"text-white/30":"text-gray-400"),children:"-"});let i=l=>zr(l,n==="es"?"es":"en"),c=()=>{if(a==null)return null;let l=n==="es";return a===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:"var(--pj-texto-tenue, #5b6270)",fontWeight:500},children:l?"Tiempo no asignado":"No time allocated"}):a>0&&o?jsx("span",{className:"font-mono",style:{fontSize:"10px",color:"var(--pj-texto-tenue, #5b6270)",fontWeight:500},children:l?"Sin iniciar":"Not started"}):a>0?jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#3BF06E",fontWeight:600},children:["+",a,"d ",l?"Adelante":"Early"]}):jsxs("span",{className:"font-mono",style:{fontSize:"10px",color:"#F87171",fontWeight:600},children:[a,"d ",l?"Atraso":"Delay"]})};return jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:[jsxs("span",{className:g("text-[11px] font-mono",r?"text-white/60":"text-gray-500"),children:[e?i(e):"\u2014",jsx("span",{className:r?"text-white/20 mx-1":"text-gray-300 mx-1",children:"vs"}),t?i(t):"\u2014"]}),c()]})}function tp({task:e,isDark:t,locale:a="en",onLogTime:r,onEstimateUpdate:n,onSoldEffortUpdate:s,onOpenTimeLog:o,lens:i="hours",hourlyRate:c=0,currencyCode:l}){let u=a==="es",p=i==="financial"&&c>0,d=(le,B)=>p?Qa(Math.round(le*c),l,u?"es":"en"):un(B,u?"es":"en"),[m,f]=useState(false),[v,b]=useState(false),[w,h]=useState(null),x=useRef(null),y=e.timeLoggedMinutes||0,k=e.effortMinutes||0,M=e.soldEffortMinutes||0,H=Math.round(y/60*10)/10,E=Math.round(k/60*10)/10,N=k>0?y/k*100:0,D=N>100?Math.round((y-k)/60*10)/10:0,S=N>100?"#EF4444":"#00E5CC";useEffect(()=>{if(!v&&!w)return;let le=B=>{x.current&&!x.current.contains(B.target)&&(b(false),h(null));};return document.addEventListener("mousedown",le),()=>document.removeEventListener("mousedown",le)},[v,w]);let V=le=>{if(le.stopPropagation(),r&&!n&&!s){h("log");return}if(r||n||s){b(B=>!B),h(null);return}o&&o(e);},W=le=>{b(false),h(le);},R=async(le,B)=>{w==="log"&&r&&le?r(e,le,B):w==="estimate"&&n?n(e,le):w==="quoted"&&s&&s(e,le),h(null);},A=r||n||s||o,ve=[{mode:"log",icon:Clock,label:u?"Registrar tiempo":"Log time",show:!!r},{mode:"estimate",icon:Target,label:u?"Estimaci\xF3n":"Estimate",show:!!n},{mode:"quoted",icon:DollarSign,label:u?"T. Ofertado":"Quoted time",show:!!s}].filter(le=>le.show),q=w==="estimate"?k:w==="quoted"?M:void 0;return k===0&&y===0&&M===0?jsxs("div",{ref:x,className:"relative flex items-center gap-2",onClick:le=>le.stopPropagation(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(false),children:[jsx("span",{className:g("text-[11px] font-mono",t?"text-white/30":"text-gray-400"),children:"\u2014"}),m&&A&&jsx("button",{onClick:V,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:le=>{le.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",le.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:le=>{le.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",le.currentTarget.style.backgroundColor="transparent";},title:u?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:v&&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:ve.map(le=>jsxs("button",{onClick:B=>{B.stopPropagation(),W(le.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:B=>{B.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:B=>{B.target.style.background="transparent";},children:[jsx(le.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),le.label]},le.mode))})}),jsx(AnimatePresence,{children:w&&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(eo,{mode:w,locale:a,isDark:t,currentValue:q||void 0,onSave:R,onClose:()=>h(null)})})})})]}):jsxs("div",{ref:x,className:"relative flex items-center gap-2 w-full",onClick:le=>le.stopPropagation(),onMouseEnter:()=>f(true),onMouseLeave:()=>f(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 le=y===0,pe=(k>0?y/k: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:le?t?"#4B5563":"#9CA3AF":t?"#FFFFFF":"#111827"},children:d(H,y)}),k>0&&jsxs("span",{className:"font-mono",style:{fontSize:11,color:t?"rgba(255,255,255,0.3)":"#9CA3AF"},children:["/ ",d(E,k)]}),D>0&&jsxs("span",{className:"font-mono px-1.5 py-0.5 rounded",style:{fontSize:10,color:pe?"#EF4444":t?"rgba(255,255,255,0.5)":"#6B7280",backgroundColor:pe?"rgba(239,68,68,0.15)":"transparent"},children:["+",d(D,y-k)," ",u?"Excedido":"Over"]})]})})(),k>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(N,100)}%`,backgroundColor:S,borderRadius:2,transition:"width 0.3s"}})})]}),A&&jsx("button",{onClick:V,className:"flex-shrink-0 flex items-center justify-center w-7 h-7 rounded-md transition-all duration-150",style:{opacity:m?1:0,pointerEvents:m?"auto":"none",color:t?"rgba(255,255,255,0.35)":"#9CA3AF",backgroundColor:"transparent",border:"none"},onMouseEnter:le=>{le.currentTarget.style.color=t?"rgba(255,255,255,0.8)":"#374151",le.currentTarget.style.backgroundColor=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:le=>{le.currentTarget.style.color=t?"rgba(255,255,255,0.35)":"#9CA3AF",le.currentTarget.style.backgroundColor="transparent";},title:u?"+ Tiempo":"+ Time",children:jsx(Plus,{className:"w-3.5 h-3.5"})}),jsx(AnimatePresence,{children:v&&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:ve.map(le=>jsxs("button",{onClick:B=>{B.stopPropagation(),W(le.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:B=>{B.target.style.background=t?"rgba(255,255,255,0.06)":"#F3F4F6";},onMouseLeave:B=>{B.target.style.background="transparent";},children:[jsx(le.icon,{style:{width:12,height:12,flexShrink:0,opacity:.5}}),le.label]},le.mode))})}),jsx(AnimatePresence,{children:w&&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(eo,{mode:w,locale:a,isDark:t,currentValue:q||void 0,onSave:R,onClose:()=>h(null)})})})})]})}function KC(e){let t=new Map;function a(r){if(r.assignees)for(let n of r.assignees)n.name&&!t.has(n.name)&&t.set(n.name,n);if(r.subtasks)for(let n of r.subtasks)a(n);}return a(e),Array.from(t.values())}function qC(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 Vf({assignee:e,size:t=28,isDark:a}){let r=t===28?"w-7 h-7":t===24?"w-6 h-6":"w-5 h-5",n=t===28?"text-[10px]":"text-[9px]";return e.avatar?jsx("img",{src:e.avatar,alt:e.name,className:g(r,"rounded-full object-cover ring-1 flex-shrink-0",a?"ring-white/10":"ring-gray-200")}):jsx("div",{className:g(r,"rounded-full flex items-center justify-center font-bold text-white ring-1 flex-shrink-0",n,a?"ring-white/10":"ring-gray-200"),style:{backgroundColor:e.color||"#6B7280"},children:e.initials||ba(e.name)})}function Gf({task:e,isDark:t,locale:a="en"}){let r=a==="es",n=!!e.hasChildren,s=e.assignees?.[0],o=e.teamLoad;if(n){let u=KC(e);if(u.length===0)return null;let p=u.slice(0,3),d=u.length-3;return jsxs("div",{className:"flex items-center",children:[jsx("div",{className:"flex -space-x-2",children:p.map((m,f)=>jsx(Vf,{assignee:m,size:24,isDark:t},m.name+f))}),d>0&&jsxs("span",{className:g("ml-1 text-[10px] font-mono",t?"text-white/40":"text-gray-400"),title:u.slice(3).map(m=>m.name).join(", "),children:["+",d]})]})}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:r?"Sin asignar":"Unassigned"})]});let i=o?.percentage??0,c=!!o&&i>0,l=c?qC(i):null;return jsxs("div",{className:"flex flex-col gap-1",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Vf,{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})]}),c&&l&&jsxs("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-mono uppercase tracking-wide w-fit font-semibold",style:{backgroundColor:l.bg,color:l.text},children:[i,"% LOAD"]})]})}var YC={critical:"bg-[#FF2D20]/15 text-[#FF2D20]",warning:"bg-[#FFD60A]/15 text-[#FFD60A]",info:"bg-[#3B9EFF]/15 text-[#3B9EFF]"};function Kf({blockers:e,isDark:t,locale:a="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:a==="es"?"Ninguno":"None"}):jsx("div",{className:"flex items-center gap-1 flex-wrap",children:e.map((r,n)=>jsxs("span",{className:g("px-1.5 py-0.5 rounded text-[9px] font-mono uppercase tracking-wide whitespace-nowrap",YC[r.severity]),children:[r.type," #",r.id]},`${r.type}-${r.id}-${n}`))})}function d2(e){return ba(e)}function u2(e){let t=["blue","green","purple","pink","yellow","red","indigo","teal"],a=0;for(let r=0;r<e.length;r++)a=e.charCodeAt(r)+((a<<5)-a);return t[Math.abs(a)%t.length]??"blue"}function eb({state:e,onClose:t,isDark:a,locale:r,onTaskEdit:n,onTaskDuplicate:s,onTaskDelete:o,onTaskUpdate:i,onColumnHide:c,onColumnSort:l,availableUsers:u=[],onOpenTimeLog:p,onReportBlocker:d,onCopyTaskLink:m,onTaskMove:f,onTaskIndent:v,onTaskOutdent:b}){let w=useRef(null),h=r==="es"?Xf.es:Xf.en,[x,y]=useState({left:e.x,top:e.y});if(useLayoutEffect(()=>{y({left:e.x,top:e.y});let N=w.current;if(!N)return;let D=N.getBoundingClientRect(),S=8,V=e.x,W=e.y;e.y+D.height>window.innerHeight-S&&(W=Math.max(S,e.y-D.height)),e.x+D.width>window.innerWidth-S&&(V=Math.max(S,window.innerWidth-D.width-S)),(V!==e.x||W!==e.y)&&y({left:V,top:W});},[e.x,e.y,e.isOpen]),useEffect(()=>{let N=S=>{w.current&&!w.current.contains(S.target)&&t();},D=S=>{S.key==="Escape"&&t();};return document.addEventListener("mousedown",N),document.addEventListener("keydown",D),()=>{document.removeEventListener("mousedown",N),document.removeEventListener("keydown",D);}},[t]),!e.isOpen)return null;let k=()=>{if(!e.task)return [];let N=[];return n&&N.push({id:"edit",label:h.edit,icon:jsx(Edit3,{className:"w-4 h-4"}),onClick:()=>{n(e.task),t();}}),N.push({id:"sep1",label:"",icon:null,separator:true}),i&&(N.push({id:"status",label:h.changeStatus,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),submenu:[{id:"status-todo",label:h.todo,icon:jsx(Circle,{className:"w-4 h-4 text-gray-400"}),onClick:()=>{i({...e.task,status:"todo",progress:0}),t();}},{id:"status-in-progress",label:h.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4 text-[#00E5CC]"}),onClick:()=>{i({...e.task,status:"in-progress",progress:e.task.progress||50}),t();}},{id:"status-completed",label:h.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4 text-green-500"}),onClick:()=>{i({...e.task,status:"completed",progress:100}),t();}}]}),N.push({id:"priority",label:h.changePriority,icon:jsx(Flag,{className:"w-4 h-4"}),submenu:[{id:"priority-urgent",label:h.urgent,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-red-500"}),onClick:()=>{i({...e.task,priority:"urgent"}),t();}},{id:"priority-high",label:h.high,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-orange-500"}),onClick:()=>{i({...e.task,priority:"high"}),t();}},{id:"priority-medium",label:h.medium,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-500"}),onClick:()=>{i({...e.task,priority:"medium"}),t();}},{id:"priority-low",label:h.low,icon:jsx("div",{className:"w-3 h-3 rounded-full bg-[#00E5CC]"}),onClick:()=>{i({...e.task,priority:"low"}),t();}}]}),u.length>0&&N.push({id:"assign",label:h.assignUser,icon:jsx(Users,{className:"w-4 h-4"}),submenu:u.slice(0,5).map(D=>({id:`assign-${D.id}`,label:D.name,icon:jsx("div",{className:"w-5 h-5 rounded-full flex items-center justify-center text-[10px] text-white bg-[#00E5CC]",children:ba(D.name)}),onClick:()=>{let S=e.task.assignees||[],W=S.some(R=>R.name===D.name)?S.filter(R=>R.name!==D.name):[...S,{name:D.name,initials:d2(D.name),color:D.color||u2(D.name),avatar:D.avatarUrl}];i({...e.task,assignees:W}),t();}}))})),p&&N.push({id:"log-time",label:h.logTime,icon:jsx(Clock,{className:"w-4 h-4"}),onClick:()=>{p(e.task),t();}}),d&&N.push({id:"report-blocker",label:h.reportBlocker,icon:jsx(AlertTriangle,{className:"w-4 h-4"}),onClick:()=>{d(e.task),t();}}),m&&N.push({id:"copy-link",label:h.copyLink,icon:jsx(Link2,{className:"w-4 h-4"}),onClick:()=>{m(e.task),t();}}),N.push({id:"sep2",label:"",icon:null,separator:true}),s&&N.push({id:"duplicate",label:h.duplicate,icon:jsx(Copy,{className:"w-4 h-4"}),onClick:()=>{s(e.task),t();}}),(f||v||b)&&(N.push({id:"sep3",label:"",icon:null,separator:true}),f&&(N.push({id:"move-up",label:h.moveUp,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"up"),t();}}),N.push({id:"move-down",label:h.moveDown,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{f(e.task.id,"down"),t();}})),v&&N.push({id:"indent",label:h.indent,icon:jsx(ChevronRight,{className:"w-4 h-4"}),onClick:()=>{v(e.task.id),t();}}),b&&N.push({id:"outdent",label:h.outdent,icon:jsx(ArrowUp,{className:"w-4 h-4 -rotate-90"}),onClick:()=>{b(e.task.id),t();}})),o&&N.push({id:"delete",label:h.delete,icon:jsx(Trash2,{className:"w-4 h-4"}),danger:true,onClick:()=>{o(e.task.id),t();}}),N},M=()=>{if(!e.columnId)return [];let N=[];return l&&(N.push({id:"sort-asc",label:h.sortAsc,icon:jsx(ArrowUp,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"asc"),t();}}),N.push({id:"sort-desc",label:h.sortDesc,icon:jsx(ArrowDown,{className:"w-4 h-4"}),onClick:()=>{l(e.columnId,"desc"),t();}})),c&&e.columnId!=="name"&&(N.push({id:"sep-hide",label:"",icon:null,separator:true}),N.push({id:"hide",label:h.hideColumn,icon:jsx(EyeOff,{className:"w-4 h-4"}),onClick:()=>{c(e.columnId),t();}})),N},H=e.type==="task"?k():M(),E={position:"fixed",left:x.left,top:x.top,zIndex:9999};return jsx("div",{ref:w,style:E,className:g("py-1 rounded-lg shadow-xl border min-w-[180px]",a?"bg-[#0D0D0D] border-[#222]":"bg-white border-gray-200"),children:H.map(N=>N.separator?jsx("div",{className:g("my-1 h-px",a?"bg-white/[0.05]":"bg-gray-200")},N.id):N.submenu?jsx(p2,{item:N,isDark:a},N.id):jsxs("button",{onClick:N.onClick,className:g("w-full flex items-center gap-3 px-3 py-2 text-sm transition-colors",a?"hover:bg-white/[0.05]":"hover:bg-gray-100",N.danger?"text-red-500 hover:text-red-600":a?"text-white":"text-gray-700"),children:[jsx("span",{className:g(N.danger?"text-red-500":a?"text-white/60":"text-gray-400"),children:N.icon}),N.label]},N.id))})}function p2({item:e,isDark:t}){let[a,r]=useState(false),n=useRef();return jsxs("div",{className:"relative",onMouseEnter:()=>{n.current&&clearTimeout(n.current),r(true);},onMouseLeave:()=>{n.current=setTimeout(()=>r(false),150);},children:[jsxs("button",{className: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")})]}),a&&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(i=>jsxs("button",{onClick:i.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:i.icon}),i.label]},i.id))})]})}var Xf={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:"Por hacer",inProgress:"En progreso",completed:"Completada",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 cb={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"}),costBar: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"})},E2=["name","status","priority","startDate","endDate","progress","tags","effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"];function ub({isOpen:e,onClose:t,columns:a,customFields:r=[],onColumnsChange:n,onCreateCustomField:s,mostrarColumnasDensas:o=true,isDark:i,locale:c}){let[l,u]=useState(""),[p,d]=useState(null),[m,f]=useState(null),v=useRef(null),b=c==="es"?db.es:db.en;useLayoutEffect(()=>{if(!e||!v.current)return;let N=()=>{if(!v.current)return;let D=v.current.parentElement;if(D){let R=D.getBoundingClientRect();f({top:R.bottom+4,right:window.innerWidth-R.right});}let S=v.current.getBoundingClientRect(),W=window.innerHeight-S.top-20;d(Math.max(300,W));};return requestAnimationFrame(N),window.addEventListener("resize",N),()=>window.removeEventListener("resize",N)},[e]),useEffect(()=>{if(!e)return;let N=setTimeout(()=>{let D=V=>{v.current&&!v.current.contains(V.target)&&t();},S=V=>{V.key==="Escape"&&t();};document.addEventListener("mousedown",D),document.addEventListener("keydown",S),v._cleanup=()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",S);};},100);return ()=>{clearTimeout(N),v._cleanup&&v._cleanup();}},[e,t]);let w=useMemo(()=>{let N=new Set([...E2]);return a.forEach(D=>{D.type&&D.type!=="assignees"&&N.add(D.type);}),Array.from(N)},[a]);if(!e)return null;let h=N=>{let D=b.columns[N];if(D)return D;let S=a.find(V=>V.type===N);return S?.label?S.label:N},x=N=>{if(N==="name")return;let D=a.map(S=>S.id===N?{...S,visible:!S.visible}:S);n(D);},y=(N,D)=>{let S=a.find(W=>W.type===N&&(!D||W.customFieldId===D));if(S){x(S.id);return}let V={id:D||N,type:N,label:D?r.find(W=>W.id===D)?.name||N:h(N),width:120,visible:true,sortable:true,resizable:true,customFieldId:D};n([...a,V]);},k=["effortMinutes","timeLoggedMinutes","soldEffortMinutes","weight"],M=w.filter(N=>N!=="assignees"&&(o||!k.includes(N))&&h(N).toLowerCase().includes(l.toLowerCase())),H=r.filter(N=>N.name.toLowerCase().includes(l.toLowerCase())),E=i?"#00E5FF":"#00E5CC";return jsxs("div",{ref:v,style:{...p?{maxHeight:`${p}px`}:{},...m?{top:m.top,right:m.right}:{},background:i?"#111114":"#FFFFFF",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.08)"}`,boxShadow:i?"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 ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`},children:[jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.08em",color:i?"rgba(255,255,255,0.4)":"rgba(0,0,0,0.35)",fontFamily:"JetBrains Mono, monospace"},children:b.title.toUpperCase()}),jsx("button",{onClick:t,className:"w-6 h-6 rounded-md flex items-center justify-center transition-colors",style:{color:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},onMouseEnter:N=>{N.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.05)",N.currentTarget.style.color=i?"rgba(255,255,255,0.7)":"rgba(0,0,0,0.6)";},onMouseLeave:N=>{N.currentTarget.style.backgroundColor="transparent",N.currentTarget.style.color=i?"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:i?"rgba(255,255,255,0.2)":"rgba(0,0,0,0.25)"}}),jsx("input",{type:"text",value:l,onChange:N=>u(N.target.value),placeholder:b.searchPlaceholder,style:{fontSize:12,background:i?"rgba(255,255,255,0.04)":"rgba(0,0,0,0.03)",border:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,color:i?"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:N=>{N&&N.style.setProperty("--focus-border",E);},onFocus:N=>{N.currentTarget.style.borderColor=E,N.currentTarget.style.background=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.04)";},onBlur:N=>{N.currentTarget.style.borderColor=i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",N.currentTarget.style.background=i?"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:N=>N.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:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace"},children:b.standardFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:M.map(N=>{let D=a.find(W=>W.type===N&&!W.customFieldId),S=D?.visible??false,V=N==="name";return jsxs("button",{onClick:()=>{V||(D?x(D.id):y(N));},disabled:V,className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",style:{opacity:V?.4:1,cursor:V?"not-allowed":"pointer"},onMouseEnter:W=>{V||(W.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)");},onMouseLeave:W=>{W.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?E:"transparent",border:S?`1.5px solid ${E}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${E}40`:"none"},children:S&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:S?E:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cb[N]}),jsx("span",{className:"truncate",style:{fontSize:12,fontWeight:S?500:400,color:S?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)",maxWidth:"160px"},title:h(N),children:h(N)})]},N)})})]}),H.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:i?"rgba(255,255,255,0.25)":"rgba(0,0,0,0.3)",fontFamily:"JetBrains Mono, monospace",borderTop:`1px solid ${i?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)"}`,paddingTop:8,marginTop:4},children:b.customFields.toUpperCase()}),jsx("div",{className:"space-y-px",children:H.map(N=>{let S=a.find(V=>V.customFieldId===N.id)?.visible??false;return jsxs("button",{onClick:()=>y(N.type,N.id),className:"w-full flex items-center gap-2.5 px-2 py-[5px] rounded-md transition-colors",onMouseEnter:V=>{V.currentTarget.style.backgroundColor=i?"rgba(255,255,255,0.05)":"rgba(0,0,0,0.04)";},onMouseLeave:V=>{V.currentTarget.style.backgroundColor="transparent";},children:[jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0 transition-all",style:{background:S?E:"transparent",border:S?`1.5px solid ${E}`:`1.5px solid ${i?"rgba(255,255,255,0.15)":"rgba(0,0,0,0.15)"}`,boxShadow:S?`0 0 6px ${E}40`:"none"},children:S&&jsx(Check,{className:"w-2.5 h-2.5 text-white",strokeWidth:3})}),jsx("span",{className:"flex-shrink-0 [&>svg]:w-3.5 [&>svg]:h-3.5",style:{color:S?E:i?"rgba(255,255,255,0.3)":"rgba(0,0,0,0.3)"},children:cb[N.type]||jsx(Type,{className:"w-4 h-4"})}),jsx("span",{style:{fontSize:12,fontWeight:S?500:400,color:S?i?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.85)":i?"rgba(255,255,255,0.55)":"rgba(0,0,0,0.5)"},children:N.name})]},N.id)})})]})]})]})}var db={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 $2=[{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 gb({isOpen:e,onClose:t,onSave:a,isDark:r,locale:n}){let[s,o]=useState(""),[i,c]=useState("text"),[l,u]=useState([""]),p=n==="es"?mb.es:mb.en;useEffect(()=>{e&&(o(""),c("text"),u([""]));},[e]),useEffect(()=>{let b=w=>{w.key==="Escape"&&t();};return e&&document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[e,t]);let d=()=>{if(!s.trim())return;let b={name:s.trim(),type:i};i==="dropdown"&&(b.options=l.filter(w=>w.trim())),a(b),t();},m=()=>{u([...l,""]);},f=(b,w)=>{let h=[...l];h[b]=w,u(h);},v=b=>{l.length>1&&u(l.filter((w,h)=>h!==b));};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",r?"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",r?"border-[#222]":"border-gray-200"),children:[jsx("h2",{className:g("text-lg font-semibold",r?"text-white":"text-gray-900"),children:p.title}),jsx("button",{onClick:t,className:g("p-1 rounded",r?"hover:bg-white/[0.05]":"hover:bg-gray-100"),children:jsx(X,{className:g("w-5 h-5",r?"text-white/60":"text-gray-400")})})]}),jsxs("div",{className:"p-6 space-y-6",children:[jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldName}),jsx("input",{type:"text",value:s,onChange:b=>o(b.target.value),placeholder:p.fieldNamePlaceholder,className:g("w-full px-4 py-2.5 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400"),autoFocus:true})]}),jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.fieldType}),jsx("div",{className:"grid grid-cols-5 gap-2",children:$2.map(b=>jsxs("button",{onClick:()=>c(b.type),className:g("flex flex-col items-center gap-1 p-3 rounded-lg border transition-colors",i===b.type?"border-[#00E5CC] bg-[#00E5CC]/10":r?"border-[#222] hover:border-white/20":"border-gray-200 hover:border-gray-300"),children:[jsx("span",{className:i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-400",children:b.icon}),jsx("span",{className:g("text-xs",i===b.type?"text-[#00E5CC]":r?"text-white/60":"text-gray-500"),children:p.types[b.type]})]},b.type))})]}),i==="dropdown"&&jsxs("div",{children:[jsx("label",{className:g("block text-sm font-medium mb-2",r?"text-white":"text-gray-900"),children:p.options}),jsxs("div",{className:"space-y-2",children:[l.map((b,w)=>jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{type:"text",value:b,onChange:h=>f(w,h.target.value),placeholder:`${p.option} ${w+1}`,className:g("flex-1 px-3 py-2 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",r?"bg-white/[0.03] border-[#222] text-white placeholder:text-white/30":"bg-gray-50 border-gray-200 text-gray-900 placeholder:text-gray-400")}),l.length>1&&jsx("button",{onClick:()=>v(w),className:g("p-2 rounded-lg transition-colors",r?"hover:bg-white/[0.05] text-white/60":"hover:bg-gray-100 text-gray-400"),children:jsx(Trash2,{className:"w-4 h-4"})})]},w)),jsxs("button",{onClick:m,className:g("flex items-center gap-2 px-3 py-2 text-sm rounded-lg transition-colors",r?"text-[#00E5CC] hover:bg-white/[0.05]":"text-[#00C4AE] hover:bg-gray-100"),children:[jsx(Plus,{className:"w-4 h-4"}),p.addOption]})]})]})]}),jsxs("div",{className:g("flex items-center justify-end gap-3 px-6 py-4 border-t",r?"border-[#222]":"border-gray-200"),children:[jsx("button",{onClick:t,className:g("px-4 py-2 text-sm font-medium rounded-lg transition-colors",r?"text-white/60 hover:bg-white/[0.05]":"text-gray-600 hover:bg-gray-100"),children:p.cancel}),jsx("button",{onClick:d,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:p.create})]})]})]}):null}var mb={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 hb={en:{filters:"Filters",filterByStatus:"FILTER BY STATUS",showAll:"Show All",completed:"Completed",inProgress:"In Progress",toDo:"To do",hideCompleted:"Hide Completed Tasks"},es:{filters:"Filtros",filterByStatus:"FILTRAR POR ESTADO",showAll:"Mostrar Todo",completed:"Completadas",inProgress:"En progreso",toDo:"Por hacer",hideCompleted:"Ocultar Tareas Completadas"}};function yb({value:e,hideCompleted:t,onChange:a,onHideCompletedChange:r,isDark:n,locale:s}){let[o,i]=useState(false),c=useRef(null),l=useRef(0),u=s==="es"?hb.es:hb.en;useEffect(()=>{if(!o)return;let m=v=>{Date.now()-l.current<100||c.current&&!c.current.contains(v.target)&&i(false);},f=v=>{v.key==="Escape"&&i(false);};return document.addEventListener("mousedown",m),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f);}},[o]);let p=[{value:"all",label:u.showAll,icon:jsx("div",{className:"w-4 h-4 rounded-full border-2 border-[#00E5CC] bg-[#00E5CC]"}),color:"text-[#00E5CC]"},{value:"completed",label:u.completed,icon:jsx(CheckCircle2,{className:"w-4 h-4"}),color:"text-green-500"},{value:"in-progress",label:u.inProgress,icon:jsx(PlayCircle,{className:"w-4 h-4"}),color:"text-[#00E5CC]"},{value:"todo",label:u.toDo,icon:jsx(Circle,{className:"w-4 h-4"}),color:"text-gray-400"}],d=e!=="all"||t;return jsxs("div",{ref:c,className:"relative",children:[jsxs("button",{onClick:m=>{m.stopPropagation(),o||(l.current=Date.now()),i(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",d&&(n?"bg-[#00E5CC]/20 border-[#00E5CC]/50 text-[#00E5CC]":"bg-[#00E5CC]/15 border-[#00E5CC]/15 text-[#00C4AE]"),o&&(n?"bg-white/[0.05]":"bg-gray-100")),style:{fontFamily:"Inter, sans-serif"},children:[jsx(Filter,{className:"w-4 h-4"}),u.filters,d&&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:u.filterByStatus})}),jsx("div",{className:"py-2",children:p.map(m=>{let f=e===m.value&&!t,v=()=>m.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"}):m.icon;return jsxs("button",{onClick:()=>{a(m.value),r(false),i(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?m.color:"text-gray-400","flex-shrink-0"),children:v()}),jsx("span",{className:g("flex-1 text-left whitespace-nowrap",n?"text-white":"text-gray-900"),children:m.label}),f&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]},m.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 m=!t;r(m),m&&a("all"),i(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:u.hideCompleted}),t&&jsx(Check,{className:g("w-4 h-4 flex-shrink-0","text-[#00E5CC]")})]})})]})]})}function xb({data:e,isDark:t,locale:a="en",onClose:r,lens:n="hours",onUnassignedTaskClick:s,currencyCode:o}){let i=a==="es",c=n==="financial",l=i?"es":"en",u=m=>un(m<=0?0:m,l),p=m=>Qa(Math.round(m),o,l),d=m=>Wr(m,l);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?i?"SALUD FINANCIERA":"FINANCIAL HEALTH":i?"SALUD DEL PROYECTO":"PROJECT HEALTH"}),r&&jsx("button",{onClick:r,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:i?"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 m=e.totalOffered??0,f=e.totalEstimated??0,v=e.totalExecuted??0,b=m-v,w=m>0?Math.round(b/m*100):0,h=m-f,x=m>0?Math.round(h/m*100):0,y=m>0?Math.min(Math.round(v/m*100),120):0,k=v>m&&m>0,M=k?"#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:i?"PRESUPUESTO":"BUDGET"}),e.avisoRevisar&&jsxs("div",{"data-revisar":true,className:"mb-3 rounded-md px-2 py-1.5 text-[11px] leading-snug",style:{color:"#D97706",background:"rgba(245,158,11,0.12)",border:"1px solid rgba(245,158,11,0.35)"},children:[jsxs("span",{className:"font-semibold",children:["\u26A0 ",i?"revisar":"check"]})," \xB7 ",jsx("span",{className:t?"text-white/70":"text-gray-700",children:e.avisoRevisar})]}),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:i?"V. Oferta":"Offered Value"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:p(m)})]}),(()=>{let H=e.totalEstimatedLabor??0,E=e.totalEstimatedEquipment??0,N=e.totalEstimatedTravel??0,D=E>0||N>0,S=(V,W)=>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:V}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:p(W)})]});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:i?"Estimado":"Estimated"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:p(f)})]}),D&&jsxs(Fragment,{children:[S(i?"Mano de obra":"Labor",H),E>0&&S(i?"Activos":"Equipment",E),N>0&&S(i?"Vi\xE1ticos":"Travel",N)]})]})})(),v>0&&(()=>{let H=e.totalExecutedLabor??0,E=e.totalExecutedEquipment??0,N=e.totalExecutedTravel??0,D=E>0||N>0,S=(V,W)=>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:V}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/55":"text-gray-500"),children:p(W)})]});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:i?"Ejecutado":"Executed"}),jsx("span",{className:g("text-[11px] font-mono font-bold",k?"text-[#F87171]":t?"text-white/80":"text-gray-800"),children:p(v)})]}),D&&jsxs(Fragment,{children:[S(i?"Mano de obra":"Labor",H),E>0&&S(i?"Activos":"Equipment",E),N>0&&S(i?"Vi\xE1ticos":"Travel",N)]})]})})(),m>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(y,100)}%`,backgroundColor:M}})}),f>0&&jsxs("div",{className:g("mt-2 px-3 py-2 rounded-lg text-center font-mono font-bold",h>=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:i?"Margen (Ofertado \u2212 Estimado)":"Margin (Offered \u2212 Estimated)"}),jsxs("div",{className:"text-base",children:[h>=0?"+":"",p(h),m>0&&jsxs("span",{className:"text-[11px] ml-1 opacity-70",children:["(",h>=0?"+":"",d(x),")"]})]}),jsx("div",{className:"text-[9px] opacity-50 mt-0.5 font-sans",children:i?"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:[b>=0?`+${p(b)} ${i?"disponible (caja)":"available (cash)"}`:`${p(Math.abs(b))} ${i?"sobregirado":"overdrawn"}`,m>0&&jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",d(w),")"]})]})]})]})})(),(e.totalHoursSpentMinutes!==void 0||e.totalHoursAllocatedMinutes!==void 0)&&(()=>{let m=e.totalHoursSpentMinutes??0,f=e.totalHoursAllocatedMinutes??0,v=f>0?Math.min(Math.round(m/f*100),100):0,h=(f>0?m/f:0)>1.1?"#F87171":v>=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:i?"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:i?"Usado":"Spent"}),jsx("span",{className:g("text-[11px] font-mono font-bold",t?"text-white/80":"text-gray-800"),children:u(m)})]}),jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{className:g("text-xs",t?"text-white/60":"text-gray-600"),children:i?"Asignado":"Allocated"}),jsx("span",{className:g("text-[11px] font-mono",t?"text-white/60":"text-gray-600"),children:u(f)})]}),f>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:`${v}%`,backgroundColor:h}})})]})]})})(),(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:i?"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:i?"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:i?"Aprobaci\xF3n Submittals":"Submittals Approval"}),jsx("span",{className:g("text-[11px] font-mono font-bold",e.submittalsApprovalPercent>=80?"text-[#3BF06E]":"text-[#FFD60A]"),children:d(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:i?"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?i?"tarea pendiente":"pending task":i?"tareas pendientes":"pending tasks"}),jsx("p",{className:g("text-[10px]",t?"text-white/40":"text-gray-400"),children:i?"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(m=>jsxs("button",{onClick:()=>s?.(m.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:m.name})]},m.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:i?"VARIACI\xD3N DE CRONOGRAMA":"SCHEDULE VARIANCE"}),(()=>{let m=e.scheduleVarianceDays??0,f=m>0,v=m<0,b=e.scheduleVarianceLabel||(f?`+${m} ${i?"D\xEDas ADELANTE":"Days AHEAD"}`:v?`${m} ${i?"D\xEDas ATR\xC1S":"Days BEHIND"}`:i?"EN TIEMPO":"ON TRACK");return jsx("div",{className:g("px-3 py-2 rounded-lg text-center font-mono text-sm font-bold",f&&"bg-[#3BF06E]/15 text-[#3BF06E]",v&&"bg-[#F87171]/15 text-[#F87171]",!f&&!v&&"bg-[#3B9EFF]/15 text-[#3B9EFF]"),children:b})})()]}),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:i?"DISPONIBILIDAD DEL EQUIPO":"TEAM AVAILABILITY"}),jsx("div",{className:"space-y-3",children:e.teams.map((m,f)=>{let v=m.utilizationPercent>=100?"#F87171":m.utilizationPercent>=80?"#FFD60A":m.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:m.name}),jsx("span",{className:g("text-[10px] font-mono",t?"text-white/40":"text-gray-500"),children:d(m.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(m.utilizationPercent,100)}%`,backgroundColor:v}})})]},`${m.name}-${f}`)})})]})]})}var Z2=[{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 Tb(e,t=0,a=[]){let r=[];for(let n of e){let s=[...a,n.id];r.push({...n,level:t,hasChildren:(n.subtasks?.length||0)>0,parentPath:s}),n.subtasks?.length&&n.isExpanded!==false&&r.push(...Tb(n.subtasks,t+1,s));}return r}function e5(e){let t=e.subtasks;if(!t?.length)return null;let a=new Date,r=0,n=0;for(let s of t){if(!s.startDate||!s.endDate)continue;let o=s.startDate.getTime(),c=s.endDate.getTime()-o;if(c<=0)continue;let u=Math.max(0,Math.min(a.getTime()-o,c))/c*100;if(u<=0)continue;let p=(s.progress||0)/u;r+=p,n++;}return n>0?r/n:null}function li(e){if(!e.subtasks?.length)return {spent:0,allocated:0,quoted:0};let t=0,a=0,r=0;for(let n of e.subtasks)if(n.subtasks?.length){let s=li(n);t+=s.spent>0?s.spent:n.timeLoggedMinutes??0,a+=s.allocated>0?s.allocated:n.effortMinutes??0,r+=s.quoted>0?s.quoted:n.soldEffortMinutes??0;}else t+=n.timeLoggedMinutes??0,a+=n.effortMinutes??0,r+=n.soldEffortMinutes??0;return {spent:t,allocated:a,quoted:r}}function ii(e,t="en"){return e<=0?un(0,t):un(e,t)}function Oc(e,t,a,r){return `${r?"+":""}${Qa(e,t,a,{compacto:true})}`}function t5({value:e,onChange:t,isDark:a,idioma:r="en"}){let[n,s]=useState(false),[o,i]=useState(String(e||""));return n?jsx("input",{autoFocus:true,type:"text",inputMode:"decimal",value:o,onClick:c=>c.stopPropagation(),onChange:c=>i(c.target.value.replace(/[^0-9.]/g,"")),onBlur:()=>{let c=parseFloat(o);!isNaN(c)&&c>=0&&c<=100?t(c):o===""&&t(0),s(false);},onKeyDown:c=>{c.key==="Enter"&&c.target.blur(),c.key==="Escape"&&(i(String(e||"")),s(false));},className:g("w-14 text-xs text-right font-mono px-1 py-0.5 rounded border outline-none",a?"bg-white/5 border-[#00E5CC]/50 text-white":"bg-gray-50 border-[#00E5CC] text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"}}):jsx("button",{onClick:c=>{c.stopPropagation(),i(String(e||"")),s(true);},className:g("text-xs font-mono cursor-pointer hover:underline",e>0?a?"text-white/80":"text-gray-700":a?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:e>0?Wr(e,r,2):"\u2014"})}function Db({tasks:e,config:t={},callbacks:a={},isLoading:r=false,error:n,className:s,style:o,availableUsers:i=[],customFields:c=[],toolbarRightContent:l,onColumnHeaderClick:u,columnsWithFilter:p,filterDotColor:d="#00E5CC"}){let{theme:m="dark",locale:f="en",customTranslations:v,showSearch:b=true,showHierarchy:w=true,tableColumns:h,mostrarIndicadoresFinancieros:x=true,mostrarColumnasDensas:y=true,allowColumnCustomization:k=true,allowColumnResize:M=true,enableContextMenu:H=true,showCreateTaskButton:E=false,onCreateTask:N,persistFilter:D=false,financialBlur:S,healthSidebar:V,lens:W="hours",hourlyRate:R=0,rateMap:A,aggregateParentHours:ve=false,showProjectTotals:q=false,totalsDollarOverride:le,currencyCode:B}=t,pe=f==="es"?"es":"en",nt=t.rowDensity==="compact",Ue=Dc(f,v),$=m==="dark",fe=C=>{if(!A||!C.assignees||C.assignees.length===0)return R;let Q=0,ee=0;for(let ge of C.assignees){let Ge=ge.id?A[ge.id]:void 0;if(Ge==null||Ge<=0)continue;let ne=typeof ge.estimatedMinutes=="number"?ge.estimatedMinutes:0;ne>0&&(Q+=Ge*ne,ee+=ne);}if(ee>0)return Q/ee;let oe=C.assignees.map(ge=>ge.id?A[ge.id]:void 0).filter(ge=>ge!=null&&ge>0);return oe.length===0?R:oe.reduce((ge,Ge)=>ge+Ge,0)/oe.length},ie=C=>{let Q=0,ee=0,oe=0,ge=Ge=>{for(let ne of Ge)if(ne.subtasks&&ne.subtasks.length>0){let Me={s:Q,a:ee,q:oe};if(ge(ne.subtasks),Q-Me.s+(ee-Me.a)+(oe-Me.q)===0){let He=fe(ne);Q+=(ne.timeLoggedMinutes??0)/60*He,ee+=(ne.effortMinutes??0)/60*He,oe+=(ne.soldEffortMinutes??0)/60*He;}}else {let Me=fe(ne);Q+=(ne.timeLoggedMinutes??0)/60*Me,ee+=(ne.effortMinutes??0)/60*Me,oe+=(ne.soldEffortMinutes??0)/60*Me;}};return C.subtasks&&ge(C.subtasks),{dollarSpent:Q,dollarAllocated:ee,dollarQuoted:oe}},et=useCallback(()=>{if(!D||typeof window>"u")return {statusFilter:"all",hideCompleted:false};try{let C=localStorage.getItem(D);if(C){let Q=JSON.parse(C);return {statusFilter:Q.statusFilter||"all",hideCompleted:Q.hideCompleted||!1}}}catch(C){console.error("Error loading persisted filter:",C);}return {statusFilter:"all",hideCompleted:false}},[D]),Xe=useMemo(()=>{function C(Q){let ee=0,oe=0,ge=0,Ge=0,ne=0,Me=0;for(let ze of Q)if(ze.subtasks&&ze.subtasks.length>0){let He=C(ze.subtasks);if(He.spent+He.allocated+He.quoted>0)ee+=He.spent,oe+=He.allocated,ge+=He.quoted,Ge+=He.dollarSpent,ne+=He.dollarAllocated,Me+=He.dollarQuoted;else {let bt=ze.timeLoggedMinutes??0,Nt=ze.effortMinutes??0,aa=ze.soldEffortMinutes??0;ee+=bt,oe+=Nt,ge+=aa;let ht=fe(ze);Ge+=bt/60*ht,ne+=Nt/60*ht,Me+=aa/60*ht;}}else {let He=ze.timeLoggedMinutes??0,Ft=ze.effortMinutes??0,bt=ze.soldEffortMinutes??0;ee+=He,oe+=Ft,ge+=bt;let Nt=fe(ze);Ge+=He/60*Nt,ne+=Ft/60*Nt,Me+=bt/60*Nt;}return {spent:ee,allocated:oe,quoted:ge,dollarSpent:Ge,dollarAllocated:ne,dollarQuoted:Me}}return C(e)},[e]),Qe=useMemo(()=>{let C=new Map;function Q(ee){let oe=0;for(let ge of ee)if(ge.subtasks&&ge.subtasks.length>0){let Ge=Q(ge.subtasks);C.set(ge.id,Ge),oe+=Ge;}else oe+=ge.weight||0;return oe}return Q(e),C},[e]),ct=useMemo(()=>!V?.enabled||!V.data?V:{...V,data:{...V.data,totalHoursSpentMinutes:Xe.spent,totalHoursAllocatedMinutes:Xe.allocated}},[V,Xe]),[Tt,_t]=useState(()=>typeof window>"u"||window.innerWidth>=1280),[tt,xt]=useState(null),[Jt,Wt]=useState("position"),[Qt,Y]=useState("asc"),[Le,Ye]=useState(""),[he,dt]=useState(()=>et().statusFilter),[wt,ue]=useState(()=>et().hideCompleted),[ce,Ae]=useState(h||Z2),[Et,Pe]=useState(false),[ut,O]=useState(false),[re,we]=useState({isOpen:false,x:0,y:0,type:"task"}),[ot,mt]=useState(null),[Ht,Zt]=useState(false),[Oe,Wa]=useState(null),[la,da]=useState(null),[ke,Te]=useState(null),gt=useRef(0),Ie=useRef(false),Lt=!!(a.onTaskMove||a.onTaskReparent),[I,te]=useState(null),[Re,Ee]=useState(null),_e=C=>{let Q=C.type;return C.customFieldId?Q==="file"?null:{kind:"customField",fieldId:C.customFieldId}:Q==="assignees"||Q==="teamLoad"?"assignees":Q==="startDate"?"startDate":Q==="endDate"?"endDate":null},it=(C,Q)=>typeof C=="string"||typeof Q=="string"?C===Q:C.fieldId===Q.fieldId,qe=useRef([]),Ze=useCallback((C,Q)=>{Lt&&(Q.preventDefault(),gt.current=Q.clientY,mt(C),Ie.current=false,Zt(false),Te({x:Q.clientX,y:Q.clientY}));},[Lt]),Ct=useCallback(C=>{if(!ot||(Math.abs(C.clientY-gt.current)>5&&!Ie.current&&(Ie.current=true,Zt(true)),Te({x:C.clientX,y:C.clientY}),!Ie.current))return;let ee=document.querySelectorAll("[data-listview-row]"),oe=null,ge=null;ee.forEach(Ge=>{let ne=Ge.getBoundingClientRect(),Me=Ge.getAttribute("data-listview-row");if(Me&&Me!==ot&&C.clientY>=ne.top&&C.clientY<=ne.bottom){oe=Me;let ze=C.clientY-ne.top,He=ne.height;ge=ze<He*.25?"above":ze>He*.75?"below":"child";}}),Wa(oe),da(ge);},[ot]),At=useCallback(()=>{if(Ie.current&&ot&&Oe&&la){if(la==="child"&&a.onTaskReparent)a.onTaskReparent(ot,Oe);else if(la==="above"||la==="below"){let C=(oe,ge,Ge=null)=>{for(let ne of oe){if(ne.id===ge)return Ge;if(ne.subtasks){let Me=C(ne.subtasks,ge,ne.id);if(Me!==void 0)return Me}}},Q=C(e,ot,null),ee=C(e,Oe,null);if(a.onTaskReparent){let oe=(He,Ft)=>{if(Ft===null)return He;for(let bt of He){if(bt.id===Ft)return bt.subtasks||[];if(bt.subtasks){let Nt=oe(bt.subtasks,Ft);if(Nt.length>0||bt.subtasks.some(aa=>aa.id===Ft))return Nt}}return []},ge=oe(e,ee??null),Ge=ge.findIndex(He=>He.id===Oe),ne=Q===ee,Me=ne?ge.findIndex(He=>He.id===ot):-1,ze=la==="below"?Ge+1:Ge;ne&&Me!==-1&&Me<Ge&&(ze-=1),a.onTaskReparent(ot,ee??null,Math.max(0,ze));}}}mt(null),Wa(null),da(null),Te(null),Ie.current=false,Zt(false);},[ot,Oe,la,e,a]),It=(C,Q)=>typeof Q!="string"?C.customFields?.find(oe=>oe.fieldId===Q.fieldId)?.value:Q==="assignees"?C.assignees:Q==="startDate"?C.startDate:C.endDate,Ke=(C,Q,ee,oe)=>{C.preventDefault(),C.stopPropagation(),document.body.style.cursor="crosshair",document.body.style.userSelect="none";let ge=Array.from(document.querySelectorAll("[data-listview-row]")),Ge=ge.map(Rt=>Rt.getAttribute("data-listview-row")||""),ne=Math.max(0,Ge.indexOf(Q)),Me=Rt=>Ge.slice(ne,Rt+1);Ee({sourceTaskId:Q,column:ee,sourceIndex:oe,targetIndex:oe,rangeIds:new Set([Q])});let He=(Rt=>{let Bt=Rt?.parentElement??null;for(;Bt;){let Ka=window.getComputedStyle(Bt).overflowY;if((Ka==="auto"||Ka==="scroll")&&Bt.scrollHeight>Bt.clientHeight)return Bt;Bt=Bt.parentElement;}let ua=document.scrollingElement;return ua&&ua.scrollHeight>ua.clientHeight?ua:null})(C.currentTarget),Ft=Rt=>{let Bt=ne,ua=false;ge.forEach((Ka,ln)=>{let Ir=Ka.getBoundingClientRect();Rt>=Ir.top&&Rt<=Ir.bottom&&(Bt=ln,ua=true);});let Ma=ge[ge.length-1];if(!ua&&Ma){let Ka=Ma.getBoundingClientRect();Rt>Ka.bottom&&(Bt=ge.length-1);}return Bt<ne&&(Bt=ne),Bt},bt=C.clientY,Nt=null,aa=()=>{Nt!==null&&(cancelAnimationFrame(Nt),Nt=null);},ht=()=>{let Rt=Ft(bt),Bt=new Set(Me(Rt));Ee(ua=>ua&&{...ua,targetIndex:Rt,rangeIds:Bt});},Ut=()=>{if(aa(),!He)return;let Rt=He,ua=Rt===document.scrollingElement?{top:0,bottom:window.innerHeight}:Rt.getBoundingClientRect(),Ma=60,Ka=12,ln=bt-ua.top,Ir=ua.bottom-bt,Pn=Rt.scrollHeight-Rt.clientHeight;if(Ir<Ma&&Rt.scrollTop<Pn){let yn=Math.max(1,Math.round(Ka*(1-Math.max(0,Ir)/Ma))),cn=()=>{Rt.scrollTop+=yn,ht(),Rt.scrollTop<Rt.scrollHeight-Rt.clientHeight&&(Nt=requestAnimationFrame(cn));};Nt=requestAnimationFrame(cn);}else if(ln<Ma&&Rt.scrollTop>0){let yn=Math.max(1,Math.round(Ka*(1-Math.max(0,ln)/Ma))),cn=()=>{Rt.scrollTop-=yn,ht(),Rt.scrollTop>0&&(Nt=requestAnimationFrame(cn));};Nt=requestAnimationFrame(cn);}},oa=Rt=>{bt=Rt.clientY,ht(),Ut();},ga=Rt=>{window.removeEventListener("mousemove",oa),window.removeEventListener("mouseup",ga),aa(),document.body.style.cursor="",document.body.style.userSelect="",Ee(null);let Bt=Ft(Rt.clientY),ua=new Map(qe.current.map(Ir=>[Ir.id,Ir])),Ma=ua.get(Q);if(!Ma)return;let Ka=It(Ma,ee),ln=[];for(let Ir of Me(Bt)){if(Ir===Q)continue;let Pn=ua.get(Ir);Pn&&(Pn.subtasks&&Pn.subtasks.length>0||ln.push(Ir));}ln.length>0&&a.onBulkFill?.(ln,ee,Ka);};window.addEventListener("mousemove",oa),window.addEventListener("mouseup",ga);},Fe=C=>Re?Re.rangeIds.has(C):false;useEffect(()=>{if(ot)return document.addEventListener("mousemove",Ct),document.addEventListener("mouseup",At),document.body.style.cursor="grabbing",document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",Ct),document.removeEventListener("mouseup",At),document.body.style.cursor="",document.body.style.userSelect="";}},[ot,Ct,At]);let[ft,_a]=useState("all"),[ma,ta]=useState(false),de=useRef(null),G=useRef(null),X=useMemo(()=>{let C=0;function Q(ee,oe){for(let ge of ee)oe>C&&(C=oe),ge.subtasks?.length&&Q(ge.subtasks,oe+1);}return Q(e,1),C},[e]);useEffect(()=>{if(!ma)return;let C=Q=>{de.current?.contains(Q.target)||G.current?.contains(Q.target)||ta(false);};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[ma]),useEffect(()=>{if(ft==="all"){let ee=function(oe){for(let ge of oe)ge.subtasks?.length&&(ge.isExpanded===false&&a.onTaskToggleExpand?.(ge.id),ee(ge.subtasks));};ee(e);}else {let ee=function(oe,ge){for(let Ge of oe)if(Ge.subtasks?.length){let ne=ge<ft,Me=Ge.isExpanded!==false;ne!==Me&&a.onTaskToggleExpand?.(Ge.id),ee(Ge.subtasks,ge+1);}};ee(e,1);}},[ft]);let[F,P]=useState(null),[z,j]=useState(0),[J,be]=useState(0),Be=useRef(null),[De,Ne]=useState(null),[lt,kt]=useState(null);useEffect(()=>{h&&Ae(C=>{if(C.length===h.length){let Q=true;for(let ee=0;ee<C.length;ee++){let oe=C[ee],ge=h[ee];if(!oe||!ge||oe.id!==ge.id||oe.visible!==ge.visible||oe.width!==ge.width||oe.label!==ge.label){Q=false;break}}if(Q)return C}return h});},[h]),useEffect(()=>{if(!(!D||typeof window>"u"))try{localStorage.setItem(D,JSON.stringify({statusFilter:he,hideCompleted:wt}));}catch(C){console.error("Error persisting filter state:",C);}},[D,he,wt]);let Se=useMemo(()=>{let C=new Set;function Q(ee){for(let oe of ee)oe.subtasks?.length&&(oe.isExpanded!==false&&C.add(oe.id),Q(oe.subtasks));}return Q(e),C},[e]),je=useMemo(()=>ce.filter(C=>C.visible),[ce]),xe=useCallback(C=>{a.onTaskToggleExpand?.(C);},[a]),Kt=useCallback(C=>{Jt===C?Y(Q=>Q==="asc"?"desc":"asc"):(Wt(C),Y("asc")),a.onSortChange?.({column:C,direction:Qt==="asc"?"desc":"asc"});},[Jt,Qt,a]),ca=useCallback(C=>{Ae(C),a.onColumnsChange?.(C);},[a]),pr=useCallback(C=>{let Q=ce.map(ee=>ee.id===C?{...ee,visible:false}:ee);ca(Q);},[ce,ca]),rr=useCallback((C,Q)=>{Wt(C),Y(Q);},[]),Fr=useCallback((C,Q,ee)=>{H&&(C.preventDefault(),we({isOpen:true,x:C.clientX,y:C.clientY,type:Q?"task":"header",task:Q,columnId:ee}));},[H]),Lr=useCallback(()=>{we(C=>({...C,isOpen:false}));},[]),jr=useCallback((C,Q)=>{if(!M)return;C.preventDefault(),C.stopPropagation();let ee=ce.find(oe=>oe.id===Q);ee&&(P(Q),j(C.clientX),be(ee.width));},[ce,M]);useEffect(()=>{if(!F)return;let C=ce,Q=oe=>{let ge=oe.clientX-z,Ge=Math.max(50,J+ge);C=C.map(ne=>ne.id===F?{...ne,width:Ge}:ne),Ae(C);},ee=()=>{a.onColumnsChange?.(C),P(null);};return document.addEventListener("mousemove",Q),document.addEventListener("mouseup",ee),()=>{document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",ee);}},[F,z,J,a]);let za=useCallback((C,Q)=>{if(Q==="name"){C.preventDefault();return}Ne(Q),C.dataTransfer.effectAllowed="move",C.dataTransfer.setData("text/plain",Q),C.currentTarget instanceof HTMLElement&&(C.currentTarget.style.opacity="0.5");},[]),Eo=useCallback(C=>{C.currentTarget instanceof HTMLElement&&(C.currentTarget.style.opacity="1"),Ne(null),kt(null);},[]),sn=useCallback((C,Q)=>{C.preventDefault(),Q!=="name"&&(C.dataTransfer.dropEffect="move",kt(Q));},[]),pi=useCallback(()=>{kt(null);},[]),fn=useCallback((C,Q)=>{if(C.preventDefault(),!De||De===Q||Q==="name")return;let ee=[...ce],oe=ee.findIndex(ne=>ne.id===De),ge=ee.findIndex(ne=>ne.id===Q);if(oe===-1||ge===-1)return;let Ge=ee.splice(oe,1);Ge[0]&&(ee.splice(ge,0,Ge[0]),ca(ee),Ne(null),kt(null));},[De,ce,ca]),mi=useCallback(async C=>{if(a.onCreateCustomField){let Q={...C,id:`cf_${Date.now()}`,projectId:""};await a.onCreateCustomField(Q);}O(false);},[a]),uo=useCallback(C=>C.progress===100||C.status==="completed"?"completed":C.progress&&C.progress>0||C.status==="in-progress"?"in-progress":"todo",[]),gi=t.groupBy==="status",Ba=t.groupStateKey?`listview-grupos-plegados:${t.groupStateKey}`:null,[Ar,ad]=useState(()=>{let C=new Set(t.defaultCollapsedGroups??["completed"]);if(!Ba)return C;try{let Q=localStorage.getItem(Ba);return Q?new Set(JSON.parse(Q)):C}catch{return C}}),fi=useCallback(C=>{ad(Q=>{let ee=new Set(Q);if(ee.has(C)?ee.delete(C):ee.add(C),Ba)try{localStorage.setItem(Ba,JSON.stringify([...ee]));}catch{}return ee});},[Ba]),bn=!!t.selectable,[bi,hn]=useState(new Set),Vr=useMemo(()=>t.selectedIds?new Set(t.selectedIds):bi,[t.selectedIds,bi]),Yn=useRef(null),{lista:po,cabeceras:As,todas:ml}=useMemo(()=>{let C=Tb(e);if(Le.trim()){let ee=Le.toLowerCase();C=C.filter(oe=>oe.name.toLowerCase().includes(ee));}let Q=t.showStatusFilter!==false;if(Q&&he!=="all"){let ee=new Set(C.filter(oe=>uo(oe)===he).flatMap(oe=>oe.parentPath));C=C.filter(oe=>ee.has(oe.id));}if(Q&&wt){let ee=new Set(C.filter(oe=>uo(oe)!=="completed").flatMap(oe=>oe.parentPath));C=C.filter(oe=>ee.has(oe.id));}if(t.groupBy==="assignee"||t.groupBy==="due"){let ee=t.groupBy==="assignee",oe=[],ge=(ht,Ut,oa,ga)=>{for(let Rt of ht){let Bt=[...oa,Rt.id];oe.push({...Rt,level:Ut,hasChildren:(Rt.subtasks?.length||0)>0,parentPath:Bt,...ga?{__padre:ga}:{}}),Rt.subtasks?.length&&ge(Rt.subtasks,Ut+1,Bt,Rt.name);}};ge(e,0,[]);let Ge=Le.trim().toLowerCase(),ne=Ge?oe.filter(ht=>ht.name.toLowerCase().includes(Ge)):oe,Me=f==="es",ze=[["overdue","Vencidas","Overdue"],["today","Hoy","Today"],["week","Esta semana","This week"],["later","M\xE1s adelante","Later"],["past","Anteriores","Earlier"],["none","Sin fecha","No date"]],He=new Map;for(let ht of ne){let Ut=ee?(()=>{let oa=(ht.assignees??[]).map(ga=>ga.name).filter(Boolean);return oa.length?oa:["__sin"]})():[t.dueBucket?.(ht)??"none"];for(let oa of Ut){let ga=ee?`user:${oa}`:`due:${oa}`,Rt=ee?oa==="__sin"?Me?"Sin responsable":"Unassigned":oa:ze.find(Bt=>Bt[0]===oa)?.[Me?1:2]??oa;He.has(ga)||He.set(ga,{titulo:Rt,filas:[]}),He.get(ga).filas.push({...ht,level:0,hasChildren:false,__claveFila:`${ga}|${ht.id}`});}}let Ft=ee?[...He.keys()].sort((ht,Ut)=>ht==="user:__sin"?1:Ut==="user:__sin"?-1:He.get(ht).titulo.localeCompare(He.get(Ut).titulo)):ze.map(ht=>`due:${ht[0]}`).filter(ht=>He.has(ht)),bt=ht=>ht.endDate?new Date(ht.endDate).getTime():1/0,Nt=[],aa=new Map;for(let ht of Ft){let Ut=He.get(ht),oa=Ar.has(ht);aa.set(Nt.length,[...aa.get(Nt.length)??[],{clave:ht,cuenta:Ut.filas.length,plegado:oa,titulo:Ut.titulo}]),oa||Nt.push(...Ut.filas.sort((ga,Rt)=>bt(ga)-bt(Rt)));}return {lista:Nt,cabeceras:aa,todas:ne}}if(gi){let ee=["todo","in-progress","completed"],oe=new Map,ge=[];for(let ze of C){let He=ze.parentPath[0]??ze.id;ze.level===0&&ge.push(ze),oe.has(He)||oe.set(He,[]),oe.get(He).push(ze);}let Ge=ze=>ze.endDate?new Date(ze.endDate).getTime():1/0,ne=[],Me=new Map;for(let ze of ee){let He=ge.filter(ht=>uo(ht)===ze).sort((ht,Ut)=>Ge(ht)-Ge(Ut)),Ft=He.flatMap(ht=>oe.get(ht.id)??[ht]),bt=Ft.filter(ht=>!ht.hasChildren).length;if(bt===0&&He.length===0)continue;let Nt=Ar.has(ze),aa=ne.length;Me.set(aa,[...Me.get(aa)??[],{clave:ze,cuenta:bt,plegado:Nt}]),Nt||ne.push(...Ft);}return {lista:ne,cabeceras:Me,todas:C}}return C.sort((ee,oe)=>{let ge,Ge;switch(Jt){case "name":ge=ee.name.toLowerCase(),Ge=oe.name.toLowerCase();break;case "startDate":ge=ee.startDate?.getTime()||0,Ge=oe.startDate?.getTime()||0;break;case "endDate":ge=ee.endDate?.getTime()||0,Ge=oe.endDate?.getTime()||0;break;case "progress":ge=ee.progress||0,Ge=oe.progress||0;break;case "status":ge=ee.status||"todo",Ge=oe.status||"todo";break;case "priority":let ne={urgent:0,high:1,medium:2,low:3,none:4};ge=ne[ee.priority]??4,Ge=ne[oe.priority]??4;break;case "position":return 0;default:return 0}return ge<Ge?Qt==="asc"?-1:1:ge>Ge?Qt==="asc"?1:-1:0}),{lista:C,cabeceras:new Map,todas:C}},[e,Le,he,wt,Jt,Qt,uo,t.showStatusFilter,gi,Ar,t.groupBy,t.dueBucket,f]);qe.current=po;let gl=(C,Q)=>{let ee=new Set(Vr),oe=Yn.current,ge=qe.current.map(Ge=>Ge.id);if(Q&&oe&&oe!==C&&ge.includes(oe)&&ge.includes(C)){let Ge=ge.indexOf(oe),ne=ge.indexOf(C),Me=Math.min(Ge,ne),ze=Math.max(Ge,ne),He=!Vr.has(C);for(let Ft of ge.slice(Me,ze+1))He?ee.add(Ft):ee.delete(Ft);}else ee.has(C)?ee.delete(C):ee.add(C);Yn.current=C,t.selectedIds||hn(ee),a.onSelectionChange?.([...ee]);},fl=Vr.size>0,bl=C=>jsx("div",{className:"w-6 flex-shrink-0 flex items-center justify-center",onClick:Q=>Q.stopPropagation(),children:jsx("input",{type:"checkbox","data-casilla-fila":C,"aria-label":f==="es"?"Seleccionar tarea":"Select task",checked:Vr.has(C),onChange:()=>{},onClick:Q=>{Q.stopPropagation(),gl(C,Q.shiftKey);},className:g("w-3.5 h-3.5 cursor-pointer transition-opacity",fl?"opacity-100":"opacity-0 group-hover:opacity-100 focus:opacity-100")})}),Xn={todo:{es:"Por hacer",en:"To do"},"in-progress":{es:"En progreso",en:"In progress"},completed:{es:"Completadas",en:"Completed"}},rs=(C,Q)=>{let ee=As.get(C);if(!ee?.length)return Q;let oe=ee.map(ge=>jsx("div",{"data-grupo-de-estado":ge.clave,"data-plegado":ge.plegado?"true":"false",className:g("flex items-center gap-2 px-4 h-9 border-b select-none",$?"border-[#222] bg-[#111]":"border-gray-200 bg-white"),children:jsxs("button",{type:"button",onClick:()=>fi(ge.clave),"aria-expanded":!ge.plegado,className:g("inline-flex items-center gap-1.5 text-[12px] font-semibold rounded px-1 -ml-1",$?"text-white/80 hover:bg-white/[0.05]":"text-gray-700 hover:bg-gray-100"),children:[ge.plegado?jsx(ChevronRight,{className:"w-3.5 h-3.5"}):jsx(ChevronDown,{className:"w-3.5 h-3.5"}),ge.titulo??Xn[ge.clave]?.[f==="es"?"es":"en"]??ge.clave,jsx("span",{className:g("font-normal tabular-nums",$?"text-white/40":"text-gray-400"),children:ge.cuenta})]})},`grupo-${ge.clave}`));return Q?[...oe,Q]:oe},mr=useCallback((C,Q)=>{let ee=Ge=>{a.onTaskUpdate?.({...C,...Ge});},oe=Ge=>Ge?C.customFields?.find(Me=>Me.fieldId===Ge)?.value:void 0,ge=(Ge,ne)=>{if(!Ge)return;let ze=[...C.customFields||[]],He=ze.findIndex(Ft=>Ft.fieldId===Ge);He>=0?ze[He]={fieldId:Ge,value:ne}:ze.push({fieldId:Ge,value:ne}),ee({customFields:ze});};switch(Q.type){case "name":return null;case "status":return jsx(pf,{value:C.status||(C.progress===100?"completed":C.progress&&C.progress>0?"in-progress":"todo"),onChange:ne=>{ee({status:ne,progress:ne==="completed"?100:ne==="in-progress"?50:0});},isDark:$,locale:f,translations:Ue.status});case "priority":return jsx(gf,{value:C.priority,onChange:ne=>ee({priority:ne}),isDark:$,locale:f});case "assignees":{let ne=C.hasChildren,Me=C.assignees||[];if(ne&&C.subtasks?.length){let ze=new Map,He=Ft=>{(Ft||[]).forEach(bt=>{(bt.assignees||[]).forEach(Nt=>{ze.has(Nt.name)||ze.set(Nt.name,Nt);}),bt.subtasks?.length&&He(bt.subtasks);});};He(C.subtasks),Me=Array.from(ze.values());}else ne&&(Me=[]);return jsx(Ec,{value:Me,availableUsers:i,onChange:ze=>ee({assignees:ze}),isDark:$,locale:f,disabled:ne})}case "startDate":return jsx(Pc,{value:C.startDate,onChange:ne=>ee({startDate:ne}),isDark:$,locale:f,dateField:"start",startDate:C.startDate,endDate:C.endDate,minDate:t.minTaskDate});case "endDate":{let ne=jsx(Pc,{value:C.endDate,onChange:Me=>ee({endDate:Me}),isDark:$,locale:f,dateField:"end",startDate:C.startDate,endDate:C.endDate,minDate:t.minTaskDate});return t.isTaskOverdue?.(C)?jsxs("span",{"data-vencida":"true",className:"inline-flex items-center gap-1",style:{color:$?"#FF7A7F":"#C22F35"},children:[jsx(AlertCircle,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":true}),ne]}):ne}case "progress":{let ne=!!(C.subtasks&&C.subtasks.length>0),Me=ne?ji(hs(C.subtasks||[])):C.progress||0;return jsx(Tf,{value:Me,onChange:ne?void 0:ze=>{let He=ze===100?"completed":ze>0?"in-progress":"todo";ee({progress:ze,status:He});},isDark:$,disabled:ne})}case "tags":return jsx(Wf,{value:C.tags||[],isDark:$});case "text":return jsx(Sf,{value:oe(Q.customFieldId)||"",onChange:ne=>ge(Q.customFieldId,ne),isDark:$});case "number":return jsx(Pf,{value:oe(Q.customFieldId)||0,onChange:ne=>ge(Q.customFieldId,ne),isDark:$});case "date":let Ge=oe(Q.customFieldId);return jsx(Pc,{value:Ge?new Date(Ge):void 0,onChange:ne=>ge(Q.customFieldId,ne),isDark:$,locale:f});case "dropdown":return jsx(Ff,{value:oe(Q.customFieldId)||"",options:Q.options||[],onChange:ne=>ge(Q.customFieldId,ne),isDark:$});case "checkbox":return jsx(Af,{value:oe(Q.customFieldId)||false,onChange:ne=>ge(Q.customFieldId,ne),isDark:$});case "multiselect":return jsx(If,{value:oe(Q.customFieldId)||[],options:Q.options||[],onChange:ne=>ge(Q.customFieldId,ne),isDark:$,maxSelectable:Q.maxSelectable});case "person":{let ne=oe(Q.customFieldId)||[];return jsx(Ec,{value:ne.map(Me=>({name:Me.name,avatar:Me.avatar,initials:Me.initials||ba(Me.name),color:Me.color||"#00E5CC"})),availableUsers:i,onChange:Me=>ge(Q.customFieldId,Me),isDark:$,locale:f})}case "file":return jsx($f,{value:oe(Q.customFieldId),isDark:$,onOpen:ne=>{ne.url&&window.open(ne.url,"_blank","noopener,noreferrer");}});case "estimatedTime":{let ne=C.status==="completed"||C.progress===100;return jsx(on,{value:C.estimatedTime,onChange:Me=>ee({estimatedTime:Me}),isDark:$,locale:f,disabled:ne,lens:W,hourlyRate:fe(C),currencyCode:B})}case "quotedTime":{let ne=C.status==="completed"||C.progress===100,Me=S?.enabled&&(!S.columns||S.columns.includes("quotedTime"));return jsx(on,{value:C.quotedTime,onChange:ze=>ee({quotedTime:ze}),isDark:$,locale:f,disabled:ne,isBlurred:Me,lens:W,hourlyRate:fe(C),currencyCode:B})}case "elapsedTime":{let ne=C.status==="completed"||C.progress===100,Me=C.executedDollarsCanonical;return jsx(on,{value:C.elapsedTime,onChange:ze=>ee({elapsedTime:ze}),isDark:$,locale:f,disabled:ne,lens:W,hourlyRate:fe(C),currencyCode:B,financialOverride:Me})}case "effortMinutes":{if(ve&&C.subtasks&&C.subtasks.length>0){let{allocated:Ft}=li(C);if(W==="financial"){let bt=ie(C),Nt=Math.round(bt.dollarAllocated),aa=Math.round(bt.dollarQuoted),ht=aa-Nt;return jsxs("div",{className:"flex flex-col",children:[Nt>0?jsx("span",{className:g("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:Qa(Nt,B,pe)}):null,ht!==0&&Nt>0&&aa>0&&jsx("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",ht>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:Oc(ht,B,pe,ht>0)})]})}return jsx(on,{value:Ft>0?Ft:void 0,isDark:$,locale:f,disabled:true,lens:W,hourlyRate:R,currencyCode:B})}let ne=C.status==="completed"||C.progress===100,Me=C.effortMinutes||0,ze=C.soldEffortMinutes||0,He=fe(C);if(W==="financial"&&He&&Me>0&&ze>0){let Ft=Math.round(Me/60*He),Nt=Math.round(ze/60*He)-Ft;return jsxs("div",{className:"flex flex-col",children:[jsx(on,{value:Me,onChange:aa=>ee({effortMinutes:aa}),isDark:$,locale:f,disabled:ne,lens:W,hourlyRate:fe(C),currencyCode:B}),Nt!==0&&jsx("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Nt>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:Oc(Nt,B,pe,Nt>0)})]})}return jsx(on,{value:Me,onChange:Ft=>ee({effortMinutes:Ft}),isDark:$,locale:f,disabled:ne,lens:W,hourlyRate:fe(C),currencyCode:B})}case "timeLoggedMinutes":{let ne=C.executedDollarsCanonical;if(ve&&C.subtasks&&C.subtasks.length>0){let{spent:ze}=li(C);return jsx(on,{value:ze>0?ze:void 0,isDark:$,locale:f,disabled:true,lens:W,hourlyRate:fe(C),currencyCode:B,financialOverride:ne})}let Me=C.status==="completed"||C.progress===100;return jsx(on,{value:C.timeLoggedMinutes,onChange:a.onLogTime?ze=>{a.onLogTime?.(C,ze);}:void 0,isDark:$,locale:f,placeholder:f==="es"?"Agregar":"Add",disabled:Me,lens:W,hourlyRate:fe(C),currencyCode:B,financialOverride:ne})}case "soldEffortMinutes":{if(ve&&C.subtasks&&C.subtasks.length>0){let{quoted:ze}=li(C),He=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(on,{value:ze>0?ze:void 0,isDark:$,locale:f,disabled:true,isBlurred:He,lens:W,hourlyRate:fe(C),currencyCode:B})}let ne=C.status==="completed"||C.progress===100,Me=S?.enabled&&(!S.columns||S.columns.includes("soldEffortMinutes"));return jsx(on,{value:C.soldEffortMinutes,onChange:ze=>ee({soldEffortMinutes:ze}),isDark:$,locale:f,disabled:ne,isBlurred:Me,lens:W,hourlyRate:fe(C),currencyCode:B})}case "scheduleVariance":{let ne=C.effortMinutes||0,Me=C.soldEffortMinutes||0,ze=C.timeLoggedMinutes||0,He=ne>0||Me>0||ze>0;return jsx(Uf,{startDate:C.startDate,endDate:C.endDate,scheduleVariance:C.scheduleVariance,isDark:$,locale:f,hasTimeAllocated:He,sinEmpezar:(C.progress??0)===0&&C.status!=="completed"})}case "hoursBar":{if(ve&&C.hasChildren){let{spent:ne,allocated:Me,quoted:ze}=li(C),He=ne>Me&&Me>0;return jsxs("span",{className:g("text-[11px] font-mono flex items-center gap-1.5",$?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",He?"text-[#FF453A]":$?"text-white/80":"text-gray-800"),children:ii(ne,pe)}),Me>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-white/60":"text-gray-600",children:ii(Me,pe)})]}),ze>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-amber-400/70":"text-amber-600",children:ii(ze,pe)})]})]})}return jsx(tp,{task:C,isDark:$,locale:f,onLogTime:a.onLogTime,onEstimateUpdate:a.onEstimateUpdate,onSoldEffortUpdate:a.onSoldEffortUpdate,showSoldEffort:t.showSoldEffort,onOpenTimeLog:a.onOpenTimeLog,lens:W,hourlyRate:fe(C),currencyCode:B})}case "costBar":{let ne=f==="es"?"Sin tarifa: estas horas no se valoran":"No rate: these hours are not valued";if(ve&&C.hasChildren){let{dollarSpent:ze,dollarAllocated:He}=ie(C);if(ze<=0&&He<=0)return jsx("span",{className:g("text-[11px] font-mono",$?"text-white/30":"text-gray-400"),title:ne,children:"\u2014"});let Ft=He>0&&ze>He;return jsxs("span",{"data-costo":true,className:g("text-[11px] font-mono flex items-center gap-1.5",$?"text-white/50":"text-gray-500"),children:[jsx("span",{className:g("font-bold",Ft?"text-[#FF453A]":$?"text-white/80":"text-gray-800"),children:Qa(Math.round(ze),B,pe)}),He>0&&jsxs(Fragment,{children:[" / ",jsx("span",{className:$?"text-white/60":"text-gray-600",children:Qa(Math.round(He),B,pe)})]})]})}let Me=fe(C);return Me>0?jsx("span",{"data-costo":true,className:"contents",children:jsx(tp,{task:C,isDark:$,locale:f,lens:"financial",hourlyRate:Me,currencyCode:B})}):jsx("span",{className:g("text-[11px] font-mono",$?"text-white/30":"text-gray-400"),title:ne,children:"\u2014"})}case "teamLoad":return C.hasChildren||C.subtasks&&C.subtasks.length>0?jsx(Gf,{task:C,isDark:$,locale:f}):jsx(Ec,{value:C.assignees||[],availableUsers:i,onChange:Me=>{a.onTaskUpdate?.({...C,assignees:Me});},isDark:$,locale:f});case "blockers":return jsx(Kf,{blockers:C.blockers,isDark:$,locale:f});case "weight":{let ne=Qe.get(C.id);if(ne!==void 0)return jsx("span",{className:g("text-xs font-mono",ne>0?$?"text-white/50":"text-gray-400":$?"text-white/30":"text-gray-300"),style:{fontFamily:"JetBrains Mono, monospace"},children:ne>0?Wr(ne,pe,2):"\u2014"});let Me=C.weight||0;return jsx(t5,{value:Me,onChange:ze=>ee({weight:ze}),isDark:$,idioma:pe})}default:return jsx("span",{className:g("text-sm",$?"text-white/60":"text-gray-500"),children:"-"})}},[a,$,f,i,Ue,ve,Qe,B]),mo=useCallback(C=>{let ee={name:Ue.columns.name,status:Ue.columns.status,priority:Ue.columns.priority,assignees:Ue.columns.assignees,startDate:Ue.columns.startDate,endDate:Ue.columns.endDate,progress:Ue.columns.progress,tags:Ue.columns.tags||(f==="es"?"Etiquetas":"Tags"),estimatedTime:Ue.columns.estimatedTime||(f==="es"?"Estimado":"Estimated"),quotedTime:Ue.columns.quotedTime||(f==="es"?"Ofertado":"Quoted"),elapsedTime:Ue.columns.elapsedTime||(f==="es"?"Ejecutado":"Executed"),soldEffortMinutes:Ue.columns.soldEffortMinutes||(f==="es"?"Ofertado":"Quoted"),effortMinutes:Ue.columns.effortMinutes||(f==="es"?"Estimado":"Estimated"),timeLoggedMinutes:Ue.columns.timeLoggedMinutes||(f==="es"?"Ejecutado":"Executed"),scheduleVariance:Ue.columns.scheduleVariance||(f==="es"?"Prog / Var":"Sched / Var"),hoursBar:Ue.columns.hoursBar||(f==="es"?"Horas (Usado / Asignado)":"Hours (Spent / Allocated)"),costBar:Ue.columns.costBar||(f==="es"?"Costo (Ejecutado / Asignado)":"Cost (Spent / Allocated)"),teamLoad:Ue.columns.teamLoad||(f==="es"?"Equipo":"Team"),blockers:Ue.columns.blockers||(f==="es"?"Bloqueantes":"Blockers"),weight:Ue.columns.weight||(f==="es"?"Peso":"Weight")}[C.type]||C.label;return typeof ee=="string"?ee:String(ee||C.type)},[Ue,f]),Jn=useMemo(()=>{let ee=je.reduce((ge,Ge)=>ge+Ge.width,0)+(k?48:0),oe={};for(let ge of je)oe[ge.id]=`${ge.width/ee*100}%`;return oe},[je,k]),ea=useMemo(()=>{let C={};for(let Q of je)C[Q.id]=Ru(Q);return C},[je]),rd=useMemo(()=>df(je,(k?48:0)+(bn?24:0)+(Lt?20:0)),[je,k,bn,Lt]);return r?jsx("div",{className:g("flex-1 flex items-center justify-center",$?"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",$?"text-white/60":"text-gray-600"),children:[Ue.empty.noTasks,"..."]})]})}):n?jsx("div",{className:g("flex-1 flex items-center justify-center",$?"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",$?"text-white":"text-gray-900"),children:"Error"}),jsx("p",{className:g("text-sm",$?"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",$?"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",$?"text-white":"text-gray-900"),children:Ue.empty.noTasks}),jsx("p",{className:g("text-sm",$?"text-white/60":"text-gray-600"),children:Ue.empty.addFirstTask})]})}):jsxs("div",{ref:Be,className:g($?"bg-[#0D0D0D]":"bg-white",F&&"select-none",s),style:{display:"flex",flexDirection:"column",flex:"1 1 0%",width:"100%",height:"100%",overflow:"hidden",minHeight:0,...o},children:[(()=>{let C=!!t.toolbarContainer,Q=jsx("div",{className:C?"flex items-center":g("flex-shrink-0 px-6 py-4 border-b",$?"border-[#222]":"border-gray-200"),children:jsxs("div",{className:C?"flex items-center gap-2":"flex items-center gap-4",children:[jsx("div",{className:g("text-sm whitespace-nowrap",$?"text-white/60":"text-gray-600"),"data-cuenta-de-tareas":true,children:(()=>{let ee=0,oe=0,ge=ne=>{for(let Me of ne)Me.subtasks&&Me.subtasks.length>0?(ee++,ge(Me.subtasks)):oe++;};for(let ne of ml)(ne.subtasks?.length??0)>0?(ee++,ne.isExpanded===false&&ge(ne.subtasks)):oe++;let Ge=f==="es";return jsxs(Fragment,{children:[oe," ",Ue.pagination.tasks,ee>0&&jsxs(Fragment,{children:[" \xB7 ",ee," ",Ge?ee===1?"tarea padre":"tareas padre":ee===1?"parent task":"parent tasks"]})]})})()}),b&&!C&&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",$?"text-white/60":"text-gray-400")}),jsx("input",{type:"text",value:Le,onChange:ee=>Ye(ee.target.value),placeholder:Ue.toolbar.searchPlaceholder,className:g("w-full h-9 pl-10 pr-4 rounded-lg border outline-none focus:ring-2 focus:ring-[#00E5CC]/30",$?"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")})]}),!C&&jsx("div",{className:"flex-1"}),l&&jsx("div",{className:"flex items-center gap-2",children:l}),w&&X>1&&jsxs("div",{className:"relative",children:[jsxs("button",{ref:de,onClick:()=>ta(!ma),className:g("flex items-center gap-1.5 px-2 py-1.5 rounded-lg border transition-colors text-[11px] font-medium",$?ma?"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]":ma?"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"}),ft==="all"?f==="es"?"Todos":"All":`L${ft}`]}),ma&&jsx("div",{ref:G,className:g("absolute top-full mt-1 right-0 w-24 rounded-lg border overflow-hidden z-50 shadow-lg",$?"bg-[#1A1A1A] border-[#333]":"bg-white border-gray-200"),children:[{value:"all",label:f==="es"?"Todos":"All"},...Array.from({length:Math.min(X,5)},(ee,oe)=>({value:oe+1,label:`L${oe+1}`}))].map(ee=>jsxs("button",{onClick:()=>{_a(ee.value),ta(false);},className:g("w-full px-3 py-2 text-left text-xs transition-colors flex items-center justify-between",$?ft===ee.value?"bg-[#00E5CC]/10 text-[#00E5CC]":"text-white/60 hover:bg-white/[0.05] hover:text-white/80":ft===ee.value?"bg-[#00E5CC]/15 text-[#00C4AE]":"text-gray-600 hover:bg-gray-100"),children:[jsx("span",{children:ee.label}),ft===ee.value&&jsx("span",{className:"text-[#00E5CC]",children:"\u2713"})]},String(ee.value)))})]}),t.showStatusFilter!==false&&jsx(yb,{value:he,hideCompleted:wt,onChange:dt,onHideCompletedChange:ue,isDark:$,locale:f}),ct?.enabled&&ct.data&&!Tt&&jsx("button",{onClick:()=>_t(true),className:g("flex items-center justify-center w-8 h-8 rounded-lg border transition-colors",$?"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,E&&N&&!C&&jsxs(motion.button,{onClick:N,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:Ue.toolbar.newTask})]})]})});return C?createPortal(Q,t.toolbarContainer):Q})(),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%",minWidth:rd},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",$?"border-[#222] bg-[#1A1A1A] font-mono text-white/70":"border-gray-200 bg-gray-50 text-gray-600"),children:[bn&&jsx("div",{className:"w-6 flex-shrink-0"}),Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),je.map(C=>{let Q=C.id!=="name",ee=lt===C.id&&De!==C.id;return jsxs("div",{className:g("relative flex items-center gap-2 px-4 py-2 transition-all duration-150 group",$?"text-white/60":"text-gray-500",Q&&"cursor-grab",C.type!=="name"&&"justify-center",De===C.id&&"opacity-50",ee&&($?"bg-[#00E5CC]/20 border-l-2 border-l-[#00E5CC]":"bg-[#00E5CC]/15 border-l-2 border-l-[#00E5CC]")),style:{width:Jn[C.id],minWidth:ea[C.id]},draggable:Q,onDragStart:Q?oe=>za(oe,C.id):void 0,onDragEnd:Q?Eo:void 0,onDragOver:Q?oe=>sn(oe,C.id):void 0,onDragLeave:Q?pi:void 0,onDrop:Q?oe=>fn(oe,C.id):void 0,onContextMenu:oe=>Fr(oe,void 0,C.id),children:[Q&&jsx(GripVertical,{className:g("w-3 h-3 flex-shrink-0 transition-opacity",$?"text-white/20 group-hover:text-white/50":"text-gray-300 group-hover:text-gray-500")}),u?jsxs("button",{draggable:false,onClick:oe=>{let ge=oe.currentTarget.getBoundingClientRect();u(C.id,ge);},className:"flex items-center gap-1.5 hover:text-[#00E5CC]",children:[mo(C),p?.includes(C.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),Jt===C.id&&jsx(ArrowUpDown,{className:"w-3 h-3 text-[#00E5CC]"})]}):C.sortable?jsxs("button",{draggable:false,onClick:()=>Kt(C.id),className:"flex items-center gap-1 hover:text-[#00E5CC]",children:[mo(C),p?.includes(C.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}}),jsx(ArrowUpDown,{className:g("w-3 h-3",Jt===C.id&&"text-[#00E5CC]")})]}):jsxs("span",{draggable:false,className:"flex items-center gap-1.5",children:[mo(C),p?.includes(C.id)&&jsx("span",{title:"filtered",style:{width:6,height:6,borderRadius:"50%",background:d,display:"inline-block",flexShrink:0}})]}),M&&C.resizable&&jsx("div",{className:g("absolute right-0 top-0 bottom-0 w-[9px] -mr-1 cursor-col-resize group","flex items-center justify-center"),onMouseDown:oe=>jr(oe,C.id),children:jsx("div",{className:g("w-px h-full transition-colors","pointer-events-none",F===C.id?"bg-[#00E5CC] w-0.5":"bg-current opacity-40 group-hover:bg-[#00E5CC] group-hover:opacity-100 group-hover:w-0.5")})})]},C.id)}),k&&jsxs("div",{className:"relative flex items-center justify-center w-12 flex-shrink-0",children:[jsx("button",{onClick:C=>{C.stopPropagation(),Pe(Q=>!Q);},className:g("p-0.5 rounded transition-colors",$?"hover:bg-white/[0.05] text-white/60 hover:text-white":"hover:bg-gray-200 text-gray-400 hover:text-gray-600",Et&&($?"bg-white/[0.05]":"bg-gray-200")),title:f==="es"?"Agregar columna":"Add column",children:jsx(Plus,{className:"w-3 h-3"})}),jsx(ub,{isOpen:Et,onClose:()=>Pe(false),columns:ce,customFields:c,mostrarColumnasDensas:y,onColumnsChange:ca,onCreateCustomField:()=>{Pe(false),O(true);},isDark:$,locale:f})]})]}),jsxs(AnimatePresence,{mode:"popLayout",children:[po.map((C,Q)=>rs(Q,(()=>{let ee=Se.has(C.id),oe=Math.min(Q*.01,.2),ge=C.hasChildren&&C.level===0,Ge=C.subtasks?.length||0;if(ge){let{spent:bt,allocated:Nt,quoted:aa}=li(C),ht=e5(C);return jsxs(motion.div,{"data-task-id":C.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:oe},className:g("flex items-center border-y cursor-pointer transition-colors duration-500 group",$?"border-[#222] bg-[#222]":"border-gray-200 bg-gray-100",tt===C.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100")),onClick:()=>a.onTaskClick?.(C),children:[bn&&bl(C.id),Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),je.map(Ut=>jsx("div",{className:g("flex items-center px-4",nt?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",Ut.type!=="name"&&"justify-center"),style:{width:Jn[Ut.id],minWidth:ea[Ut.id]},children:Ut.type==="name"?jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[jsx("button",{type:"button","aria-expanded":ee,"aria-label":f==="es"?ee?"Plegar subtareas":"Desplegar subtareas":ee?"Collapse subtasks":"Expand subtasks",onClick:oa=>{oa.stopPropagation(),xe(C.id);},className:g("p-0.5 rounded flex-shrink-0 mt-0.5",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ee?jsx(ChevronDown,{className:g("w-4 h-4",$?"text-white/40":"text-gray-500")}):jsx(ChevronRight,{className:g("w-4 h-4",$?"text-white/40":"text-gray-500")})}),jsx("span",{onClick:oa=>{oa.stopPropagation(),xe(C.id);},className:"flex-shrink-0 cursor-pointer mt-0.5",children:ee?jsx(FolderOpen,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}}):jsx(Folder,{className:"w-4 h-4",style:{color:$?"#FFD60A":"#B45309"}})}),C.wbsCode&&jsx("span",{className:"text-[10px] font-mono flex-shrink-0 mt-1",style:{color:$?"#FFD60A":"#B45309"},children:C.wbsCode}),jsxs("div",{className:g("flex min-w-0",nt?"flex-row items-baseline gap-2":"flex-col"),children:[jsx("span",{className:g("text-[13px] font-bold uppercase tracking-wide",nt&&"truncate",$?"text-white":"text-gray-900"),style:{fontFamily:"Inter, system-ui, sans-serif"},children:C.name}),jsxs("span",{className:g(nt?"text-[12px] flex-shrink-0":"text-[10px] font-mono",$?"text-white/30":"text-gray-500"),children:["(",Ge," ",f==="es"?Ge===1?"Tarea":"Tareas":Ge===1?"Item":"Items",")"]}),ht!==null&&x&&jsxs("span",{className:g("text-[9px] font-mono px-1.5 py-0.5 rounded w-fit mt-0.5",ht>=1?"bg-[#32D74B]/10":ht>=.8?"bg-[#FFD60A]/10":"bg-[#FF453A]/10"),style:{color:ht>=1?"var(--pj-verde-texto, #32D74B)":ht>=.8?"var(--pj-ambar-texto, #FFD60A)":"var(--pj-rojo-texto, #FF453A)"},children:["Avg SPI: ",Ao(ht,pe,2)]})]})]}):Ut.type==="timeLoggedMinutes"?W==="financial"?(()=>{let oa=C.executedDollarsCanonical,ga=oa!=null?Math.round(oa):Math.round(ie(C).dollarSpent);return ga>0?jsx("span",{className:g("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:Qa(ga,B,pe)}):null})():jsx(on,{value:bt>0?bt:void 0,isDark:$,locale:f,disabled:true,lens:W,hourlyRate:fe(C),currencyCode:B}):Ut.type==="soldEffortMinutes"?W==="financial"?(()=>{let oa=ie(C),ga=Math.round(oa.dollarQuoted);return ga>0?jsx("span",{className:g("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:Qa(ga,B,pe)}):null})():jsx(on,{value:aa>0?aa:void 0,isDark:$,locale:f,disabled:true,lens:W,hourlyRate:fe(C),currencyCode:B}):Ut.type==="effortMinutes"?W==="financial"?(()=>{let oa=ie(C),ga=Math.round(oa.dollarAllocated),Rt=Math.round(oa.dollarQuoted),Bt=Rt-ga;return jsxs("div",{className:"flex flex-col",children:[ga>0?jsx("span",{className:g("text-sm font-mono",$?"text-white/60":"text-gray-500"),children:Qa(ga,B,pe)}):null,Bt!==0&&ga>0&&Rt>0&&jsx("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Bt>0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:Oc(Bt,B,pe,Bt>0)})]})})():jsx(on,{value:Nt>0?Nt:void 0,isDark:$,locale:f,disabled:true,lens:W,hourlyRate:fe(C),currencyCode:B}):mr(C,Ut)},Ut.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},C.id)}let ne=ot===C.id,Me=Oe===C.id,ze=Me&&la==="above",He=Me&&la==="below",Ft=Me&&la==="child";return jsxs(motion.div,{"data-task-id":C.id,"data-listview-row":C.id,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,delay:oe},className:g("flex items-center border-b transition-colors relative group",$?"border-[#222] hover:bg-white/[0.05]":"border-gray-100 hover:bg-gray-50",tt===C.id&&($?"!bg-[#FFD60A]/15":"!bg-yellow-100"),bn&&Vr.has(C.id)&&($?"bg-white/[0.06]":"bg-blue-50/60")),"data-seleccionada":bn&&Vr.has(C.id)?"true":void 0,style:{opacity:ne?.4:1,backgroundColor:Ft?$?"rgba(0, 229, 204,0.08)":"rgba(0, 229, 204,0.05)":void 0,boxShadow:Ft?"inset 0 0 0 2px #00E5CC":void 0},onClick:()=>a.onTaskClick?.(C),onDoubleClick:()=>a.onTaskDoubleClick?.(C),onContextMenu:bt=>Fr(bt,C),onMouseEnter:()=>te(C.id),onMouseLeave:()=>te(bt=>bt===C.id?null:bt),children:[ze&&jsx("div",{style:{position:"absolute",top:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),He&&jsx("div",{style:{position:"absolute",bottom:0,left:0,right:0,height:2,backgroundColor:"#00E5CC",zIndex:10}}),bn&&bl(C.id),Lt&&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=>Ze(C.id,bt),style:{color:$?"#888":"#999"},children:jsx(GripVertical,{className:"w-3 h-3"})}),je.map(bt=>{let Nt=!!(C.subtasks&&C.subtasks.length>0),aa=_e(bt),Ut=!!aa&&!Nt&&I===C.id&&!Re,oa=!!Re&&!!aa&&it(Re.column,aa)&&Fe(C.id);return jsx("div",{className:g("flex items-center px-4",nt?"py-1.5 min-h-[40px]":"py-3 min-h-[56px]",bt.type!=="name"&&"justify-center"),style:{width:Jn[bt.id],minWidth:ea[bt.id],position:"relative",backgroundColor:oa?"rgba(0, 229, 204, 0.13)":void 0,boxShadow:oa?"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:[w&&C.level>0&&jsx("div",{style:{width:`${C.level*24}px`},className:"flex-shrink-0"}),w&&C.hasChildren&&jsx("button",{onClick:ga=>{ga.stopPropagation(),xe(C.id);},className:g("p-0.5 rounded flex-shrink-0",$?"hover:bg-white/[0.05]":"hover:bg-gray-200"),children:ee?jsx(ChevronDown,{className:g("w-4 h-4",$?"text-white/60":"text-gray-400")}):jsx(ChevronRight,{className:g("w-4 h-4",$?"text-white/60":"text-gray-400")})}),w&&!C.hasChildren&&jsx("div",{className:"w-5 flex-shrink-0"}),jsxs("div",{className:g("flex min-w-0 flex-1",nt?"flex-row items-center gap-2":"flex-col"),children:[(C.wbsCode||C.taskCode)&&jsxs("div",{className:"flex items-center gap-1.5",children:[C.wbsCode&&jsx("span",{className:g("text-[10px] font-mono",$?"text-[#00E5CC]":"text-[#00C4AE]"),children:C.wbsCode}),C.taskCode&&jsx("span",{"data-codigo-tarea":true,className:g(nt?"text-[12px] whitespace-nowrap":"text-[10px] font-mono",$?"text-white/40":"text-gray-400"),style:nt&&!$?{color:"var(--pj-texto-3, #646B78)"}:void 0,children:C.taskCode})]}),jsxs("span",{className:g("truncate",C.hasChildren?"text-[14px] font-bold":"text-[13px] font-normal",C.progress===100?t.completedStyle==="dim"?$?"text-white/45":"text-gray-400":$?"line-through text-white/50":"line-through text-gray-400":C.hasChildren?$?"text-white":"text-gray-900":$?"text-[#D1D5DB]":"text-gray-600"),children:[C.__padre&&jsxs("span",{"data-prefijo-padre":true,className:$?"text-white/35":"text-gray-400",children:[C.__padre," \u203A "]}),C.name]}),C.tags?.[0]&&jsx("span",{className:g("text-[9px] font-mono uppercase tracking-wide px-1.5 py-0.5 rounded w-fit",nt&&"flex-shrink-0"),style:{backgroundColor:`${C.tags[0].color}20`,color:C.tags[0].color},children:C.tags[0].name})]})]}):Ut&&aa?jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center"},children:[mr(C,bt),jsx("span",{title:"Arrastr\xE1 hacia abajo para aplicar a varias tareas",onMouseDown:ga=>Ke(ga,C.id,aa,Q),style:{position:"absolute",right:-5,bottom:-3,width:8,height:8,borderRadius:2,background:"#00E5CC",border:"1px solid rgba(0,0,0,0.3)",cursor:"crosshair",zIndex:5}})]}):mr(C,bt)},bt.id)}),k&&jsx("div",{className:"w-12 flex-shrink-0"})]},C.__claveFila??C.id)})())),rs(po.length,null)]}),q&&po.length>0&&(()=>{let{spent:C,allocated:Q,quoted:ee}=Xe,oe=Q-C,ge=oe<0,Ge=hs(e),Me=Ge.length>0&&Ge.every(Bt=>(Bt.progress??0)>=100)?f==="es"?"AHORRADO":"SAVED":f==="es"?"RESTANTE":"REMAINING",ze=ge?`+${ii(Math.abs(oe),pe)} ${f==="es"?"EXCEDIDO":"OVER"}`:`+${ii(oe,pe)} ${Me}`,He=W==="financial"&&R>0,Ft=le?.breakdown,bt=!!Ft&&((Ft.equipment??0)>0||(Ft.travel??0)>0),Nt=Ft?.laborSpent!=null?Ft.laborSpent:le?.spent!=null?le.spent:Xe.dollarSpent,aa=Ft?.laborAllocated!=null?Ft.laborAllocated:le?.allocated!=null?le.allocated:Xe.dollarAllocated,ht=le?.quoted!=null?le.quoted:Xe.dollarQuoted,Ut=(Bt,ua)=>{if(He){let Ma=ua??Bt/60*R;return Qa(Math.round(Ma),B,pe)}return ii(Bt,pe)},oa=He?Math.abs(aa-Nt):0,ga=He?`+${Qa(oa,B,pe)} ${ge?f==="es"?"EXCEDIDO":"OVER":Me}`:ze,Rt=He&&bt?f==="es"?"solo mano de obra":"labor only":void 0;return jsxs("div",{className:g("flex items-center sticky bottom-0 z-[5]",$?"border-t border-[#2A2A3A]":"border-t border-gray-300"),style:{backgroundColor:$?"rgba(13, 17, 23, 0.95)":"rgba(255, 255, 255, 0.95)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[bn&&jsx("div",{className:"w-6 flex-shrink-0"}),Lt&&jsx("div",{className:"w-5 flex-shrink-0"}),je.map(Bt=>jsx("div",{className:g("flex items-center px-4 py-3",Bt.type!=="name"&&"justify-center"),style:{width:Jn[Bt.id],minWidth:ea[Bt.id]},children:Bt.type==="name"?jsxs("div",{className:"flex flex-col",children:[jsx("span",{className:g("text-[11px] font-black uppercase tracking-widest",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:f==="es"?"TOTAL PROYECTO":"TOTAL PROJECT"}),Rt&&jsxs("span",{className:g("text-[9px] font-mono mt-0.5 flex items-center gap-1",$?"text-white/35":"text-gray-400"),children:[jsx(Info,{className:"w-2.5 h-2.5"}),Rt]})]}):Bt.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",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ut(C,He?Nt:void 0)}),jsx("span",{className:g("text-[11px]",$?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",$?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ut(Q,He?aa:void 0)})]}),Q>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",ge?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:He?ga:ze})]}):Bt.type==="costBar"?(()=>{let ua=Math.round(Nt),Ma=Math.round(aa),Ka=Ma>0&&ua>Ma;return jsxs("div",{className:"flex flex-col items-center w-full","data-costo-total":true,children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:g("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Qa(ua,B,pe)}),jsx("span",{className:g("text-[11px]",$?"text-white/40":"text-gray-400"),children:"/"}),jsx("span",{className:g("text-[11px]",$?"text-white/50":"text-gray-500"),style:{fontFamily:"JetBrains Mono, monospace"},children:Qa(Ma,B,pe)})]}),Ma>0&&jsx("span",{className:g("text-[10px] font-semibold mt-0.5 whitespace-nowrap",Ka?"text-[#FF453A]":"text-[#32D74B]"),style:{fontFamily:"JetBrains Mono, monospace"},children:`+${Qa(Math.abs(Ma-ua),B,pe)} ${Ka?f==="es"?"EXCEDIDO":"OVER":Me}`}),bt&&jsx("span",{className:g("text-[9px] mt-0.5",$?"text-white/40":"text-gray-400"),children:f==="es"?"solo mano de obra":"labor only"})]})})():Bt.type==="soldEffortMinutes"?jsx("span",{className:g("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:ee>0?Ut(ee,He?ht:void 0):"\u2013"}):Bt.type==="effortMinutes"?(()=>{if(He&&ee>0&&Q>0){let ua=Math.round(ht),Ma=Math.round(aa),Ka=ua-Ma,ln=ua>0?Math.round(Ka/ua*100):0;return jsxs("div",{className:"flex flex-col items-center",children:[jsx("span",{className:g("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Ut(Q,aa)}),jsxs("span",{className:g("text-[9px] font-mono font-bold px-1.5 py-0.5 rounded whitespace-nowrap mt-0.5",Ka>=0?"bg-[#064e3b] text-[#10b981] border border-[#065f46]/30":"bg-[#451a03] text-[#f59e0b] border border-[#78350f]/30"),children:[Oc(Ka,B,pe,Ka>=0),jsxs("span",{className:"ml-0.5 opacity-60",children:["(",Wr(ln,pe),")"]})]})]})}return jsx("span",{className:g("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:Q>0?Ut(Q,He?aa:void 0):"\u2013"})})():Bt.type==="timeLoggedMinutes"?jsx("span",{className:g("text-[12px] font-bold",$?"text-white":"text-gray-900"),style:{fontFamily:"JetBrains Mono, monospace"},children:C>0?Ut(C,He?Nt:void 0):"\u2013"}):Bt.type==="progress"?(()=>{let ua=ji(hs(e||[]));return jsx("span",{className:g("text-[12px] font-bold font-mono",$?"text-[#00E5CC]":"text-[#00C4AE]"),style:{fontFamily:"JetBrains Mono, monospace"},children:Wr(ua,pe)})})():Bt.type==="weight"?(()=>{let ua=e||[],Ma=[],Ka=yn=>{for(let cn of yn)Ma.push(cn),cn.subtasks?.length&&Ka(cn.subtasks);};Ka(ua);let Ir=Ma.filter(yn=>!yn.subtasks?.length||yn.subtasks.length===0).reduce((yn,cn)=>yn+(cn.weight||0),0),Pn=Math.abs(Ir-100)<.1;return jsx("span",{className:g("text-[12px] font-bold font-mono",Pn?$?"text-[#22C55E]":"text-green-600":"text-[#EF4444]"),style:{fontFamily:"JetBrains Mono, monospace"},children:Wr(Ir,pe,1)})})():jsx("span",{className:g("text-[11px]",$?"text-white/30":"text-gray-300"),children:"\u2013"})},Bt.id)),k&&jsx("div",{className:"w-12 flex-shrink-0"})]})})(),po.length===0&&Le&&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",$?"text-white/30":"text-gray-400")}),jsx("p",{className:g($?"text-white/60":"text-gray-600"),children:Ue.empty.noResults})]})})]})}),ct?.enabled&&ct.data&&Tt&&jsx(xb,{data:ct.data,isDark:$,locale:f,onClose:()=>_t(false),lens:ct.lens??t?.lens,currencyCode:B,onUnassignedTaskClick:C=>{let Q=document.querySelector(`[data-task-id="${C}"]`);Q&&(Q.scrollIntoView({behavior:"smooth",block:"center"}),xt(C),setTimeout(()=>xt(null),2e3));}})]}),jsx(eb,{state:re,onClose:Lr,isDark:$,locale:f,onTaskEdit:a.onTaskEdit,onTaskDuplicate:a.onTaskDuplicate,onTaskDelete:a.onTaskDelete,onTaskUpdate:a.onTaskUpdate,onColumnHide:pr,onColumnSort:rr,availableUsers:i,onOpenTimeLog:a.onOpenTimeLog,onReportBlocker:a.onReportBlocker,onCopyTaskLink:a.onCopyTaskLink,onTaskMove:a.onTaskMove,onTaskIndent:a.onTaskIndent,onTaskOutdent:a.onTaskOutdent}),Ht&&ke&&ot&&createPortal(jsx("div",{style:{position:"fixed",left:ke.x+12,top:ke.y-10,zIndex:99999,pointerEvents:"none"},children:(()=>{let Q=$e.flattenTasks(e).find(ee=>ee.id===ot);return Q?jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg",style:{backgroundColor:$?"rgba(10,10,10,0.9)":"rgba(255,255,255,0.95)",border:`1px solid ${$?"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:$?"#e6edf3":"#111827"},children:Q.name})]}):null})()}),document.body),jsx(gb,{isOpen:ut,onClose:()=>O(false),onSave:mi,isDark:$,locale:f})]})}var Nb=[{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}],Sb=[{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"}],Eb=[{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 up={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"},pp={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"},mp={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"},Hc={dark:up,light:pp,neutral:mp};function Mb(e){return Hc[e]||Hc.dark}function Wc(e,t,a,r,n=5){let s=[],o=[],i=e.filter(m=>m.endSerial>=a&&m.startSerial<=r).sort((m,f)=>m.startSerial-f.startSerial||f.endSerial-m.endSerial);for(let m of i){let f=Math.max(m.startSerial,a),v=Math.min(m.endSerial,r),b=0;for(;(s[b]||[]).some(([w,h])=>!(v<w||f>h));)b++;(s[b]=s[b]||[]).push([f,v]),o.push({t:m,s:f,e:v,lane:b,contL:m.startSerial<a,contR:m.endSerial>r});}let c={};for(let m=a;m<=r;m++)c[m]=new Set;o.forEach(m=>{for(let f=m.s;f<=m.e;f++)c[f].add(m.lane);});let l=[],u=[],p={};t.filter(m=>m.serial>=a&&m.serial<=r).forEach(m=>{(p[m.serial]=p[m.serial]||[]).push(m);}),Object.keys(p).forEach(m=>{let f=+m,v=p[f],b=[];for(let w=0;w<n;w++)c[f].has(w)||b.push(w);if(v.length<=b.length)v.forEach((w,h)=>l.push({it:w,day:f,lane:b[h]}));else {let w=Math.max(b.length-1,0);v.slice(0,w).forEach((h,x)=>l.push({it:h,day:f,lane:b[x]})),u.push({day:f,lane:b[w]!=null?b[w]:n-1,count:v.length-w,items:v.slice(w)});}});let d=s.length;return l.forEach(m=>{d=Math.max(d,m.lane+1);}),u.forEach(m=>{d=Math.max(d,m.lane+1);}),{bars:o,chips:l,more:u,laneCount:Math.max(d,1)}}var a5=["LUN","MAR","MI\xC9","JUE","VIE","S\xC1B","DOM"],r5=["MON","TUE","WED","THU","FRI","SAT","SUN"];function Pb(e){return e==="es"?a5:r5}function Fb(e){return (e.getDay()+6)%7}function Lb(e,t){let a=new Date(e,t,1),r=Fb(a),n=new Date(e,t,1-r),s=[];for(let p=0;p<6;p++)s.push({ws:p*7+1,we:p*7+7});let o=p=>{let d=new Date(n);return d.setDate(n.getDate()+(p-1)),d},i=p=>{let d=p.getTime()-n.getTime();return Math.floor(d/864e5)+1},c=i(a),l=new Date(e,t+1,0),u=i(l);return {gridStart:n,weeks:s,serialToDate:o,dateToSerial:i,monthStartSerial:c,monthEndSerial:u}}function rl(e,t){return Fb(e.serialToDate(t))>=5}function Ab(e,t,a,r,n){let s=[],o=[],i=[],c=Math.max(1,n),l=0;for(let u=a;u<=r;u++){let p=e.filter(b=>!b.container&&b.endSerial===u).sort((b,w)=>+!!b.done-+!!w.done||b.name.localeCompare(w.name)),d=t.filter(b=>b.serial===u),m=p.length+d.length;if(m===0)continue;let f=Math.min(m,c),v=0;for(let b of p.slice(0,f))s.push({t:b,s:u,e:u,lane:v++,contL:false,contR:false});for(let b of d.slice(0,Math.max(0,f-Math.min(p.length,f))))o.push({it:b,day:u,lane:v++});if(m>f){let b=d.slice(Math.max(0,f-Math.min(p.length,f)));i.push({day:u,lane:-1,count:m-f,items:b});}l=Math.max(l,v);}return {bars:s,chips:o,more:i,laneCount:Math.max(l,1)}}function n5(e){let t=[],a=(r,n,s)=>{for(let o of r){let i=n||o.id,c=s||o.name;t.push({t:o,phaseId:i,phaseName:c}),o.subtasks?.length&&a(o.subtasks,i,c);}};return a(e,"",""),t}function Ib(e){if(!e)return null;let t=e instanceof Date?e:new Date(e);return isNaN(t.getTime())?null:t}function nl(e,t="es",a){return Qa(Math.round(e),a,t,{compacto:true})}function Ss(e,t="es"){return un(Math.round(e*60),t)}function zc(e){let{tasks:t,grid:a,projectColor:r,hourlyRate:n,projectId:s,locale:o="es",currencyCode:i}=e,c=n5(t),l=42,u=[];for(let{t:d,phaseId:m,phaseName:f}of c){let v=Ib(d.startDate),b=Ib(d.endDate);if(!v||!b)continue;let w=a.dateToSerial(v),h=a.dateToSerial(b);if(h<1||w>l||d.isMilestone&&h>l)continue;let x=d.effortMinutes??0,y=Math.round(x/60*10)/10,k=d.costAtCompletion,M=k!=null?nl(k,o,i):nl(y*n,o,i),H=d.assignees?.[0],E=H?.initials||(H?.name?i5(H.name):void 0),N=d.displayId||d.wbsCode||"",D=s5(N||d.id)?"":N||d.id;u.push({uid:d.id,id:D,name:d.name,projectId:s,color:d.color,startSerial:Math.max(d.isMilestone?h:w,1),endSerial:Math.min(h,l),hrs:y,cost:M,critical:!!d.isCriticalPath,who:E,realStart:v,realEnd:b,phaseId:m,phaseName:f,done:d.progress===100||d.status==="completed",overdue:!(d.progress===100||d.status==="completed")&&(()=>{let S=new Date;S.setHours(0,0,0,0);let V=new Date(b);return V.setHours(0,0,0,0),V<S})(),milestone:!!d.isMilestone,container:!!(d.subtasks&&d.subtasks.length>0)});}let p=[];return {calTasks:u,dayItems:p,isEmpty:u.length===0&&p.length===0}}var o5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function s5(e){return o5.test(e)||/^task-\d+/.test(e)}function i5(e){return ba(e)}var l5=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],c5=["January","February","March","April","May","June","July","August","September","October","November","December"];function Rb(e,t,a){return `${(a==="es"?l5:c5)[t]} ${e}`}var gp=26,d5={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Uc({locale:e}){let t=Pb(e);return jsx("div",{className:"cal-dow",children:t.map((a,r)=>jsx("div",{className:r>=5?"wknd":"",children:a},a))})}function jc({bar:e,ws:t,money:a,projColor:r,slotH:n=gp,due:s=false,showValues:o=true,locale:i="es"}){let{t:c}=e,l=e.s-t,u=e.e-e.s+1,p="cal-bar"+(c.critical?" cpm":"")+(e.contL?" cont-l":"")+(e.contR?" cont-r":"")+(s?" due":"")+(s&&c.done?" done":"")+(s&&c.overdue?" overdue":"")+(s&&c.milestone?" hito":""),d=a==="$"?c.cost:Ss(c.hrs,i),m=o&&(a==="$"||c.hrs>0),f={"--proj":e.color??c.color??r,left:`calc(${l}/7*100% + 3px)`,width:`calc(${u}/7*100% - 6px)`,top:`${e.lane*n}px`};return jsxs("div",{className:p,style:f,children:[c.critical&&u>=3?jsx("span",{className:"cpm-tag",children:"CPM"}):null,s&&c.done?jsx("span",{className:"ico","aria-hidden":true,children:"\u2713"}):null,s&&c.overdue?jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 12 12","aria-hidden":true,children:[jsx("circle",{cx:"6",cy:"6",r:"5.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),jsx("line",{x1:"6",y1:"3.4",x2:"6",y2:"6.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),jsx("circle",{cx:"6",cy:"8.6",r:"0.8",fill:"currentColor"})]}):null,c.milestone?jsxs("svg",{className:"ico",width:"11",height:"11",viewBox:"0 0 24 24","aria-hidden":true,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"}),jsx("line",{x1:"4",y1:"22",x2:"4",y2:"15"})]}):null,c.id?jsx("span",{className:"tk",children:c.id}):null,jsx("span",{className:"nom",children:c.name}),u>=3&&m?jsx("span",{className:"val",children:d}):null,s&&c.overdue?jsx("span",{className:"sr-only",children:"Overdue"}):null]})}function Vc({chip:e,ws:t,slotH:a=gp}){let r=e.day-t,n=`cal-chip ${e.it.type}`,s={left:`calc(${r}/7*100% + 3px)`,width:"calc(1/7*100% - 6px)",top:`${e.lane*a}px`};return jsxs("div",{className:n,style:s,children:[jsx("span",{className:"ico",children:d5[e.it.type]}),jsx("span",{className:"lbl2",children:e.it.label})]})}function Gc({more:e,ws:t,slotH:a=gp,onClick:r,enCabecera:n=false,locale:s="es"}){let o=e.day-t,i=n?{left:`calc(${o+1}/7*100% - 4px)`,top:"-25px",transform:"translateX(-100%)"}:{left:`calc(${o}/7*100% + 3px)`,top:`${e.lane*a}px`};return jsxs("div",{className:n?"cal-more en-cabecera":"cal-more",style:i,role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r?()=>r(e):void 0,children:["+",e.count," ",s==="en"?"more":"m\xE1s"]})}function Bb({projects:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-legend",children:[e.map(r=>jsxs("span",{children:[jsx("span",{className:"dot",style:{background:r.color}}),r.id?`${r.id} `:"",r.name]},r.id||r.name)),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25A3"})," ",a?"Critical path":"Ruta cr\xEDtica"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--cyan)"},children:"\u25C6"})," ",a?"Milestone":"Hito"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--red)"},children:"\u2691"})," ",a?"Due date":"Vencimiento"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--txt2)"},children:"\u25CB"})," ",a?"External event":"Evento externo"]}),jsxs("span",{children:[jsx("i",{style:{color:"var(--orange)"},children:"\u2298"})," ",a?"Absence":"Ausencia"]})]})}var g5=[{id:"mes",es:"Mes",en:"Month",key:"M"},{id:"semana",es:"Semana",en:"Week",key:"W"},{id:"lookahead",es:"Pr\xF3ximas semanas",en:"Lookahead",key:"2"},{id:"agenda",es:"Agenda",en:"Agenda",key:"A"}];function fp({view:e,onViewChange:t,money:a,onMoneyChange:r,mostrarConmutadorDeDinero:n,projectLabel:s,locale:o="es",enCabecera:i=false,hiddenViews:c=[]}){let l=o==="en",u=g5.filter(p=>!c.includes(p.id));return i?jsxs(Fragment,{children:[jsx("div",{className:"cal-seg",children:u.map(p=>jsx("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),title:`${l?p.en:p.es} (${p.key})`,children:l?p.en:p.es},p.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]}):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:u.map(p=>jsxs("button",{type:"button",className:e===p.id?"on":"",onClick:()=>t(p.id),children:[l?p.en:p.es,jsx("span",{className:"key",children:p.key})]},p.id))}),n!==false&&jsxs("div",{className:"cal-seg",children:[jsx("button",{type:"button",className:a==="$"?"":"on",onClick:()=>r("hrs"),children:"Hrs"}),jsx("button",{type:"button",className:a==="$"?"on":"",onClick:()=>r("$"),children:"$"})]})]})}function $b({monthLabel:e,onPrev:t,onNext:a,onToday:r,layersOpen:n,onToggleLayers:s,layersOff:o,phases:i,phaseFilter:c="all",onPhaseChange:l,locale:u="es",children:p}){let d=o?o.length:0,[m,f]=useState(false),v=useRef(null),b=u==="es";useEffect(()=>{if(!m)return;let h=x=>{v.current&&!v.current.contains(x.target)&&f(false);};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[m]);let w=c==="all"?b?"Todas":"All":i?.find(h=>h.id===c)?.name??(b?"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:a,"aria-label":"Periodo siguiente",children:"\u203A"})]}),jsx("div",{className:"cal-month-label",children:e}),jsx("button",{type:"button",className:"cal-hoy",onClick:r,children:b?"Hoy":"Today"}),jsx("div",{className:"cal-vsep"}),i&&i.length>0&&l?jsxs("div",{className:"relative",ref:v,style:{position:"relative"},children:[jsxs("button",{type:"button",className:"cal-ftog",onClick:()=>f(h=>!h),style:c!=="all"?{borderColor:"var(--cyan)",color:"var(--cyan)"}:void 0,children:[jsx("b",{children:b?"Fase":"Phase"})," ",w," \u25BE"]}),m?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:c==="all"?"var(--cyan)":"var(--txt)"},onClick:()=>{l("all"),f(false);},children:jsx("span",{className:"nm",children:b?"Todas las fases":"All phases"})}),i.map(h=>jsx("button",{type:"button",className:"cal-layer-row",style:{width:"100%",textAlign:"left",background:"transparent",border:0,cursor:"pointer",color:c===h.id?"var(--cyan)":"var(--txt)"},onClick:()=>{l(h.id),f(false);},children:jsx("span",{className:"nm",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:h.name})},h.id))]}):null]}):null,p,jsx("div",{className:"cal-toolbar-right",children:jsxs("button",{type:"button",className:"cal-layers-btn"+(n?" open":""),onClick:s,children:["\u25E7 ",b?"Capas":"Layers"," ",jsxs("span",{className:"n",children:[6-d,"/6"]})]})})]})}var f5=[{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 Ob({off:e,onToggle:t}){let a=e||[];return jsx("div",{className:"cal-pop cal-layers-pop",style:{position:"absolute",top:"42px",right:"20px",zIndex:30},children:f5.map(r=>{let n=a.includes(r.id);return jsxs("div",{className:"cal-layer-row"+(n?" off":""),onClick:()=>t(r.id),children:[jsx("span",{className:"sw",style:{background:r.sw,opacity:n?.3:1}}),jsxs("div",{children:[jsx("div",{className:"nm",children:r.nm}),jsx("div",{className:"sub",children:r.sub})]}),jsx("span",{className:"cal-switch"+(n?"":" on")})]},r.id)})})}var x5={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"},v5={hito:"var(--cyan)",desembolso:"var(--cyan)",deadline:"var(--red)",ext:"var(--txt2)",aus:"var(--orange)"};function Wb({dayLabel:e,items:t,tasks:a=[],itemValue:r,onClose:n,style:s,locale:o="es"}){let i=o==="en",c=useRef(null);useEffect(()=>{function d(f){c.current&&!c.current.contains(f.target)&&n();}function m(f){f.key==="Escape"&&n();}return document.addEventListener("mousedown",d),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",m);}},[n]);let l=a.length+t.length,p=r||(d=>{switch(d.type){case "hito":return i?"Milestone":"Hito";case "desembolso":return i?"Disb.":"Desemb.";case "deadline":return i?"Due":"Vence";case "aus":return i?"Absence":"Ausencia";case "ext":default:return ""}});return jsxs("div",{ref:c,className:"cal-pop",style:{position:"absolute",width:"320px",zIndex:30,...s},role:"dialog","aria-label":`${e} \xB7 ${l} ${i?"items":"elementos"}`,children:[jsx("div",{className:"cal-pop-head",children:jsxs("div",{className:"sup",children:[e," \xB7 ",l," ",i?l===1?"item":"items":l===1?"elemento":"elementos"]})}),jsxs("div",{className:"cal-pop-list",children:[a.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:v5[d.type]},children:x5[d.type]}),jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label}),jsx("span",{className:"v",children:p(d)})]},`i${m}`)),jsx("div",{className:"cal-scrollbar"})]})]})}var Hb={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 zb({monthLabel:e,upcomingMilestones:t=[],locale:a="es",onCreateTask:r,irAPrimera:n}){let s=Hb[a]||Hb.es;return jsxs("div",{className:"cal-empty",children:[jsx("div",{className:"glyph",children:"\u25C7 \u25C7 \u25C7"}),jsx("h3",{children:s.title}),jsxs("p",{children:[s.body,jsx("br",{}),jsx("b",{children:e})]}),n?jsx("button",{type:"button","data-ir-a-primera":true,className:"cal-empty-crear",onClick:n.onClick,children:a==="en"?`Go to the first (${n.mes}) \u2192`:`Ir a la primera (${n.mes}) \u2192`}):null,r?jsx("button",{type:"button",className:"cal-empty-crear",onClick:r,children:s.crear}):null,t.length>0?jsxs("div",{className:"cal-empty-hitos",children:[jsx("div",{className:"hd",children:s.upcoming}),t.map((o,i)=>jsxs("div",{className:"cal-empty-hito",children:[jsx("span",{className:"ic "+(o.type==="deadline"?"rd":"cy"),children:o.type==="deadline"?"\u2691":"\u25C6"}),o.label,jsx("span",{className:"d",children:o.date})]},i))]}):null]})}function jb(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function C5(e){return ba(e)}var Ub=["#00E5CC","#8B5CF6","#F97316","#22C55E","#EF4444","#EC4899","#F59E0B","#3B82F6"];function T5(e){return Ub[e%Ub.length]}function D5(e){return e>1?"over":e>=.9?"warn":"ok"}var bp="\xA0";function ts(e){return un(Math.round(e*60),"es")}function N5(e){return `${e.toLocaleDateString("es",{weekday:"short"}).replace(/\.$/,"")} ${zr(e,"es")}`}function Vb(e,t,a){let r=new Map,n=new Set;for(let i of t)i.isWeekend||i.isHoliday||n.add(jb(i.date));if(n.size===0)return r;let s=new Map;e.forEach((i,c)=>{s.set(i.userId,{color:T5(c),initials:C5(i.name)});});let o=new Map;for(let i of e)for(let c of i.dailyEstimated){if(!c.date||!n.has(c.date))continue;o.has(c.date)||o.set(c.date,new Map);let l=o.get(c.date);l.set(i.userId,(l.get(i.userId)??0)+(c.hours||0));}for(let i of n){let c=o.get(i)??new Map,l=e.map(p=>{let d=s.get(p.userId);return {name:p.name,initials:d.initials,color:d.color,hours:Math.round((c.get(p.userId)??0)*100)/100,capacity:a}}),u=l.reduce((p,d)=>p+d.hours,0);r.set(i,{assigned:Math.round(u*100)/100,capacity:a*e.length,perPerson:l});}return r}function Gb({days:e,capByDay:t,selectedKey:a,onSelectDay:r}){return jsx("div",{className:"cal-cap-row",children:e.map(n=>{let s=jb(n.date),o=n.isWeekend||n.isHoliday,i=o?void 0:t.get(s),c=!!i&&i.capacity>0,l=c?i.assigned/i.capacity:0,p="cal-cap-cell "+(o?"off":D5(l))+(a===s?" sel":""),d=N5(n.date);return jsxs("div",{className:p,role:c&&r?"button":void 0,tabIndex:c&&r?0:void 0,title:o?void 0:d,onClick:m=>{!c||!r||r(s,d,m.currentTarget);},onKeyDown:m=>{!c||!r||(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),r(s,d,m.currentTarget));},children:[jsx("div",{className:"nums",children:o||!c?jsx("span",{children:o?"\u2014":`${ts(0)}${bp}/${bp}\u2014`}):jsxs(Fragment,{children:[jsx("b",{children:ts(i.assigned)}),jsxs("span",{children:["/",bp,ts(i.capacity)]})]})}),jsx("div",{className:"cal-cap-track",children:c?jsx("div",{className:"cal-cap-fill",style:{width:Math.min(l*100,100)+"%"}}):null})]},n.serial)})})}function _b({dayLabel:e,perPerson:t,onClose:a,style:r}){let n=useRef(null);useEffect(()=>{let l=p=>{p.key==="Escape"&&a();},u=p=>{n.current&&!n.current.contains(p.target)&&a();};return document.addEventListener("keydown",l),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",l),document.removeEventListener("mousedown",u);}},[a]);let s=t.reduce((l,u)=>l+u.hours,0),o=t.reduce((l,u)=>l+u.capacity,0),i=o>0&&s>o,c=Math.round((s-o)*10)/10;return jsxs("div",{ref:n,className:"cal-pop",role:"dialog",style:{position:"absolute",width:"276px",zIndex:30,...r},children:[jsxs("div",{className:"cal-pop-head",children:[jsxs("div",{className:"sup",children:["Capacidad \xB7 ",e]}),jsxs("div",{className:"tit",style:i?{color:"var(--red)"}:void 0,children:[ts(s)," asignadas / ",ts(o)]}),i?jsx("div",{className:"rng",children:jsxs("b",{children:["+",ts(c)," sobre capacidad"]})}):jsxs("div",{className:"rng",children:[t.length," ",t.length===1?"persona":"personas"]})]}),jsx("div",{children:t.map(l=>{let u=l.capacity>0&&l.hours>l.capacity,p=l.capacity>0?l.capacity:1;return jsxs("div",{className:u?"cal-person-row over":"cal-person-row",children:[jsx("span",{className:"pava",style:{background:l.color},children:l.initials}),jsx("span",{className:"nm",title:l.name,children:l.name}),jsx("div",{className:"cal-person-track",children:jsx("div",{className:"cal-person-fill",style:{width:Math.min(l.hours/p*100,100)+"%"}})}),jsxs("span",{className:"hrs",children:[ts(l.hours)," / ",ts(l.capacity)]})]},l.name)})})]})}var hp=28,E5=182;function qb({grid:e,weeks:t,tasks:a,items:r,money:n,projColor:s,todaySerial:o,locale:i,capRows:c,teamSize:l,onTaskOpen:u,onMore:p,onCapDay:d}){let m=i==="es";return jsxs("div",{className:"cal-grid-zone",style:{position:"relative"},children:[jsx("div",{className:"cal-weeks",style:{flex:"none"},children:t.map((f,v)=>jsxs("div",{style:{display:"contents"},children:[jsx(M5,{grid:e,ws:f.ws,we:f.we,tasks:a,items:r,money:n,projColor:s,todaySerial:o,onTaskOpen:u,onMore:p,locale:i}),c&&c[v]?jsx(Gb,{days:c[v].days,capByDay:c[v].capByDay,onSelectDay:d}):null]},f.ws))}),jsxs("div",{className:"cal-cap-label",children:[jsxs("span",{children:[m?"Capacidad del equipo":"Team capacity",l!=null?` \xB7 ${l} ${m?l===1?"persona":"personas":l===1?"person":"people"}`:""]}),jsx("span",{children:m?"Click en un d\xEDa abre el desglose por persona":"Click a day to open the per-person breakdown"})]})]})}function M5({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,onTaskOpen:c,onMore:l,locale:u="es"}){let p=useMemo(()=>Wc(r,n,t,a),[r,n,t,a]),d=useMemo(()=>new Set(n.filter(v=>v.type==="deadline").map(v=>v.serial)),[n]),m=[];for(let v=t;v<=a;v++)m.push(v);let f={height:`${E5}px`,flex:"none"};return jsxs("div",{className:"cal-week",style:f,children:[jsx("div",{className:"cal-week-bg",children:m.map(v=>{let b=e.serialToDate(v),w=v>=e.monthStartSerial&&v<=e.monthEndSerial,h="cal-day";return rl(e,v)&&(h+=" wknd"),w||(h+=" out"),v===i&&(h+=" today"),d.has(v)&&(h+=" deadline-day"),jsx("div",{className:h,children:jsx("span",{className:"cal-day-num",children:b.getDate()})},v)})}),jsxs("div",{className:"cal-items",children:[p.bars.map((v,b)=>jsx("div",{onClick:()=>c?.(v.t.uid),style:{cursor:c?"pointer":"default",display:"contents"},children:jsx(jc,{bar:v,ws:t,money:s,projColor:o,slotH:hp,locale:u})},`b${b}`)),p.chips.map((v,b)=>jsx(Vc,{chip:v,ws:t,slotH:hp},`c${b}`)),p.more.map((v,b)=>jsx(Gc,{more:v,ws:t,slotH:hp,onClick:()=>l(v.day,v.items,r.filter(w=>w.startSerial<=v.day&&w.endSerial>=v.day))},`m${b}`))]})]})}var P5=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function F5(e){return P5.test(e)||/^task-\d+/.test(e)}function L5(e){return ba(e)}function A5(e){let t=[],a=r=>{for(let n of r)t.push(n),n.subtasks?.length&&a(n.subtasks);};return a(e),t}function Yb(e,t,a="es",r){let n=A5(e),s=[];for(let o of n){if(o.startDate&&o.endDate)continue;let i=o.effortMinutes??0,c=Math.round(i/60*10)/10,l=o.costAtCompletion,u=l!=null?nl(l,a,r):nl(c*t,a,r),p=o.assignees?.[0],d=p?.initials||(p?.name?L5(p.name):void 0),m=o.displayId||o.wbsCode||"",f=F5(m||o.id)?"":m||o.id;s.push({taskId:o.id,id:f,name:o.name,hrs:c,cost:u,who:d,projColor:o.color});}return s}function Xb({items:e,onItemClick:t,onCollapse:a,money:r,projColor:n,locale:s="es"}){let o=s==="en";return jsxs("div",{className:"cal-side",children:[jsxs("div",{className:"cal-side-head",children:[jsxs("span",{className:"t",children:["\u26A1 Backlog \xB7 ",o?"No date":"Sin fecha"]}),jsx("button",{type:"button",className:"cal-pcollapse",onClick:a,title:o?"Collapse panel":"Colapsar panel",children:"\u27E9"})]}),jsxs("div",{className:"cal-side-sec",children:[jsx("span",{children:o?"Drag onto the calendar":"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(i=>{let c=r==="$"?i.cost:Ss(i.hrs,s);return jsxs("div",{className:"cal-card",role:"button",tabIndex:0,onClick:()=>t(i.taskId),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),t(i.taskId));},children:[jsxs("div",{className:"row1",children:[i.id?jsx("span",{className:"tk",children:i.id}):null,jsx("span",{className:"pdot",style:{background:i.projColor||n}})]}),jsx("div",{className:"nom",children:i.name}),jsxs("div",{className:"meta",children:[jsxs("span",{children:[jsx("b",{children:Ss(i.hrs,s)})," est"]}),jsx("span",{children:c}),i.who?jsx("span",{className:"cal-ava",children:i.who}):null]})]},i.taskId)})]})}function Jb({onExpand:e,locale:t="es"}){let a=t==="en";return jsxs("div",{className:"cal-rail",role:"button",tabIndex:0,onClick:e,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),e());},title:a?"Expand backlog":"Expandir backlog",children:[jsx("span",{className:"pc",children:"\u27E8"}),jsx("span",{className:"dot"}),jsxs("span",{className:"vtxt",children:["Backlog \xB7 ",a?"Status":"Estado"]})]})}function di(e,t){return zr(e,t)}function Qb({taskName:e,taskId:t,sim:a,busy:r,locale:n,onConfirm:s,onCancel:o,style:i}){let c=useRef(null),l=n==="es";useEffect(()=>{let f=v=>{v.key==="Escape"&&o();};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[o]);let u=a.wasCritical,p=a.projectEndDeltaDays,d=p>0?`+${p} ${l?p===1?"d\xEDa":"d\xEDas":p===1?"day":"days"} \xB7 ${di(a.oldProjectEnd,n)} \u2192 ${di(a.newProjectEnd,n)}`:`+0 ${l?"d\xEDas":"days"}${a.slackDays>0?` \xB7 ${l?"holgura":"slack"} ${a.slackDays}d`:""}`,m=p>0?l?`Confirmar +${p} ${p===1?"d\xEDa":"d\xEDas"}`:`Confirm +${p} ${p===1?"day":"days"}`:l?"Confirmar movimiento":"Confirm move";return jsxs("div",{ref:c,className:"cal-pop",style:{width:"324px",zIndex:60,...i},role:"dialog",children:[jsxs("div",{className:"cal-pop-head",children:[jsx("div",{className:"sup",children:l?"Confirmar movimiento":"Confirm move"}),jsxs("div",{className:"tit",children:[t?`${t} \xB7 `:"",e]}),jsxs("div",{className:"rng",children:[di(a.oldStart,n)," \u2013 ",di(a.oldEnd,n)," \u2192 ",jsxs("b",{children:[di(a.newStart,n)," \u2013 ",di(a.newEnd,n)]})]})]}),u?jsxs("div",{className:"cal-pop-warn",children:["\u26A0 ",l?"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:l?"Tareas sucesoras movidas":"Successor tasks moved"}),jsx("span",{className:"v",children:a.movedSuccessors.length===0?l?"Ninguna":"None":`${a.movedSuccessors.length}${a.movedSuccessors.length<=2?" \xB7 "+a.movedSuccessors.map(f=>f.name).join(", "):""}`})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Fin de proyecto":"Project end"}),jsx("span",{className:p>0?"v bad":"v good",children:d})]}),jsxs("div",{className:"cal-impact-row",children:[jsx("span",{className:"k",children:l?"Ruta cr\xEDtica":"Critical path"}),jsx("span",{className:"v",children:a.stillCritical?l?"Sigue en CPM":"Stays critical":a.wasCritical?l?"Sale de CPM":"Leaves critical":l?`No entra \xB7 holgura ${a.slackDays}d`:`Not critical \xB7 slack ${a.slackDays}d`})]})]}),jsxs("div",{className:"cal-pop-actions",children:[jsx("button",{type:"button",className:"cal-btn",onClick:o,disabled:r,children:l?"Cancelar":"Cancel"}),jsx("button",{type:"button",className:u||p>0?"cal-btn danger":"cal-btn primary",onClick:s,disabled:r,children:r?l?"Guardando\u2026":"Saving\u2026":m})]})]})}var $5={hito:"\u25C6",desembolso:"\u25C6",deadline:"\u2691",ext:"\u25CB",aus:"\u2298"};function Zb({grid:e,tasks:t,items:a,money:r,projColor:n,todaySerial:s,locale:o,onTaskOpen:i}){let c=o==="es",l=useMemo(()=>{let p=new Map,d=m=>(p.has(m)||p.set(m,{serial:m,date:e.serialToDate(m),tasks:[],items:[]}),p.get(m));for(let m of t)m.startSerial>=1&&m.startSerial<=42&&d(m.startSerial).tasks.push(m);for(let m of a)m.serial>=1&&m.serial<=42&&d(m.serial).items.push(m);return [...p.values()].filter(m=>m.tasks.length||m.items.length).sort((m,f)=>m.serial-f.serial)},[t,a,e]);if(l.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:c?"Nada programado este mes":"Nothing scheduled this month"}),jsx("p",{children:c?"Cambia de mes con las flechas o crea tareas en el Gantt.":"Change month with the arrows or create tasks in the Gantt."})]});let u=p=>p.toLocaleDateString(c?"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:l.map(p=>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:p.serial===s?"var(--cyan)":"var(--txt2)",padding:"12px 20px 6px"},children:[u(p.date),p.serial===s?` \xB7 ${c?"HOY":"TODAY"}`:""]}),p.tasks.map(d=>jsxs("button",{type:"button",onClick:()=>i?.(d.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:d.color??n,flex:"none"}}),d.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,d.id?jsx("span",{style:{fontFamily:"var(--mono)",fontSize:9,color:"var(--txt2)"},children:d.id}):null,jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.name}),jsx("span",{style:{fontFamily:"var(--mono)",fontSize:10,color:"var(--txt2)"},children:r==="$"?d.cost:Ss(d.hrs,o)})]},d.uid)),p.items.map((d,m)=>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:$5[d.type]??"\xB7"}),jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:d.label})]},`it${m}`))]},p.serial))})}function O5(e){let t=[],a=r=>r.forEach(n=>{t.push(n),n.subtasks?.length&&a(n.subtasks);});return a(e),t}function _c(e){let t=e.dependencies;return Array.isArray(t)?t.map(a=>typeof a=="string"?a:a?.id).filter(a=>!!a):[]}function yp(e){let t=e.startDate?new Date(e.startDate):null,a=e.endDate?new Date(e.endDate):null;return !t||!a?1:Math.max(1,Math.round((a.getTime()-t.getTime())/864e5))}function eh(e,t){let a=new Map(e.map(l=>[l.id,l])),r=new Map;for(let l of e)for(let u of _c(l))r.has(u)||r.set(u,[]),r.get(u).push(l.id);let n=new Map,s=new Map,o=new Set,i=l=>{if(s.has(l))return s.get(l);if(o.has(l))return s.get(l)??0;o.add(l);let u=a.get(l);if(!u)return o.delete(l),0;let p=_c(u).filter(f=>a.has(f)),d=t.has(l)?t.get(l):u.startDate?new Date(u.startDate).getTime():0;for(let f of p){let v=i(f);v>d&&(d=v);}let m=yp(u)*864e5;return n.set(l,d),s.set(l,d+m),o.delete(l),s.get(l)};for(let l of e)i(l.id);let c=0;return s.forEach(l=>{l>c&&(c=l);}),{finish:s,start:n,projectEnd:c}}function th(e,t,a){let r=new Map(e.map(c=>[c.id,c])),n=new Map;for(let c of e)for(let l of _c(c))n.has(l)||n.set(l,[]),n.get(l).push(c.id);let s=new Map,o=[...e].sort((c,l)=>(t.get(l.id)??0)-(t.get(c.id)??0));for(let c of o){let l=n.get(c.id)??[];if(l.length===0)s.set(c.id,a);else {let u=1/0;for(let p of l){let d=s.get(p),m=r.get(p);d!=null&&m&&(u=Math.min(u,d-yp(m)*864e5));}s.set(c.id,u===1/0?a:u);}}let i=new Set;for(let c of e){let l=(s.get(c.id)??0)-(t.get(c.id)??0);Math.abs(l)<864e5/2&&_c(c).length+(n.get(c.id)?.length??0)>0&&i.add(c.id);}return i}function Kc(e,t,a,r){let n=O5(e),s=n.find(w=>w.id===t);if(!s||!s.startDate||!s.endDate)return null;let o=new Date(s.startDate),i=new Date(s.endDate),c=eh(n,new Map),l=th(n,c.finish,c.projectEnd),u=n.map(w=>w.id===t?{...w,startDate:a,endDate:r}:w),p=eh(u,new Map([[t,a.getTime()]])),d=th(u,p.finish,p.projectEnd),m=new Map(u.map(w=>[w.id,w])),f=[];for(let w of n){if(w.id===t)continue;let h=c.start.get(w.id),x=p.start.get(w.id);if(h!=null&&x!=null&&Math.abs(x-h)>=864e5/2){let y=yp(m.get(w.id))*864e5;f.push({id:w.id,name:w.name,newStart:new Date(x),newEnd:new Date(x+y)});}}let v=Math.round((p.projectEnd-c.projectEnd)/864e5),b=l.has(t)?0:Math.max(0,Math.round((c.projectEnd-(c.finish.get(t)??0))/864e5));return {taskId:t,oldStart:o,oldEnd:i,newStart:a,newEnd:r,movedSuccessors:f,projectEndDeltaDays:v,oldProjectEnd:new Date(c.projectEnd),newProjectEnd:new Date(p.projectEnd),wasCritical:l.has(t),stillCritical:d.has(t),slackDays:b}}function rh(e){return `${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var oh=132,qc=26,vp=20,W5="#5B7FD4";function sh({tasks:e,projectName:t,projectId:a,projectColor:r,locale:n,themeMode:s,hourlyRate:o,money:i,onMoneyChange:c,onTaskOpen:l,toolbarContainer:u,hiddenViews:p,mostrarFiltroDeFases:d,mostrarConmutadorDeDinero:m,onCreateTask:f,canReschedule:v,onReschedule:b,members:w=[],holidayDates:h=[],timesheetSettings:x,onVisibleRangeChange:y,monthMode:k="span",showValues:M=true,openOnToday:H=false,currencyCode:E}){let N=useRef(null),[D,S]=useState(0);useEffect(()=>{if(k!=="due")return;let ke=N.current;if(!ke||typeof ResizeObserver>"u")return;let Te=new ResizeObserver(()=>S(ke.clientHeight));return Te.observe(ke),S(ke.clientHeight),()=>Te.disconnect()});let[V,W]=useState("mes"),[R,A]=useState(()=>{let ke=new Date,Te={y:ke.getFullYear(),m:ke.getMonth()};if(H)return Te;let gt=(e??[]).map(I=>I.startDate?new Date(I.startDate):null).filter(I=>!!I&&!isNaN(I.getTime()));if(gt.length===0||(e??[]).some(I=>{let te=I.startDate?new Date(I.startDate):null,Re=I.endDate?new Date(I.endDate):te;if(!te||isNaN(te.getTime()))return false;let Ee=new Date(Te.y,Te.m,1),_e=new Date(Te.y,Te.m+1,0,23,59,59);return te<=_e&&(Re??te)>=Ee}))return Te;let Lt=gt.reduce((I,te)=>I<te?I:te);return {y:Lt.getFullYear(),m:Lt.getMonth()}}),[ve,q]=useState(false),[le,B]=useState([]),[pe,nt]=useState("all"),[Ue,$]=useState(null),[fe,ie]=useState(null),[et,Xe]=useState(false),[Qe,ct]=useState(null),[Tt,_t]=useState(false),tt=useMemo(()=>Lb(R.y,R.m),[R.y,R.m]),xt=r||W5,Jt=useMemo(()=>{let ke=new Set;for(let Te of h){let gt=new Date(`${Te}T12:00:00`),Ie=tt.dateToSerial(gt);Ie>=1&&Ie<=42&&ke.add(Ie);}return ke},[h,tt]);useEffect(()=>{y?.({start:rh(tt.serialToDate(1)),end:rh(tt.serialToDate(42))});},[R.y,R.m]);let Wt=w.length,Qt=useMemo(()=>{let ke=x?.hoursPerDay;if(!ke)return 8;let Te=[ke.monday,ke.tuesday,ke.wednesday,ke.thursday,ke.friday].map(gt=>gt||0).filter(gt=>gt>0);return Te.length?Math.round(Te.reduce((gt,Ie)=>gt+Ie,0)/Te.length*10)/10:8},[x]),Y=useMemo(()=>zc({tasks:e,grid:tt,projectColor:()=>xt,hourlyRate:o,projectId:a,locale:n,currencyCode:E}),[e,tt,xt,o,a,n,E]),Le=useMemo(()=>{if(d===false)return [];let ke=new Map;for(let Te of Y.calTasks)Te.phaseId&&Te.phaseName&&ke.set(Te.phaseId,Te.phaseName);return [...ke.entries()].map(([Te,gt])=>({id:Te,name:gt})).sort((Te,gt)=>Te.name.localeCompare(gt.name))},[Y.calTasks,d]),Ye=!le.includes("tareas"),he=!le.includes("cpm"),dt=useMemo(()=>{let ke=Ye?Y.calTasks:[];return pe!=="all"&&(ke=ke.filter(Te=>Te.phaseId===pe)),he||(ke=ke.map(Te=>Te.critical?{...Te,critical:false}:Te)),ke},[Y.calTasks,Ye,he,pe]),wt=useMemo(()=>{let ke=new Set;return le.includes("hitos")&&(ke.add("hito"),ke.add("desembolso")),le.includes("ext")&&ke.add("ext"),le.includes("aus")&&ke.add("aus"),Y.dayItems.filter(Te=>!ke.has(Te.type))},[Y.dayItems,le]),ue=!le.includes("festivos"),ce=new Date,Ae=tt.dateToSerial(new Date(ce.getFullYear(),ce.getMonth(),ce.getDate())),Et=ke=>B(Te=>Te.includes(ke)?Te.filter(gt=>gt!==ke):[...Te,ke]),Pe=()=>A(ke=>{let Te=new Date(ke.y,ke.m-1,1);return {y:Te.getFullYear(),m:Te.getMonth()}}),ut=()=>A(ke=>{let Te=new Date(ke.y,ke.m+1,1);return {y:Te.getFullYear(),m:Te.getMonth()}}),O=()=>{let ke=new Date;A({y:ke.getFullYear(),m:ke.getMonth()});},re=useMemo(()=>{let ke=(e??[]).flatMap(Te=>[Te.startDate,Te.endDate]).map(Te=>Te?new Date(Te):null).filter(Te=>!!Te&&!isNaN(Te.getTime()));return ke.length?ke.reduce((Te,gt)=>Te<gt?Te:gt):null},[e]),we=(ke,Te,gt)=>{if(!v||Te===0)return;let Ie=Y.calTasks.find(Ee=>Ee.uid===ke);if(!Ie)return;let Lt=Te*864e5,I=new Date(Ie.realStart.getTime()+Lt),te=new Date(Ie.realEnd.getTime()+Lt),Re=Kc(e,ke,I,te);Re&&ct({uid:ke,taskId:Ie.id,taskName:Ie.name,sim:Re,anchor:gt});},ot=async()=>{if(!Qe||!b)return;_t(true);let ke=[{id:Qe.uid,startDate:Qe.sim.newStart,endDate:Qe.sim.newEnd},...Qe.sim.movedSuccessors.map(gt=>({id:gt.id,startDate:gt.newStart,endDate:gt.newEnd}))],Te=await b(ke);_t(false),Te&&ct(null);},mt=Rb(R.y,R.m,n),Ht=[{id:"",name:t,color:xt}],Zt=useMemo(()=>Yb(e,o,n,E),[e,o,n,E]),Oe=useMemo(()=>{if(V==="lookahead"){let ke=tt.weeks.find(gt=>Ae>=gt.ws&&Ae<=gt.we)??tt.weeks[0],Te=tt.weeks.indexOf(ke);return tt.weeks.slice(Te,Te+2)}return V==="semana"?[tt.weeks.find(Te=>Ae>=Te.ws&&Ae<=Te.we)??tt.weeks[0]]:[]},[V,tt.weeks,Ae]),Wa=useMemo(()=>{let ke={};return Oe.forEach((Te,gt)=>{let Ie=[];for(let I=Te.ws;I<=Te.we;I++)Ie.push({serial:I,date:tt.serialToDate(I),isWeekend:rl(tt,I),isHoliday:Jt.has(I)});let Lt=Vb(w,Ie,Qt);ke[gt]={days:Ie,capByDay:Lt};}),ke},[Oe,tt,Jt,w,Qt]),la=V==="semana"||V==="lookahead",da=V==="agenda";return jsxs("div",{className:`cal-app${s==="light"?" cal-light":""}`,children:[u?createPortal(jsx("div",{className:`cal-app cal-en-cabecera${s==="light"?" cal-light":""}`,children:jsx(fp,{enCabecera:true,hiddenViews:p,view:V,onViewChange:W,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ke=>c(ke==="$"?"$":"Hrs"),projectLabel:t,locale:n})}),u):jsx(fp,{view:V,onViewChange:W,money:i==="$"?"$":"hrs",mostrarConmutadorDeDinero:m,onMoneyChange:ke=>c(ke==="$"?"$":"Hrs"),projectLabel:t,locale:n,hiddenViews:p}),jsx($b,{monthLabel:mt,onPrev:Pe,onNext:ut,onToday:O,layersOpen:ve,onToggleLayers:()=>q(ke=>!ke),layersOff:le,phases:Le,phaseFilter:pe,onPhaseChange:nt,locale:n,children:ve?jsx(Ob,{off:le,onToggle:Et}):null}),jsxs("div",{className:"cal-body",children:[jsxs("div",{className:"cal-grid-zone",style:{position:"relative",overflow:da?"hidden":void 0},children:[da?jsx(Zb,{grid:tt,tasks:dt,items:wt,money:i,projColor:xt,todaySerial:Ae,locale:n,onTaskOpen:l}):la?jsxs(Fragment,{children:[jsx(Uc,{locale:n}),jsx(qb,{grid:tt,weeks:Oe,tasks:dt,items:wt,money:i,projColor:xt,todaySerial:Ae,locale:n,capRows:Wa,teamSize:Wt,onTaskOpen:l,onMore:(ke,Te,gt)=>$({day:ke,items:Te,tasks:gt}),onCapDay:(ke,Te,gt)=>{for(let Ie of Object.keys(Wa)){let Lt=Wa[+Ie].capByDay.get(ke);if(Lt){ie({dayLabel:Te,perPerson:Lt.perPerson,anchor:gt.getBoundingClientRect()});break}}}})]}):Y.isEmpty?jsxs(Fragment,{children:[jsx(Uc,{locale:n}),jsx("div",{className:"cal-weeks",children:tt.weeks.map(ke=>jsx("div",{className:"cal-week",style:{minHeight:k==="due"?0:`${oh}px`},children:jsx(ih,{grid:tt,ws:ke.ws,we:ke.we,todaySerial:Ae,showFestivos:ue,holidaySerials:Jt,locale:n,deadlineDays:new Set})},ke.ws))}),jsx(zb,{monthLabel:mt,locale:n,onCreateTask:f,irAPrimera:re?{mes:re.toLocaleDateString(n==="en"?"en":"es",{month:"long",year:re.getFullYear()!==new Date().getFullYear()?"numeric":void 0}),onClick:()=>A({y:re.getFullYear(),m:re.getMonth()})}:void 0})]}):jsxs(Fragment,{children:[jsx(Uc,{locale:n}),jsx("div",{className:"cal-weeks",ref:N,style:k==="due"?{minHeight:0,overflow:"hidden"}:void 0,children:tt.weeks.map(ke=>jsx(z5,{due:k==="due",slots:D>0?Math.max(1,Math.floor((D/tt.weeks.length-26)/vp)):2,showValues:M,grid:tt,ws:ke.ws,we:ke.we,tasks:dt,items:wt,money:i,projColor:xt,todaySerial:Ae,showFestivos:ue,holidaySerials:Jt,locale:n,onTaskOpen:l,onMore:(Te,gt,Ie)=>$({day:Te,items:gt,tasks:Ie}),canReschedule:v,onDragReschedule:we,pendingGhost:Qe?{uid:Qe.uid,days:Math.round((Qe.sim.newStart.getTime()-Qe.sim.oldStart.getTime())/864e5)}:null},ke.ws))})]}),Ue?jsx(Wb,{dayLabel:`${tt.serialToDate(Ue.day).getDate()}`,items:Ue.items,tasks:Ue.tasks.map(ke=>({swatch:xt,taskId:ke.id,label:ke.name,critical:ke.critical,value:i==="$"?ke.cost:`${ke.hrs}h`})),onClose:()=>$(null),style:{position:"absolute",top:"80px",left:"50%",transform:"translateX(-50%)",zIndex:40},locale:n==="en"?"en":"es"}):null,fe?jsx(_b,{dayLabel:fe.dayLabel,perPerson:fe.perPerson,onClose:()=>ie(null),style:{position:"fixed",top:`${fe.anchor.top-8}px`,left:`${fe.anchor.left}px`,transform:"translateY(-100%)",zIndex:50}}):null,Qe?jsx(Qb,{taskName:Qe.taskName,taskId:Qe.sim.taskId,sim:Qe.sim,busy:Tt,locale:n,onConfirm:ot,onCancel:()=>ct(null),style:{position:"fixed",top:`${Qe.anchor.top+12}px`,left:`${Math.min(Qe.anchor.left,window.innerWidth-340)}px`,zIndex:60}}):null]}),et?jsx(Xb,{items:Zt,money:i,projColor:xt,onItemClick:ke=>l?.(ke),onCollapse:()=>Xe(false),locale:n==="en"?"en":"es"}):jsx(Jb,{onExpand:()=>Xe(true),locale:n==="en"?"en":"es"})]}),jsx(Bb,{projects:Ht,locale:n==="en"?"en":"es"})]})}function ih({grid:e,ws:t,we:a,todaySerial:r,showFestivos:n,holidaySerials:s,deadlineDays:o}){let i=[];for(let c=t;c<=a;c++)i.push(c);return jsx("div",{className:"cal-week-bg",children:i.map(c=>{let l=e.serialToDate(c),u=c>=e.monthStartSerial&&c<=e.monthEndSerial,p=n&&s.has(c),d="cal-day";return rl(e,c)&&(d+=" wknd"),p&&(d+=" festivo"),u||(d+=" out"),c===r&&(d+=" today"),o.has(c)&&(d+=" deadline-day"),jsxs("div",{className:d,children:[jsx("span",{className:"cal-day-num",children:l.getDate()}),p?jsx("span",{className:"cal-day-tag",children:"Festivo"}):null]},c)})})}function z5({grid:e,ws:t,we:a,tasks:r,items:n,money:s,projColor:o,todaySerial:i,showFestivos:c,holidaySerials:l,locale:u,onTaskOpen:p,onMore:d,canReschedule:m,onDragReschedule:f,pendingGhost:v,due:b=false,slots:w=2,showValues:h=true}){let x=useMemo(()=>b?Ab(r,n,t,a,w):Wc(r,n,t,a),[r,n,t,a,b,w]),y=useMemo(()=>new Set(n.filter(D=>D.type==="deadline").map(D=>D.serial)),[n]),k=b?0:Math.max(oh,x.laneCount*qc+36),M=useRef(null),[H,E]=useState(null),N=(D,S)=>{if(!m||!f){p?.(S);return}D.preventDefault();let V=M.current;if(!V)return;let W=V.getBoundingClientRect().width/7,R=D.clientX,A=0,ve=le=>{let B=Math.round((le.clientX-R)/W);A=B,E({id:S,days:B});},q=le=>{if(window.removeEventListener("pointermove",ve),window.removeEventListener("pointerup",q),E(null),A===0){p?.(S);return}let B=new DOMRect(le.clientX,le.clientY,0,0);f(S,A,B);};window.addEventListener("pointermove",ve),window.addEventListener("pointerup",q);};return jsxs("div",{ref:M,className:"cal-week",style:{minHeight:`${k}px`},children:[jsx(ih,{grid:e,ws:t,we:a,todaySerial:i,showFestivos:c,holidaySerials:l,locale:u,deadlineDays:y}),jsxs("div",{className:"cal-items",children:[x.bars.map((D,S)=>{let V=H?.id===D.t.uid?H.days:null,W=v?.uid===D.t.uid?v.days:null,R=V??W??0,A=V==null&&W!=null,ve=R!==0?{...D,s:D.s+R,e:D.e+R}:D;return jsx("div",{onPointerDown:q=>N(q,D.t.uid),style:{cursor:m?"grab":p?"pointer":"default",display:"contents",opacity:A?.6:1},children:jsx(jc,{bar:ve,ws:t,money:s,projColor:o,slotH:b?vp:qc,due:b,showValues:h,locale:u})},`b${S}`)}),x.chips.map((D,S)=>jsx(Vc,{chip:D,ws:t,slotH:qc},`c${S}`)),x.more.map((D,S)=>jsx(Gc,{more:D,ws:t,slotH:b?vp:qc,enCabecera:b,locale:u,onClick:()=>d(D.day,D.items,b?r.filter(V=>!V.container&&V.endSerial===D.day):r.filter(V=>V.startSerial<=D.day&&V.endSerial>=D.day))},`m${S}`))]})]})}function j5({stack:e,cards:t,renderCard:a,onCardClick:r,onToggleExpand:n,onUnstack:s,onDeleteStack:o,className:i}){let[c,l]=useState(false),u=useMemo(()=>t.filter(m=>e.cardIds.includes(m.id)),[t,e.cardIds]),p=useMemo(()=>{let m=u.length,f=new Set(u.flatMap(w=>w.assignedUserIds||[])).size,v=u.map(w=>w.priority).filter(Boolean),b=new Set(u.flatMap(w=>w.labels||[])).size;return {totalCards:m,uniqueAssignees:f,priorities:v,labels:b}},[u]),d=()=>{n?.(e.id);};return jsxs("div",{className:g("card-stack",!e.isExpanded&&"card-stack-collapsed",i),onMouseEnter:()=>l(true),onMouseLeave:()=>l(false),style:{"--stack-color":e.color||"var(--color-accent-primary)"},children:[jsxs("div",{className:"card-stack-header",onClick:d,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:p.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"]})]}),c&&jsx("div",{className:"card-stack-actions",children:jsx("button",{className:"card-stack-action",onClick:m=>{m.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:[p.uniqueAssignees," assignees"]})]}),p.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:[p.labels," labels"]})]}),e.confidence&&jsx("div",{className:"card-stack-summary-item",children:jsxs("span",{className:"card-stack-confidence",children:[Math.round(e.confidence*100),"% match"]})})]}),e.isExpanded&&jsx("div",{className:"card-stack-content",children:u.length===0?jsxs("div",{className:"card-stack-empty",children:[jsx("p",{children:"No cards in this stack"}),jsx("span",{children:"Drag cards here or delete this stack"})]}):jsx("div",{className:"card-stack-cards",children:u.map(m=>jsxs("div",{className:"card-stack-card-wrapper",children:[a?jsx("div",{onClick:()=>r?.(m),children:a(m)}):jsxs("div",{className:"card-stack-default-card",onClick:()=>r?.(m),children:[jsx("h4",{children:m.title}),m.description&&jsxs("p",{children:[m.description.substring(0,100),"..."]})]}),jsx("button",{className:"card-stack-unstack-btn",onClick:f=>{f.stopPropagation(),s?.(e.id,m.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"})]})})]},m.id))})})]})}var ch={showIcons:true,showAvatars:true,groupByDay:true,useRelativeTime:true,compact:false};function sl(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 il(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 dh(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 uh({events:e,filter:t,onFilterChange:a,onClearFilter:r,onEventClick:n,selectedEventId:s,config:o,className:i}){let c=useMemo(()=>({...ch,...o}),[o]),[l,u]=useState(new Set),p=useRef(null),d=useMemo(()=>{if(!c.groupByDay)return [{date:null,events:e}];let h=new Map;return e.forEach(x=>{let y=x.timestamp.toISOString().split("T")[0],k=h.get(y);k?k.push(x):h.set(y,[x]);}),Array.from(h.entries()).sort((x,y)=>y[0].localeCompare(x[0])).map(([x,y])=>({date:new Date(x),events:y.sort((k,M)=>M.timestamp.getTime()-k.timestamp.getTime())}))},[e,c.groupByDay]),{uniqueUsers:m,uniqueTypes:f}=useMemo(()=>{let h=new Set,x=new Set;return e.forEach(y=>{h.add(y.userId),x.add(y.type);}),{uniqueUsers:Array.from(h),uniqueTypes:Array.from(x)}},[e]),v=h=>{u(x=>{let y=new Set(x);return y.has(h)?y.delete(h):y.add(h),y});},b=h=>{let y=new Date().getTime()-h.getTime(),k=Math.floor(y/6e4),M=Math.floor(y/36e5),H=Math.floor(y/864e5);return k<1?"just now":k<60?`${k}m ago`:M<24?`${M}h ago`:H<7?`${H}d ago`:h.toLocaleDateString()},w=useMemo(()=>{let h=0;return t.types&&t.types.length>0&&h++,t.users&&t.users.length>0&&h++,t.dateRange&&h++,t.searchTerm&&h++,h},[t]);return useEffect(()=>{if(s&&p.current){let h=p.current.querySelector(`[data-event-id="${s}"]`);h&&h.scrollIntoView({behavior:"smooth",block:"center"});}},[s]),e.length===0?jsxs("div",{className:g("history-timeline-empty",i),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",c.compact&&"compact",i),children:[jsxs("div",{className:"history-timeline-filters",children:[jsxs("div",{className:"history-timeline-filter-group",children:[jsxs("select",{className:"history-timeline-filter-select",value:t.types?.[0]||"",onChange:h=>{let x=h.target.value;a({...t,types:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Events"}),f.map(h=>jsxs("option",{value:h,children:[il(h)," ",h.replace("_"," ")]},h))]}),m.length>1&&jsxs("select",{className:"history-timeline-filter-select",value:t.users?.[0]||"",onChange:h=>{let x=h.target.value;a({...t,users:x?[x]:void 0});},children:[jsx("option",{value:"",children:"All Users"}),m.map(h=>jsx("option",{value:h,children:h},h))]}),jsx("input",{type:"text",className:"history-timeline-filter-search",placeholder:"Search history...",value:t.searchTerm||"",onChange:h=>a({...t,searchTerm:h.target.value})})]}),w>0&&jsxs("button",{className:"history-timeline-filter-clear",onClick:r,children:["Clear filters (",w,")"]})]}),jsx("div",{className:"history-timeline-container",ref:p,children:d.map(h=>jsxs("div",{className:"history-timeline-group",children:[c.groupByDay&&h.date&&jsxs("div",{className:"history-timeline-day-header",children:[jsx("span",{className:"history-timeline-day-date",children:h.date.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}),jsxs("span",{className:"history-timeline-day-count",children:[h.events.length," events"]})]}),jsx("div",{className:"history-timeline-events",children:h.events.map((x,y)=>{let k=l.has(x.id),M=s===x.id,H=dh(x.type);return jsxs("div",{"data-event-id":x.id,className:g("history-timeline-event",k&&"expanded",M&&"selected"),onClick:()=>n?.(x),children:[jsxs("div",{className:"history-timeline-line",children:[jsx("div",{className:"history-timeline-dot",style:{backgroundColor:H},children:c.showIcons&&jsx("span",{className:"history-timeline-dot-icon",children:il(x.type)})}),y<h.events.length-1&&jsx("div",{className:"history-timeline-connector",style:{borderColor:H}})]}),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:[c.showAvatars&&x.userAvatar&&jsx("img",{src:x.userAvatar,alt:x.userName||x.userId,className:"history-timeline-event-avatar"}),jsxs("div",{className:"history-timeline-event-description",children:[jsx("span",{className:"history-timeline-event-user",children:x.userName||x.userId}),jsx("span",{className:"history-timeline-event-action",children:sl(x)})]})]}),jsx("div",{className:"history-timeline-event-time",children:c.useRelativeTime?b(x.timestamp):x.timestamp.toLocaleString()})]}),Object.keys(x.changes).length>0&&jsxs("button",{className:"history-timeline-event-toggle",onClick:E=>{E.stopPropagation(),v(x.id);},children:[k?"\u25BC":"\u25B6"," Show changes"]}),k&&jsxs("div",{className:"history-timeline-event-changes",children:[Object.entries(x.changes).map(([E,N])=>jsxs("div",{className:"history-timeline-event-change",children:[jsxs("span",{className:"history-timeline-event-change-key",children:[E,":"]}),jsxs("div",{className:"history-timeline-event-change-values",children:[jsx("span",{className:"history-timeline-event-change-from",children:JSON.stringify(N.from)}),jsx("span",{className:"history-timeline-event-change-arrow",children:"\u2192"}),jsx("span",{className:"history-timeline-event-change-to",children:JSON.stringify(N.to)})]})]},E)),x.metadata&&Object.keys(x.metadata).length>0&&jsxs("div",{className:"history-timeline-event-metadata",children:[jsx("div",{className:"history-timeline-event-metadata-title",children:"Additional Info:"}),Object.entries(x.metadata).map(([E,N])=>jsxs("div",{className:"history-timeline-event-metadata-item",children:[jsxs("span",{className:"history-timeline-event-metadata-key",children:[E,":"]}),jsx("span",{className:"history-timeline-event-metadata-value",children:JSON.stringify(N)})]},E))]})]})]})]},x.id)})})]},h.date?.toISOString()||"all"))})]})}function mh({replayState:e,events:t,onStartReplay:a,onStopReplay:r,onTogglePlayback:n,onPrevious:s,onNext:o,onGoToEvent:i,onSpeedChange:c,className:l}){let u=[.5,1,1.5,2,3],p=useMemo(()=>!e||t.length===0?null:t[e.currentIndex],[e,t]),d=useMemo(()=>!e||e.totalEvents===0?0:e.currentIndex/(e.totalEvents-1)*100,[e]);return t.length===0?jsxs("div",{className:g("history-replay-empty",l),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",l),children:[jsxs("div",{className:"history-replay-current-event",children:[jsx("div",{className:"history-replay-event-icon",children:p&&il(p.type)}),jsxs("div",{className:"history-replay-event-info",children:[jsx("div",{className:"history-replay-event-description",children:p&&sl(p)}),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:p&&p.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:m=>i(parseInt(m.target.value))}),jsx("div",{className:"history-replay-progress-fill",style:{width:`${d}%`}}),jsx("div",{className:"history-replay-progress-markers",children:t.map((m,f)=>jsx("div",{className:g("history-replay-progress-marker",f===e.currentIndex&&"active"),style:{left:`${f/(e.totalEvents-1)*100}%`},onClick:()=>i(f),title:sl(m)},m.id))})]}),jsxs("div",{className:"history-replay-controls",children:[jsx("button",{className:"history-replay-control-btn",onClick:s,disabled:!e.canGoBack,title:"Previous event (\u2190)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"19 20 9 12 19 4 19 20"}),jsx("line",{x1:"5",y1:"19",x2:"5",y2:"5"})]})}),jsx("button",{className:"history-replay-control-btn history-replay-control-play",onClick:n,title:e.isPlaying?"Pause (Space)":"Play (Space)",children:e.isPlaying?jsxs("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:[jsx("rect",{x:"6",y:"4",width:"4",height:"16"}),jsx("rect",{x:"14",y:"4",width:"4",height:"16"})]}):jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})})}),jsx("button",{className:"history-replay-control-btn",onClick:o,disabled:!e.canGoForward,title:"Next event (\u2192)",children:jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polygon",{points:"5 4 15 12 5 20 5 4"}),jsx("line",{x1:"19",y1:"5",x2:"19",y2:"19"})]})}),jsxs("div",{className:"history-replay-speed",children:[jsx("label",{className:"history-replay-speed-label",children:"Speed:"}),jsx("div",{className:"history-replay-speed-buttons",children:u.map(m=>jsxs("button",{className:g("history-replay-speed-btn",e.speed===m&&"active"),onClick:()=>c(m),children:[m,"x"]},m))})]}),jsx("button",{className:"history-replay-control-btn history-replay-stop",onClick:r,title:"Stop replay (Esc)",children:jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",children:jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})})]}),jsxs("div",{className:"history-replay-shortcuts",children:[jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Space"})," Play/Pause"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2190"})," Previous"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"\u2192"})," Next"]}),jsxs("span",{className:"history-replay-shortcut",children:[jsx("kbd",{children:"Esc"})," Stop"]})]}),jsxs("div",{className:"history-replay-card-preview",children:[jsxs("div",{className:"history-replay-card-preview-header",children:[jsx("span",{className:"history-replay-card-preview-title",children:"Card State at This Point"}),jsx("span",{className:"history-replay-card-preview-time",children:p&&p.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(m=>jsx("span",{className:"history-replay-card-preview-label-tag",children:m},m))})]})]})]})]}):jsxs("div",{className:g("history-replay-start",l),children:[jsxs("button",{className:"history-replay-start-button",onClick:a,children:[jsx("svg",{className:"history-replay-start-icon",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:jsx("polygon",{points:"5 3 19 12 5 21 5 3"})}),jsx("span",{children:"Start Time Travel"})]}),jsxs("p",{className:"history-replay-start-hint",children:["Replay ",t.length," events from this card's history"]})]})}function wp(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 kp(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 gh(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 fh(e){return ["blocks","blocked_by","depends_on","required_by","parent_of","child_of"].includes(e)}function Y5(e,t,a,r,n,s=100){let o=e.map(c=>({...c,x:c.x??a/2+Math.random()*100-50,y:c.y??r/2+Math.random()*100-50,vx:0,vy:0})),i=new Map(o.map(c=>[c.id,c]));for(let c=0;c<s;c++){let l=1-c/s;o.forEach(u=>{let p=a/2,d=r/2;u.vx+=(p-u.x)*n.centerForce*l,u.vy+=(d-u.y)*n.centerForce*l,o.forEach(m=>{if(u.id===m.id)return;let f=u.x-m.x,v=u.y-m.y,b=Math.sqrt(f*f+v*v)||1,w=n.chargeStrength*l/(b*b);u.vx+=f/b*w,u.vy+=v/b*w;});}),t.forEach(u=>{let p=i.get(typeof u.source=="string"?u.source:u.source.id),d=i.get(typeof u.target=="string"?u.target:u.target.id);if(!p||!d)return;let m=d.x-p.x,f=d.y-p.y,v=Math.sqrt(m*m+f*f)||1,b=(v-n.linkDistance)/v*n.forceStrength*l;p.vx+=m*b,p.vy+=f*b,d.vx-=m*b,d.vy-=f*b;}),o.forEach(u=>{u.fx!==null&&u.fx!==void 0?(u.x=u.fx,u.vx=0):u.x+=u.vx,u.fy!==null&&u.fy!==void 0?(u.y=u.fy,u.vy=0):u.y+=u.vy,u.x=Math.max(n.nodeSize,Math.min(a-n.nodeSize,u.x)),u.y=Math.max(n.nodeSize,Math.min(r-n.nodeSize,u.y)),u.vx*=.9,u.vy*=.9;});}return o}function bh({nodes:e,edges:t,config:a,filter:r,onFilterChange:n,criticalPath:s,stats:o,onInteraction:i,className:c}){let l=useRef(null),[u,p]=useState([]),[d,m]=useState(null),[f,v]=useState(null),[b,w]=useState(null),[h,x]=useState(1),[y,k]=useState({x:0,y:0});useEffect(()=>{if(e.length===0)return;let W=Y5(e,t,a.width,a.height,a,150);p(W);},[e,t,a]);let M=useCallback((W,R)=>{a.enableDragging&&(R.stopPropagation(),m(W));},[a.enableDragging]),H=useCallback(W=>{if(!d||!l.current)return;let A=l.current.getBoundingClientRect(),ve=(W.clientX-A.left-y.x)/h,q=(W.clientY-A.top-y.y)/h;p(le=>le.map(B=>B.id===d?{...B,x:ve,y:q,fx:ve,fy:q}:B));},[d,h,y]),E=useCallback(()=>{m(null);},[]),N=useCallback((W,R)=>{R.stopPropagation(),i?.({type:"node-click",node:W,position:{x:R.clientX,y:R.clientY}});},[i]),D=useCallback((W,R)=>{R.stopPropagation(),i?.({type:"edge-click",edge:W,position:{x:R.clientX,y:R.clientY}});},[i]),S=useCallback(W=>{let R=u.find(A=>A.id===W);return R?{x:R.x,y:R.y}:{x:0,y:0}},[u]),V=useCallback(W=>{if(W.onCriticalPath)return "#ef4444";switch(a.colorScheme){case "status":return W.card.columnId==="done"?"#10b981":"#00E5CC";case "priority":let R=W.card.priority;return R==="URGENT"?"#ef4444":R==="HIGH"?"#f59e0b":R==="MEDIUM"?"#00E5CC":"#6b7280";case "assignee":return W.card.assigneeId?"#8b5cf6":"#6b7280";default:return "#00E5CC"}},[a.colorScheme]);return e.length===0?jsxs("div",{className:g("relationships-graph-empty",c),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",c),children:[jsxs("div",{className:"relationships-graph-controls",children:[jsxs("div",{className:"relationships-graph-stats",children:[jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalNodes}),jsx("span",{className:"relationships-graph-stat-label",children:"Cards"})]}),jsxs("span",{className:"relationships-graph-stat",children:[jsx("span",{className:"relationships-graph-stat-value",children:o.totalEdges}),jsx("span",{className:"relationships-graph-stat-label",children:"Relations"})]}),s&&jsxs("span",{className:"relationships-graph-stat relationships-graph-stat-critical",children:[jsx("span",{className:"relationships-graph-stat-value",children:s.cardIds.length}),jsx("span",{className:"relationships-graph-stat-label",children:"Critical Path"})]})]}),a.enableZoom&&jsxs("div",{className:"relationships-graph-zoom-controls",children:[jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(W=>Math.min(W+.2,3)),children:"+"}),jsxs("span",{className:"relationships-graph-zoom-value",children:[Math.round(h*100),"%"]}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>x(W=>Math.max(W-.2,.5)),children:"\u2212"}),jsx("button",{className:"relationships-graph-zoom-btn",onClick:()=>{x(1),k({x:0,y:0});},children:"Reset"})]})]}),jsx("div",{className:"relationships-graph-legend",children:Array.from(new Set(t.map(W=>W.type))).map(W=>jsxs("div",{className:"relationships-graph-legend-item",children:[jsx("div",{className:"relationships-graph-legend-color",style:{background:wp(W)}}),jsxs("span",{className:"relationships-graph-legend-label",children:[gh(W)," ",kp(W)]})]},W))}),jsxs("svg",{ref:l,className:"relationships-graph-canvas",width:a.width,height:a.height,onMouseMove:H,onMouseUp:E,onMouseLeave:E,children:[jsxs("g",{transform:`translate(${y.x}, ${y.y}) scale(${h})`,children:[jsx("g",{className:"relationships-graph-edges",children:t.map(W=>{let R=S(typeof W.source=="string"?W.source:W.source.id),A=S(typeof W.target=="string"?W.target:W.target.id),ve=fh(W.type),q=b===W.id,le=W.onCriticalPath;return jsxs("g",{className:g("relationships-graph-edge",q&&"hovered",le&&"critical"),onMouseEnter:()=>w(W.id),onMouseLeave:()=>w(null),onClick:B=>D(W,B),children:[jsx("line",{x1:R.x,y1:R.y,x2:A.x,y2:A.y,stroke:wp(W.type),strokeWidth:le?a.edgeWidth*2:a.edgeWidth,strokeOpacity:q?1:.6,markerEnd:ve?"url(#arrowhead)":void 0}),a.showEdgeLabels&&q&&jsx("text",{x:(R.x+A.x)/2,y:(R.y+A.y)/2,className:"relationships-graph-edge-label",textAnchor:"middle",children:kp(W.type)})]},W.id)})}),jsx("g",{className:"relationships-graph-nodes",children:u.map(W=>{let R=f===W.id,A=W.onCriticalPath;return jsxs("g",{className:g("relationships-graph-node",R&&"hovered",A&&"critical"),transform:`translate(${W.x}, ${W.y})`,onMouseDown:ve=>M(W.id,ve),onMouseEnter:()=>v(W.id),onMouseLeave:()=>v(null),onClick:ve=>N(W,ve),children:[jsx("circle",{r:A?a.nodeSize*1.2:a.nodeSize,fill:V(W),stroke:A?"#fbbf24":"#ffffff",strokeWidth:A?3:2,opacity:R?1:.9}),a.showLabels&&jsx("text",{y:a.nodeSize+20,className:"relationships-graph-node-label",textAnchor:"middle",children:W.card.title.length>20?W.card.title.substring(0,20)+"...":W.card.title})]},W.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 xh({isOpen:e,onClose:t,onPlanGenerated:a,onGeneratePlan:r,isLoading:n}){let[s,o]=useState(""),[i,c]=useState(false),[l,u]=useState(null),[p,d]=useState(null),m=useRef(null),f=i||n;useEffect(()=>{e&&m.current&&m.current.focus();},[e]),useEffect(()=>{let h=x=>{x.key==="Escape"&&!f&&v();};if(e)return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[e,f]);let v=()=>{f||(o(""),u(null),d(null),t());},b=async()=>{if(!(!s.trim()||f)){c(true),u(null),d(null);try{let h=await r(s.trim());d(h);}catch(h){u(h instanceof Error?h.message:"Failed to generate plan");}finally{c(false);}}},w=()=>{p&&(a(p),v());};return e?jsxs(Pa,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:v}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-2xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:h=>h.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#00E5CC]",children:[jsx("path",{d:"M12 2L2 7L12 12L22 7L12 2Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 17L12 22L22 17",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{d:"M2 12L12 17L22 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),"Generate Project Plan with AI"]}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Describe your project and let AI create a complete Kanban board"})]}),jsx("button",{onClick:v,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:p?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!"})]}),p.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:p.explanation})}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Columns (",p.columns.length,")"]}),jsx("div",{className:"flex gap-2 flex-wrap",children:p.columns.map((h,x)=>jsx("div",{className:"px-3 py-1.5 rounded-lg bg-white/5 border border-white/20 text-sm text-white/80",children:h.title},x))})]}),jsxs("div",{children:[jsxs("h3",{className:"text-sm font-semibold text-white/90 mb-2",children:["Tasks (",p.cards.length,")"]}),jsxs("div",{className:"space-y-2 max-h-64 overflow-y-auto",children:[p.cards.slice(0,10).map((h,x)=>jsx("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxs("div",{className:"flex-1",children:[jsx("p",{className:"text-sm font-medium text-white/90",children:h.title}),h.description&&jsx("p",{className:"text-xs text-white/60 mt-1 line-clamp-2",children:h.description})]}),h.priority&&jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${h.priority==="URGENT"?"bg-red-500/20 text-red-400":h.priority==="HIGH"?"bg-orange-500/20 text-orange-400":h.priority==="MEDIUM"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:h.priority})]})},x)),p.cards.length>10&&jsxs("p",{className:"text-xs text-white/50 text-center py-2",children:["+",p.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:m,value:s,onChange:h=>o(h.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:f}),jsx("p",{className:"text-xs text-white/50 mt-2",children:"Be as specific as possible. Include features, technologies, and any special requirements."})]}),l&&jsx("div",{className:"p-4 rounded-lg bg-red-500/10 border border-red-500/30 text-red-400 text-sm",children:l}),jsxs("div",{className:"border-t border-white/10 pt-4",children:[jsx("p",{className:"text-xs font-semibold text-white/70 uppercase tracking-wider mb-3",children:"Example Prompts"}),jsx("div",{className:"space-y-2",children:["Build an e-commerce platform with product catalog, shopping cart, payment integration, and order tracking","Create a task management app with team collaboration, real-time updates, file attachments, and notifications","Develop a blog platform with markdown editor, SEO optimization, comments system, and analytics dashboard"].map((h,x)=>jsx("button",{onClick:()=>o(h),disabled:f,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:h},x))})]})]})}),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:v,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"}),p?jsx("button",{onClick:w,className:"px-6 py-2 rounded-lg text-sm font-semibold transition-all",style:{background:"linear-gradient(135deg, #10B981 0%, #059669 100%)",color:"#ffffff"},children:"Apply Plan to Board"}):jsx("button",{onClick:b,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 Cp={"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 J5={hobby:{requestsPerMonth:50,maxConcurrent:1,maxTokensPerRequest:4096},pro:{requestsPerMonth:500,maxConcurrent:3,maxTokensPerRequest:8192},enterprise:{requestsPerMonth:2e3,maxConcurrent:10,maxTokensPerRequest:16384}},Q5={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 Z5(e,t,a){let r=Cp[e];if(!r)throw new Error(`Unknown model: ${e}`);let n=t/1e3*r.costPer1kInput,s=a/1e3*r.costPer1kOutput;return n+s}function ll(e){return `$${e.toFixed(4)}`}var Tp=class{constructor(){this.operations=[];this.listeners=[];}record(t){let a=Z5(t.model,t.inputTokens,t.outputTokens),r={...t,id:`op_${Date.now()}_${Math.random().toString(36).substring(7)}`,timestamp:new Date,cost:a};return this.operations.push(r),this.listeners.forEach(n=>n(r)),this.operations.length>1e3&&(this.operations=this.operations.slice(-1e3)),r}getStats(t){let a=this.operations;t&&(a=a.filter(p=>p.timestamp>=t.start&&p.timestamp<=t.end));let r=a.length,n=a.reduce((p,d)=>p+d.cost,0),s=a.reduce((p,d)=>p+d.inputTokens,0),o=a.reduce((p,d)=>p+d.outputTokens,0),i=a.filter(p=>p.success),c=a.reduce((p,d)=>p+d.duration,0),l={},u={};return a.forEach(p=>{l[p.feature]=(l[p.feature]||0)+1,u[p.feature]=(u[p.feature]||0)+p.cost;}),{totalOperations:r,totalCost:n,totalInputTokens:s,totalOutputTokens:o,operationsByFeature:l,costsByFeature:u,averageDuration:r>0?c/r:0,successRate:r>0?i.length/r:0}}getRecentOperations(t=10){return this.operations.slice(-t).reverse()}checkLimit(t,a="month"){let n={hobby:{month:50,day:5},pro:{month:500,day:50},enterprise:{month:2e3,day:200}}[t][a],s=new Date,o=new Date;a==="month"?o.setMonth(s.getMonth()-1):o.setDate(s.getDate()-1);let i=this.operations.filter(u=>u.timestamp>=o).length,c=Math.max(0,n-i),l=i/n*100;return {used:i,limit:n,remaining:c,percentUsed:l,isExceeded:i>=n}}subscribe(t){return this.listeners.push(t),()=>{let a=this.listeners.indexOf(t);a>-1&&this.listeners.splice(a,1);}}clear(){this.operations=[];}export(){return JSON.stringify(this.operations,null,2)}},Ms=new Tp;function kh({isOpen:e,onClose:t,planTier:a="hobby"}){let[r,n]=useState(Ms.getStats()),[s,o]=useState(Ms.checkLimit(a));if(useEffect(()=>{if(!e)return;let c=setInterval(()=>{n(Ms.getStats()),o(Ms.checkLimit(a));},1e3);return ()=>clearInterval(c)},[e,a]),useEffect(()=>{let c=l=>{l.key==="Escape"&&t();};if(e)return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[e,t]),!e)return null;let i=Ms.getRecentOperations(5);return jsxs(Pa,{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:c=>c.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsx("h2",{className:"text-xl font-bold text-white",children:"AI Usage Dashboard"}),jsx("p",{className:"text-sm text-white/60 mt-1",children:"Monitor your AI consumption and costs"})]}),jsx("button",{onClick:t,className:"text-white/60 hover:text-white transition-colors",children:jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:jsx("path",{d:"M18 6L6 18M6 6L18 18",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]}),jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[jsxs("div",{className:"p-4 rounded-xl bg-gradient-to-r from-[#00E5CC]/10 to-purple-500/10 border border-[#00E5CC]/30",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxs("span",{className:"text-sm font-semibold text-white/90",children:["Monthly Usage (",a.toUpperCase(),")"]}),jsxs("span",{className:"text-sm font-bold text-white",children:[s.used," / ",s.limit]})]}),jsx("div",{className:"w-full h-2 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full transition-all",style:{width:`${Math.min(100,s.percentUsed)}%`,background:s.percentUsed>90?"#EF4444":s.percentUsed>70?"#F59E0B":"#10B981"}})}),jsxs("p",{className:"text-xs text-white/60 mt-2",children:[s.remaining," operations remaining this month"]})]}),jsxs("div",{className:"grid grid-cols-2 gap-4",children:[jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Total Cost"}),jsx("p",{className:"text-2xl font-bold text-green-400 mt-1",children:ll(r.totalCost)})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Operations"}),jsx("p",{className:"text-2xl font-bold text-[#00E5CC] mt-1",children:r.totalOperations})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Tokens Used"}),jsx("p",{className:"text-2xl font-bold text-purple-400 mt-1",children:(r.totalInputTokens+r.totalOutputTokens).toLocaleString()}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:[r.totalInputTokens.toLocaleString()," in /"," ",r.totalOutputTokens.toLocaleString()," out"]})]}),jsxs("div",{className:"p-4 rounded-lg bg-white/5 border border-white/10",children:[jsx("p",{className:"text-xs font-semibold text-white/60 uppercase tracking-wider",children:"Success Rate"}),jsxs("p",{className:"text-2xl font-bold text-green-400 mt-1",children:[(r.successRate*100).toFixed(1),"%"]}),jsxs("p",{className:"text-xs text-white/50 mt-1",children:["Avg: ",r.averageDuration.toFixed(0),"ms"]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Usage by Feature"}),jsx("div",{className:"space-y-2",children:Object.entries(r.operationsByFeature).map(([c,l])=>{let u=r.costsByFeature[c]||0,p=r.totalOperations>0?l/r.totalOperations*100:0;return jsxs("div",{className:"p-3 rounded-lg bg-white/5 border border-white/10",children:[jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsx("span",{className:"text-sm font-medium text-white/90 capitalize",children:c.replace(/([A-Z])/g," $1").trim()}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[l," ops"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ll(u)})]})]}),jsx("div",{className:"w-full h-1.5 bg-white/10 rounded-full overflow-hidden",children:jsx("div",{className:"h-full bg-[#00E5CC]",style:{width:`${p}%`}})})]},c)})})]}),jsxs("div",{children:[jsx("h3",{className:"text-sm font-semibold text-white/90 mb-3",children:"Recent Operations"}),i.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:i.map(c=>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:c.feature.replace(/([A-Z])/g," $1").trim()}),jsxs("p",{className:"text-xs text-white/50 mt-0.5",children:[new Date(c.timestamp).toLocaleTimeString()," \u2022"," ",c.duration,"ms"]})]}),jsxs("div",{className:"flex items-center gap-3",children:[jsxs("span",{className:"text-xs text-white/60",children:[c.inputTokens+c.outputTokens," tokens"]}),jsx("span",{className:"text-xs font-semibold text-green-400",children:ll(c.cost)}),jsx("div",{className:`w-2 h-2 rounded-full ${c.success?"bg-green-400":"bg-red-400"}`})]})]},c.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 Dh({isOpen:e,onClose:t,onTasksGenerated:a,onGenerateTasks:r,isLoading:n,projectName:s}){let[o,i]=useState(""),[c,l]=useState(""),[u,p]=useState(""),[d,m]=useState(false),[f,v]=useState(null),[b,w]=useState(null),[h,x]=useState(null),y=useRef(null),k=d||n;useEffect(()=>{e&&y.current&&y.current.focus();},[e]),useEffect(()=>{let D=S=>{S.key==="Escape"&&!k&&M();};if(e)return document.addEventListener("keydown",D),()=>document.removeEventListener("keydown",D)},[e,k]);let M=()=>{k||(i(""),l(""),p(""),v(null),w(null),x(null),t());},H=async()=>{if(!(!o.trim()||k)){m(true),v(null),w(null),x(null);try{let D=await r({prompt:o.trim(),projectName:s||"Mi Proyecto",startDate:c||void 0,endDate:u||void 0});w(D.tasks.tasks),x({from_cache:D.from_cache,tokens_used:D.tokens_used,mock_mode:D.mock_mode,similarity:D.similarity,tokens_saved:D.tokens_saved});}catch(D){v(D instanceof Error?D.message:"Failed to generate tasks");}finally{m(false);}}},E=()=>{b&&(a(b),M());};if(!e)return null;let N=h?.similarity?((h.similarity||0)*100).toFixed(0):"0";return jsxs(Pa,{children:[jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[100000]",onClick:M}),jsx("div",{className:"fixed inset-0 flex items-center justify-center z-[100001] p-4",children:jsxs("div",{className:"w-full max-w-3xl rounded-2xl shadow-2xl border max-h-[90vh] overflow-hidden flex flex-col",style:{background:"linear-gradient(135deg, #1f1f1f 0%, #1a1a1a 100%)",borderColor:"rgba(255, 255, 255, 0.15)",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.1)"},onClick:D=>D.stopPropagation(),children:[jsxs("div",{className:"px-6 py-4 border-b border-white/10 flex items-center justify-between",children:[jsxs("div",{children:[jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-[#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:M,disabled:k,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:b?jsx(Fragment,{children:jsxs("div",{className:"space-y-4",children:[jsxs("div",{className:"flex items-center gap-2 text-green-400",children:[jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",children:jsx("path",{d:"M4 10L8 14L16 6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),jsx("span",{className:"font-semibold",children:"Tasks Generated Successfully!"})]}),jsxs("div",{className:"flex flex-wrap gap-2",children:[h?.mock_mode&&jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-yellow-500/20 text-yellow-400 border border-yellow-500/30",children:"Mock Mode"}),h?.from_cache?jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-[#00E5CC]/20 text-[#00E5CC] border border-[#00E5CC]/30",children:["From Cache (",N,"% similar)"]}):jsx("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-green-500/20 text-green-400 border border-green-500/30",children:"AI Generated"}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-purple-500/20 text-purple-400 border border-purple-500/30",children:[h?.tokens_used||0," tokens"]}),h?.tokens_saved&&jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-indigo-500/20 text-indigo-400 border border-indigo-500/30",children:[h.tokens_saved," tokens saved"]}),jsxs("span",{className:"px-2 py-1 rounded-lg text-xs font-semibold bg-pink-500/20 text-pink-400 border border-pink-500/30",children:[b.length," tasks"]})]}),jsx("div",{className:"space-y-2 max-h-96 overflow-y-auto",children:b.map((D,S)=>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:["#",S+1]}),jsx("p",{className:"text-sm font-medium text-white/90",children:D.name})]}),jsxs("div",{className:"flex items-center gap-3 text-xs text-white/60",children:[jsxs("span",{className:"flex items-center gap-1",children:[jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-white/40",children:[jsx("rect",{x:"1",y:"2",width:"10",height:"8",rx:"1",stroke:"currentColor"}),jsx("path",{d:"M1 4h10",stroke:"currentColor"})]}),D.start," \u2192 ",D.end]}),jsxs("span",{children:[D.duration," days"]}),D.dependencies.length>0&&jsxs("span",{className:"text-[#00E5CC]",children:["Depends: ",D.dependencies.join(", ")]})]})]}),jsx("span",{className:`px-2 py-0.5 rounded text-xs font-semibold ${D.priority==="high"?"bg-red-500/20 text-red-400":D.priority==="medium"?"bg-yellow-500/20 text-yellow-400":"bg-[#00E5CC]/20 text-[#00E5CC]"}`,children:D.priority})]})},D.id))})]})}):jsxs(Fragment,{children:[jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"Project Description *"}),jsx("textarea",{ref:y,value:o,onChange:D=>i(D.target.value),placeholder:"Example: Build a mobile app for tracking fitness goals with user authentication, workout logging, progress charts, and social features...",className:"w-full h-32 px-4 py-3 rounded-lg text-sm bg-white/5 border border-white/20 text-white placeholder-white/40 outline-none focus:border-[#00E5CC]/50 transition-all resize-none",disabled:k}),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:c,onChange:D=>l(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:k})]}),jsxs("div",{children:[jsx("label",{className:"block text-sm font-semibold text-white/90 mb-2",children:"End Date (Optional)"}),jsx("input",{type:"date",value:u,onChange:D=>p(D.target.value),className:"w-full px-4 py-2 rounded-lg text-sm bg-white/5 border border-white/20 text-white outline-none focus:border-[#00E5CC]/50 transition-all",disabled:k})]})]}),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((D,S)=>jsx("button",{onClick:()=>i(D),disabled:k,className:"w-full text-left px-3 py-2 rounded-lg text-xs text-white/70 hover:text-white hover:bg-white/5 transition-all border border-white/10 hover:border-white/20 disabled:opacity-50",children:D},S))})]})]})}),jsxs("div",{className:"px-6 py-4 border-t border-white/10 flex items-center justify-between",children:[jsx("div",{children:k&&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:M,disabled:k,className:"px-4 py-2 rounded-lg text-sm font-semibold transition-all hover:bg-white/10 text-white/80 disabled:opacity-50",children:"Cancel"}),b?jsx("button",{onClick:E,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:H,disabled:!o.trim()||k,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:k?"Generating...":"Generate Tasks"})]})]})]})})]})}function Jc({initialBoard:e,onPersist:t}){let[a,r]=useState(e),n=useCallback(b=>{t&&Cl(()=>Promise.resolve(t(b)),{maxAttempts:3,initialDelay:1e3,onRetry:(w,h,x)=>{console.warn(`Retry attempt ${h} after ${x}ms: ${w.message}`);}}).then(w=>{w.success||console.error(`Failed to persist board after ${w.attempts} attempts:`,w.error);});},[t]),s=useCallback(async(b,w,h)=>{r(x=>{let y=x.cards.find(D=>D.id===b);if(!y)return x;let k=y.columnId,M={...y,columnId:w,position:h},H=x.cards.map(D=>D.id===b?M:D),E=x.columns.map(D=>{if(D.id===k)return {...D,cardIds:D.cardIds.filter(S=>S!==b)};if(D.id===w){let S=H.filter(V=>V.columnId===w).sort((V,W)=>V.position-W.position);return {...D,cardIds:S.map(V=>V.id)}}return D}),N={...x,cards:H,columns:E};return n(N),N});},[n]),o=useCallback(async(b,w)=>{r(h=>{let x=h.cards.map(k=>k.id===b?{...k,...w}:k),y={...h,cards:x};return n(y),y});},[n]),i=useCallback(async b=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let x={...b,id:w},y=h.columns.map(M=>M.id===b.columnId?{...M,cardIds:[...M.cardIds,w]}:M),k={...h,cards:[...h.cards,x],columns:y};return n(k),k});},[n]),c=useCallback(async b=>{r(w=>{let h=w.cards.find(M=>M.id===b);if(!h)return w;let x=w.cards.filter(M=>M.id!==b),y=w.columns.map(M=>M.id===h.columnId?{...M,cardIds:M.cardIds.filter(H=>H!==b)}:M),k={...w,cards:x,columns:y};return n(k),k});},[n]),l=useCallback(async b=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;r(h=>{let x={...b,id:w,cardIds:[]},y={...h,columns:[...h.columns,x]};return n(y),y});},[n]),u=useCallback(async(b,w)=>{r(h=>{let x=h.columns.map(k=>k.id===b?{...k,...w}:k),y={...h,columns:x};return n(y),y});},[n]),p=useCallback(async b=>{r(w=>{let h=w.cards.filter(k=>k.columnId!==b),x=w.columns.filter(k=>k.id!==b),y={...w,cards:h,columns:x};return n(y),y});},[n]),d=useCallback(b=>{let w=`card-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return i(b),w},[i]),m=useCallback(b=>{let w=`col-${Date.now()}-${Math.random().toString(36).substr(2,9)}`;return l(b),w},[l]),f=useCallback(()=>{r(b=>{let w={...b,cards:[],columns:[]};return n(w),w});},[n]);return {board:a,callbacks:{onCardMove:s,onCardUpdate:o,onCardCreate:i,onCardDelete:c,onColumnCreate:l,onColumnUpdate:u,onColumnDelete:p},setBoard:r,helpers:{addCard:d,addColumn:m,deleteCard:c,deleteColumn:p,clearBoard:f}}}function Sh({initialData:e,availableUsers:t=[],onSave:a}){let{board:r,callbacks:n,helpers:s}=Jc({initialBoard:e,onPersist:a}),o=useMemo(()=>({addCard:(c,l,u={})=>{s.addCard({title:l,columnId:c,position:r.cards.filter(p=>p.columnId===c).length,...u});},addColumn:(c,l)=>{let u=r.columns.length>0?Math.max(...r.columns.map(p=>p.position)):0;s.addColumn({title:c,position:l??u+1e3});},reset:s.clearBoard}),[r.cards,r.columns,s]);return {props:useMemo(()=>({board:r,callbacks:n,availableUsers:t}),[r,n,t]),board:r,callbacks:n,utils:o}}var cl={dateFilter:"all",priorities:[],assignees:[],labels:[],columns:[],search:""},Mh={by:"none",order:"asc"};function Ph({initialFilters:e={},initialSort:t={},currentUserId:a}={}){let[r,n]=useState({...cl,...e}),[s,o]=useState({...Mh,...t}),i=useCallback(v=>{n(b=>({...b,...v}));},[]),c=useCallback(v=>{o(b=>({...b,...v}));},[]),l=useCallback(()=>{n(cl),o(Mh);},[]),u=useCallback(()=>{a&&n({...cl,assignees:[a]});},[a]),p=useCallback(()=>{n({...cl,dateFilter:"overdue"});},[]),d=useCallback(()=>{n({...cl,priorities:["HIGH","URGENT"]});},[]),m=useMemo(()=>r.dateFilter!=="all"||r.priorities.length>0||r.assignees.length>0||r.labels.length>0||r.columns.length>0||r.search!==""||s.by!=="none",[r,s]),f=useCallback(v=>{let b=[...v];if(r.search){let w=r.search.toLowerCase();b=b.filter(h=>h.title.toLowerCase().includes(w)||h.description?.toLowerCase().includes(w));}if(r.dateFilter!=="all"){let w=new Date,h=w.getFullYear(),x=String(w.getMonth()+1).padStart(2,"0"),y=String(w.getDate()).padStart(2,"0"),k=`${h}-${x}-${y}`;b=b.filter(M=>{if(!M.endDate&&!M.dueDate)return false;let H=M.endDate||M.dueDate;if(!H)return false;let E;if(typeof H=="string")E=H.split("T")[0]||H;else {let N=H.getUTCFullYear(),D=String(H.getUTCMonth()+1).padStart(2,"0"),S=String(H.getUTCDate()).padStart(2,"0");E=`${N}-${D}-${S}`;}switch(r.dateFilter){case "overdue":return E<k;case "today":return E===k;case "this-week":let N=new Date(k+"T00:00:00"),D=new Date(E+"T00:00:00"),S=new Date(N);return S.setDate(S.getDate()+7),D>=N&&D<=S;case "custom":if(r.dateRange){let V=typeof H=="string"?new Date(H):H;return V>=r.dateRange.start&&V<=r.dateRange.end}return true;default:return true}});}return r.priorities.length>0&&(b=b.filter(w=>w.priority&&r.priorities.includes(w.priority))),r.assignees.length>0&&(b=b.filter(w=>(w.assignedUserIds||(w.assigneeId?[w.assigneeId]:[])).some(x=>r.assignees.includes(x)))),r.labels.length>0&&(b=b.filter(w=>w.labels&&w.labels.some(h=>r.labels.includes(h)))),r.columns.length>0&&(b=b.filter(w=>r.columns.includes(w.columnId))),s.by!=="none"&&b.sort((w,h)=>{let x=0;switch(s.by){case "created":let y=w.createdAt?new Date(w.createdAt).getTime():0,k=h.createdAt?new Date(h.createdAt).getTime():0;x=y-k;break;case "priority":let M={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},H=M[w.priority||"LOW"],E=M[h.priority||"LOW"];x=H-E;break;case "dueDate":let N=w.endDate||w.dueDate,D=h.endDate||h.dueDate;if(!N)return 1;if(!D)return -1;let S=typeof N=="string"?new Date(N).getTime():N.getTime(),V=typeof D=="string"?new Date(D).getTime():D.getTime();x=S-V;break;case "title":x=w.title.localeCompare(h.title);break;case "estimate":let W=w.estimatedTime||0,R=h.estimatedTime||0;x=W-R;break;default:x=0;}return s.order==="asc"?x:-x}),b},[r,s]);return {filters:r,sort:s,setFilters:i,setSort:c,resetFilters:l,filterMyTasks:u,filterOverdue:p,filterHighPriority:d,applyFilters:f,hasActiveFilters:m}}var Lh,Ah;if(typeof window<"u")try{let e=vl("ai");Lh=e.generateObject,Ah=e.generateText;}catch{}function Ih(e={}){let[t,a]=useState(false),[r,n]=useState(null),s=!!(Lh&&Ah&&e.apiKey),o=useCallback(async p=>{if(!s)throw new Error('AI features require the "ai" package and an API key. Install with: npm install ai');a(true),n(null);try{return console.log("Generating plan for:",p),{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: ${p}`,position:1e3,columnId:"temp-col-1"}],explanation:"This is a sample plan. Real implementation would use AI SDK."}}catch(d){let m=d instanceof Error?d:new Error("Failed to generate plan");throw n(m),m}finally{a(false);}},[s]),i=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Suggesting assignee for:",p.title),{userId:"user-123",confidence:.85,reasoning:"Based on past performance and expertise"}}catch(d){let m=d instanceof Error?d:new Error("Failed to suggest assignee");throw n(m),m}finally{a(false);}},[s]),c=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Analyzing board for risks..."),[{type:"RISK_OVERLOAD",severity:"HIGH",title:"Column overload detected",description:'Too many cards in "In Progress"',confidence:.9,suggestedAction:'Consider moving some cards back to "To Do"'}]}catch(d){let m=d instanceof Error?d:new Error("Failed to predict risks");throw n(m),m}finally{a(false);}},[s]),l=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Generating subtasks for:",p.title),[{title:`Subtask 1 for: ${p.title}`,position:p.position+.1,columnId:p.columnId},{title:`Subtask 2 for: ${p.title}`,position:p.position+.2,columnId:p.columnId}]}catch(d){let m=d instanceof Error?d:new Error("Failed to generate subtasks");throw n(m),m}finally{a(false);}},[s]),u=useCallback(async p=>{if(!s)throw new Error("AI features not available");a(true),n(null);try{return console.log("Estimating effort for:",p.title),{hours:8,confidence:.75}}catch(d){let m=d instanceof Error?d:new Error("Failed to estimate effort");throw n(m),m}finally{a(false);}},[s]);return {onGeneratePlan:o,onSuggestAssignee:i,onPredictRisks:c,onGenerateSubtasks:l,onEstimateEffort:u,isAvailable:s,isLoading:t,error:r}}function Np(){let[e,t]=useState(()=>selectionStore.getState());useEffect(()=>selectionStore.subscribe(n=>{t(n);}),[]);let a=useCallback(r=>{selectionStore.setState(r);},[]);return [e,a]}function Rh(e){let{cards:t}=e,[a,r]=Np(),n=useCallback(p=>a.selectedCardIds.includes(p),[a.selectedCardIds]),s=useCallback((p,d)=>{if(!d){r({selectedCardIds:[p],lastSelectedCardId:p});return}let m=d.ctrlKey||d.metaKey,f=d.shiftKey;if(m)a.selectedCardIds.includes(p)?r({selectedCardIds:a.selectedCardIds.filter(v=>v!==p),lastSelectedCardId:a.lastSelectedCardId}):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});else if(f&&a.lastSelectedCardId){let v=t.find(w=>w.id===p),b=t.find(w=>w.id===a.lastSelectedCardId);if(v&&b&&v.columnId===b.columnId){let w=t.filter(E=>E.columnId===v.columnId).sort((E,N)=>E.position-N.position),h=w.findIndex(E=>E.id===a.lastSelectedCardId),x=w.findIndex(E=>E.id===p),[y,k]=h<x?[h,x]:[x,h],M=w.slice(y,k+1).map(E=>E.id),H=Array.from(new Set([...a.selectedCardIds,...M]));r({selectedCardIds:H,lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});}else r({selectedCardIds:[p],lastSelectedCardId:p});},[t,a,r]),o=useCallback(p=>{r({selectedCardIds:a.selectedCardIds.filter(d=>d!==p),lastSelectedCardId:a.lastSelectedCardId});},[a,r]),i=useCallback(()=>{r({selectedCardIds:[],lastSelectedCardId:null});},[r]),c=useCallback(()=>{r({selectedCardIds:t.map(p=>p.id),lastSelectedCardId:t[t.length-1]?.id||null});},[t,r]),l=useCallback(p=>{a.selectedCardIds.includes(p)?o(p):r({selectedCardIds:[...a.selectedCardIds,p],lastSelectedCardId:p});},[a,o,r]),u=useCallback(()=>t.filter(p=>a.selectedCardIds.includes(p.id)),[t,a.selectedCardIds]);return {selectedCardIds:a.selectedCardIds,lastSelectedCardId:a.lastSelectedCardId,isCardSelected:n,selectCard:s,deselectCard:o,clearSelection:i,selectAll:c,toggleCard:l,getSelectedCards:u}}var Bh={enableAutoStacking:true,autoStackConfidenceThreshold:.7,minCardsPerStack:2,enableManualStacking:true,showStackSummaries:true,animationDuration:200};function $h(e){let{cards:t,config:a,aiService:r}=e,n=useMemo(()=>({...Bh,...a}),[a]),[s,o]=useState([]),i=useCallback((v,b,w,h,x)=>{if(b.length<n.minCardsPerStack){console.warn(`Cannot create stack: minimum ${n.minCardsPerStack} cards required`);return}let y={id:`stack-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,title:v,cardIds:b,columnId:w,strategy:h,color:x,isExpanded:true,position:s.filter(k=>k.columnId===w).length,createdAt:new Date};o(k=>[...k,y]);},[n.minCardsPerStack,s]),c=useCallback(v=>{o(b=>b.filter(w=>w.id!==v));},[]),l=useCallback(v=>{o(b=>b.map(w=>w.id===v?{...w,isExpanded:!w.isExpanded}:w));},[]),u=useCallback((v,b)=>{o(w=>w.map(h=>h.id===v&&!h.cardIds.includes(b)?{...h,cardIds:[...h.cardIds,b]}:h));},[]),p=useCallback((v,b)=>{o(w=>w.map(h=>{if(h.id===v){let x=h.cardIds.filter(y=>y!==b);return x.length<n.minCardsPerStack?null:{...h,cardIds:x}}return h}).filter(h=>h!==null));},[n.minCardsPerStack]),d=useCallback(v=>s.filter(b=>b.columnId===v).sort((b,w)=>b.position-w.position),[s]),m=useCallback(async v=>{let b=t.filter(k=>k.columnId===v);if(b.length<n.minCardsPerStack*2)return [];let w=[],h=new Map;b.forEach(k=>{k.labels&&k.labels.length>0&&k.labels.forEach(M=>{h.has(M)||h.set(M,[]),h.get(M).push(k);});}),h.forEach((k,M)=>{k.length>=n.minCardsPerStack&&w.push({stack:{title:`\u{1F4CC} ${M}`,cardIds:k.map(H=>H.id),columnId:v,strategy:"labels",color:"#00E5CC"},reason:`${k.length} cards with label "${M}"`,confidence:.85});});let x=new Map;b.forEach(k=>{k.assignedUserIds&&k.assignedUserIds.length>0&&k.assignedUserIds.forEach(M=>{x.has(M)||x.set(M,[]),x.get(M).push(k);});}),x.forEach((k,M)=>{k.length>=n.minCardsPerStack&&w.push({stack:{title:`\u{1F464} Assigned to user-${M.slice(-4)}`,cardIds:k.map(H=>H.id),columnId:v,strategy:"assignee",color:"#8b5cf6"},reason:`${k.length} cards assigned to the same user`,confidence:.8});});let y=new Map;if(b.forEach(k=>{k.priority&&(y.has(k.priority)||y.set(k.priority,[]),y.get(k.priority).push(k));}),y.forEach((k,M)=>{if(k.length>=n.minCardsPerStack){let H={low:"\u{1F7E2}",medium:"\u{1F7E1}",high:"\u{1F534}",urgent:"\u{1F6A8}"}[M.toLowerCase()]||"\u26AA";w.push({stack:{title:`${H} ${M} Priority`,cardIds:k.map(E=>E.id),columnId:v,strategy:"priority",color:M==="high"||M==="urgent"?"#ef4444":"#10b981"},reason:`${k.length} cards with ${M} priority`,confidence:.75});}}),r&&n.enableAutoStacking)for(let k of b){let H=(await r.findSimilar(k,b)).filter(E=>E.similarity>=n.autoStackConfidenceThreshold);if(H.length>=n.minCardsPerStack-1){let E=[k.id,...H.map(D=>D.card.id)],N=H.reduce((D,S)=>D+S.similarity,0)/H.length;w.push({stack:{title:`\u2728 Similar to "${k.title.substring(0,30)}${k.title.length>30?"...":""}"`,cardIds:E,columnId:v,strategy:"ai-similarity",color:"#f59e0b"},reason:`AI detected ${H.length+1} similar tasks`,confidence:N});}}return w.filter(k=>k.confidence>=n.autoStackConfidenceThreshold).sort((k,M)=>M.confidence-k.confidence).slice(0,5)},[t,n,r]),f=useCallback(v=>{i(v.stack.title,v.stack.cardIds,v.stack.columnId,v.stack.strategy,v.stack.color);},[i]);return useEffect(()=>{n.enableAutoStacking&&s.length===0&&new Set(t.map(b=>b.columnId)).forEach(async b=>{let w=await m(b),h=w[0];w.length>0&&h&&h.confidence>=.9&&f(h);});},[]),{stacks:s,createStack:i,deleteStack:c,toggleStack:l,addToStack:u,removeFromStack:p,getStacksForColumn:d,getSuggestions:m,applySuggestion:f,config:n}}var Oh=createContext(null);function Hh({children:e,initialData:t,onStateChange:a}){let r=useRef();if(!r.current){let s=new Map,o=new Map;t?.columns?.forEach(c=>{let{Column:l}=vl("@libxai/core");s.set(c.id,new l(c));}),t?.cards?.forEach(c=>{let{Card:l}=vl("@libxai/core");o.set(c.id,new l(c));});let i=null;if(t?.board){let{Board:c}=vl("@libxai/core");i=new c(t.board);}r.current=new BoardStore({board:i,columns:s,cards:o});}let n=r.current;return useEffect(()=>{if(a)return n.subscribeAll(s=>{a(n.getState());})},[n,a]),jsx(Oh.Provider,{value:{store:n},children:e})}function Qc(){let e=useContext(Oh);if(!e)throw new Error("useBoardStore must be used within BoardProvider");return e.store}function ul(){let e=Qc(),[t,a]=useState(e.getBoard()),[r,n]=useState(e.getAllColumns()),[s,o]=useState(e.getAllCards());useEffect(()=>e.subscribeAll(()=>{a(e.getBoard()),n(e.getAllColumns()),o(e.getAllCards());}),[e]);let i=useCallback(h=>{e.updateBoard(h);},[e]),c=useCallback(h=>{e.addColumn(h);},[e]),l=useCallback((h,x)=>{e.updateColumn(h,x);},[e]),u=useCallback(h=>{e.deleteColumn(h);},[e]),p=useCallback(h=>e.getColumn(h),[e]),d=useCallback(h=>{e.addCard(h);},[e]),m=useCallback((h,x)=>{e.updateCard(h,x);},[e]),f=useCallback(h=>{e.deleteCard(h);},[e]),v=useCallback((h,x,y)=>{e.moveCard(h,x,y);},[e]),b=useCallback(h=>e.getCard(h),[e]),w=useCallback(h=>e.getCardsByColumn(h),[e]);return {board:t,columns:r,cards:s,updateBoard:i,addColumn:c,updateColumn:l,deleteColumn:u,getColumn:p,addCard:d,updateCard:m,deleteCard:f,moveCard:v,getCard:b,getCardsByColumn:w}}function zh(e){let{cards:t}=ul();return useMemo(()=>e?t.filter(a=>{if(e.searchQuery){let r=e.searchQuery.toLowerCase(),n=a.title.toLowerCase().includes(r),s=a.description?.toLowerCase().includes(r);if(!n&&!s)return false}return !(e.priorities&&e.priorities.length>0&&(!a.priority||!e.priorities.includes(a.priority))||e.statuses&&e.statuses.length>0&&(!a.status||!e.statuses.includes(a.status))||e.assignedUserIds&&e.assignedUserIds.length>0&&!e.assignedUserIds.some(n=>a.isAssignedTo(n))||e.labels&&e.labels.length>0&&!e.labels.some(n=>a.hasLabel(n))||e.columnIds&&e.columnIds.length>0&&!e.columnIds.includes(a.columnId)||e.isOverdue!==void 0&&e.isOverdue!==a.isOverdue())}):t,[t,e])}function Uh(e="position",t="asc"){let{cards:a}=ul();return useMemo(()=>[...a].sort((n,s)=>{let o=0;switch(e){case "title":o=n.title.localeCompare(s.title);break;case "priority":{let i={URGENT:4,HIGH:3,MEDIUM:2,LOW:1},c=n.priority?i[n.priority]:0,l=s.priority?i[s.priority]:0;o=c-l;break}case "createdAt":o=n.createdAt.getTime()-s.createdAt.getTime();break;case "updatedAt":o=n.updatedAt.getTime()-s.updatedAt.getTime();break;case "position":o=n.position-s.position;break}return t==="asc"?o:-o}),[a,e,t])}var Zc=class{constructor(){this.plugins=new Map;this.enabled=new Set;this.config=new Map;this.context=null;this.pluginLogger=hm.child("PluginManager");}setContext(t){this.context=t;}register(t){if(!t.id||!t.name||!t.version)throw new Error("Plugin must have id, name, and version");if(this.plugins.has(t.id)&&this.pluginLogger.warn(`Plugin ${t.id} is already registered, overwriting...`),t.dependencies){for(let a of t.dependencies)if(!this.plugins.has(a))throw new Error(`Plugin ${t.id} depends on ${a} which is not registered`)}this.plugins.set(t.id,t),t.defaultConfig&&this.config.set(t.id,{...t.defaultConfig}),this.enabled.add(t.id),this.pluginLogger.info(`Plugin registered: ${t.name} v${t.version}`),t.onInit&&this.context&&Promise.resolve(t.onInit(this.context)).catch(a=>{this.pluginLogger.error(`Failed to initialize plugin ${t.id}`,a,{plugin:t.id});});}unregister(t){let a=this.plugins.get(t);if(!a){this.pluginLogger.warn(`Plugin ${t} is not registered`);return}a.onDestroy&&Promise.resolve(a.onDestroy()).catch(r=>{this.pluginLogger.error(`Failed to destroy plugin ${t}`,r);}),this.plugins.delete(t),this.enabled.delete(t),this.config.delete(t),this.pluginLogger.info(`Plugin unregistered: ${a.name}`);}getPlugin(t){return this.plugins.get(t)}getPlugins(){return Array.from(this.plugins.values())}hasPlugin(t){return this.plugins.has(t)}setEnabled(t,a){if(!this.plugins.has(t))throw new Error(`Plugin ${t} is not registered`);a?(this.enabled.add(t),this.pluginLogger.info(`Plugin enabled: ${t}`)):(this.enabled.delete(t),this.pluginLogger.info(`Plugin disabled: ${t}`));}isEnabled(t){return this.enabled.has(t)}getConfig(t,a){return this.config.get(t)?.[a]}setConfig(t,a,r){this.config.has(t)||this.config.set(t,{});let n=this.config.get(t);n[a]=r,this.pluginLogger.debug(`Plugin config set: ${t}.${a}`,{value:r});}async executeHook(t,a,r){let n=r;for(let s of this.plugins.values()){if(!this.enabled.has(s.id))continue;let o=s[t];if(typeof o=="function")try{let i=await Promise.resolve(o.apply(s,a));i!==void 0&&(n=i,a[0]=i);}catch(i){this.pluginLogger.error(`Plugin hook failed: ${s.id}.${t}`,i,{plugin:s.id,hook:t});}}return n}async executeHookParallel(t,a){let r=[];for(let n of this.plugins.values()){if(!this.enabled.has(n.id))continue;let s=n[t];typeof s=="function"&&r.push(Promise.resolve(s.apply(n,a)).catch(o=>{this.pluginLogger.error(`Plugin hook failed: ${n.id}.${t}`,o,{plugin:n.id,hook:t});}));}await Promise.all(r);}},bT=new Zc;function Vh({items:e,height:t,estimateSize:a,renderItem:r,className:n="",overscan:s=5,horizontal:o=false,gap:i=0,getItemKey:c}){let l=useRef(null),u=useVirtualizer({count:e.length,getScrollElement:()=>l.current,estimateSize:()=>a,overscan:s,horizontal:o,gap:i}),p=u.getVirtualItems(),d={height:typeof t=="number"?`${t}px`:t,width:"100%",overflow:"auto",position:"relative"},m=o?{width:`${u.getTotalSize()}px`,height:"100%",position:"relative"}:{height:`${u.getTotalSize()}px`,width:"100%",position:"relative"};return jsx("div",{ref:l,style:d,className:n,children:jsx("div",{style:m,children:p.map(f=>{let v=e[f.index];if(!v)return null;let b=c?c(v,f.index):f.index,w={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:w,"data-index":f.index,children:r(v,f.index)},b)})})})}function Gh(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 Kh({items:e,height:t,width:a="100%",estimateColumnWidth:r,renderColumn:n,className:s="",overscan:o=3,gap:i=16,getItemKey:c,horizontal:l=true}){let u=useRef(null),p=useVirtualizer({horizontal:l,count:e.length,getScrollElement:()=>u.current,estimateSize:()=>r,overscan:o,gap:i}),d=p.getVirtualItems(),m={height:typeof t=="number"?`${t}px`:t,width:typeof a=="number"?`${a}px`:a,overflow:"auto",position:"relative"},f={width:`${p.getTotalSize()}px`,height:"100%",position:"relative"};return jsx("div",{ref:u,style:m,className:s,children:jsx("div",{style:f,children:d.map(v=>{let b=e[v.index];if(!b)return null;let w=c?c(b,v.index):v.index,h={position:"absolute",top:0,left:v.start,width:v.size,height:"100%"};return jsx("div",{style:h,"data-index":v.index,children:n(b,v.index)},w)})})})}function qh(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 Yh(e,t=10){return e>t}var Pp={none:0,xs:4,sm:8,md:12,lg:16,xl:20,"2xl":24,"3xl":32,"4xl":40,"5xl":48,"6xl":64},Fp={none:0,sm:4,md:8,lg:12,xl:16,"2xl":20,full:9999},Lp={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48},Ap={light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800},Ip={none:1,tight:1.25,snug:1.375,normal:1.5,relaxed:1.625,loose:2},Rp={base:0,dropdown:1e3,sticky:1020,fixed:1030,modalBackdrop:1040,modal:1050,popover:1060,tooltip:1070},Bp={instant:0,fastest:75,faster:100,fast:150,normal:200,slow:300,slower:400,slowest:500},$p={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)"},Op={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)"},Hp={0:0,5:.05,10:.1,20:.2,30:.3,40:.4,50:.5,60:.6,70:.7,80:.8,90:.9,100:1},Wp={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}},zp={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}},ed={spacing:Pp,borderRadius:Fp,fontSize:Lp,fontWeight:Ap,lineHeight:Ip,zIndex:Rp,duration:Bp,easing:$p,shadows:Op,opacity:Hp,kanban:Wp,gantt:zp};function Xh(e,t,a){return e[t]??a}function Up(e,t="",a={}){for(let[r,n]of Object.entries(e)){let s=t?`${t}-${r}`:r;typeof n=="object"&&n!==null&&!Array.isArray(n)?Up(n,s,a):(typeof n=="string"||typeof n=="number")&&(a[s]=n);}return a}function xT(e){return typeof e=="number"?e>0&&e<1e3?`${e}px`:e.toString():e}function jp(e="asakaa"){let t=Up(ed),a=[];for(let[r,n]of Object.entries(t)){let s=`--${e}-${r}`,o=xT(n);a.push(` ${s}: ${o};`);}return `:root {
|
|
415
415
|
${a.join(`
|
|
416
416
|
`)}
|
|
417
|
-
}`}function
|
|
417
|
+
}`}function pl(e,t="asakaa"){let a=[],r=Up(e);for(let[n,s]of Object.entries(r)){let o=`--${t}-color-${n}`;a.push(` ${o}: ${s};`);}return `:root {
|
|
418
418
|
${a.join(`
|
|
419
419
|
`)}
|
|
420
|
-
}`}var
|
|
420
|
+
}`}var td={background:{primary:"#1a1a1a",secondary:"#2a2a2a",tertiary:"#3a3a3a",card:"#2d2d2d",hover:"#353535",active:"#404040"},text:{primary:"#ffffff",secondary:"#b0b0b0",tertiary:"#808080",disabled:"#606060",inverse:"#1a1a1a"},border:{default:"#404040",hover:"#505050",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#6b7280",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#404040",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#2a2a2a"}},Vp={background:{primary:"#ffffff",secondary:"#f9fafb",tertiary:"#f3f4f6",card:"#ffffff",hover:"#f3f4f6",active:"#e5e7eb"},text:{primary:"#111827",secondary:"#6b7280",tertiary:"#9ca3af",disabled:"#d1d5db",inverse:"#ffffff"},border:{default:"#e5e7eb",hover:"#d1d5db",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#16a34a",warning:"#d97706",error:"#dc2626",info:"#00C4AE"},priority:{low:"#9ca3af",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#6b7280",secondaryHover:"#4b5563",secondaryActive:"#374151"},gantt:{gridLine:"#e5e7eb",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#6b7280",weekend:"#f9fafb"}},Gp={background:{primary:"#18181b",secondary:"#27272a",tertiary:"#3f3f46",card:"#27272a",hover:"#3f3f46",active:"#52525b"},text:{primary:"#fafafa",secondary:"#a1a1aa",tertiary:"#71717a",disabled:"#52525b",inverse:"#18181b"},border:{default:"#3f3f46",hover:"#52525b",focus:"#0ea5e9",active:"#0284c7"},status:{success:"#22c55e",warning:"#f59e0b",error:"#ef4444",info:"#00E5CC"},priority:{low:"#71717a",medium:"#00E5CC",high:"#f59e0b",urgent:"#ef4444"},interactive:{primary:"#0ea5e9",primaryHover:"#0284c7",primaryActive:"#0369a1",secondary:"#71717a",secondaryHover:"#52525b",secondaryActive:"#3f3f46"},gantt:{gridLine:"#3f3f46",todayLine:"#0ea5e9",taskBackground:"#00E5CC",taskBorder:"#00C4AE",criticalPath:"#ef4444",milestone:"#00E5CC",dependency:"#71717a",weekend:"#27272a"}};function _p(e=td,t="asakaa"){let a=jp(t),r=pl(e,t);return `${a}
|
|
421
421
|
|
|
422
|
-
${r}`}function
|
|
422
|
+
${r}`}function Jh(){return `/**
|
|
423
423
|
* ASAKAA Design Tokens
|
|
424
424
|
* Auto-generated from design-tokens.ts
|
|
425
425
|
* Do not edit this file directly
|
|
426
426
|
*/
|
|
427
427
|
|
|
428
|
-
${
|
|
428
|
+
${_p(td)}
|
|
429
429
|
|
|
430
430
|
/* Light theme */
|
|
431
431
|
[data-theme="light"] {
|
|
432
|
-
${
|
|
432
|
+
${pl(Vp,"asakaa").split(`
|
|
433
433
|
`).slice(1,-1).join(`
|
|
434
434
|
`)}
|
|
435
435
|
}
|
|
436
436
|
|
|
437
437
|
/* Neutral theme */
|
|
438
438
|
[data-theme="neutral"] {
|
|
439
|
-
${
|
|
439
|
+
${pl(Gp,"asakaa").split(`
|
|
440
440
|
`).slice(1,-1).join(`
|
|
441
441
|
`)}
|
|
442
442
|
}
|
|
443
|
-
`}var
|
|
444
|
-
export{
|
|
443
|
+
`}var vT=({theme:e})=>{switch(e){case "dark":return jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13.5 8.5C13.5 11.2614 11.2614 13.5 8.5 13.5C5.73858 13.5 3.5 11.2614 3.5 8.5C3.5 5.73858 5.73858 3.5 8.5 3.5C8.66667 3.5 8.83074 3.50926 8.99199 3.52734C8.10635 4.35233 7.5 5.53318 7.5 6.85C7.5 9.33579 9.49421 11.33 11.98 11.33C12.5933 11.33 13.1751 11.2075 13.7069 10.9844C13.5698 11.8951 13.2042 12.7349 12.6674 13.4367",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});case "light":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M8 1V2M8 14V15M15 8H14M2 8H1M12.5 12.5L11.8 11.8M4.2 4.2L3.5 3.5M12.5 3.5L11.8 4.2M4.2 11.8L3.5 12.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]});case "neutral":return jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),jsx("path",{d:"M5 8L8 8L8 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}};function Qh({showLabels:e=true,compact:t=false,className:a=""}){let{theme:r,setTheme:n,themes:s}=Vs();return jsx("div",{className:`theme-switcher ${t?"theme-switcher--compact":""} ${a}`,children:Object.entries(s).map(([o,i])=>{let c=o,l=c===r;return jsxs("button",{onClick:()=>n(c),className:`theme-switcher__button ${l?"theme-switcher__button--active":""}`,"aria-label":`Switch to ${i.displayName} theme`,"aria-pressed":l,title:i.displayName,children:[jsx("span",{className:"theme-switcher__icon","aria-hidden":"true",children:jsx(vT,{theme:c})}),e&&!t&&jsx("span",{className:"theme-switcher__label",children:i.displayName})]},c)})})}
|
|
444
|
+
export{kh as AIUsageDashboard,Q5 as AI_FEATURES,Cp as AI_MODELS,Hd as AddCardButton,Id as AddColumnButton,zs as AttachmentUploader,Hh as BoardProvider,Kl as BulkOperationsToolbar,Kd as BurnDownChart,Eb as CUSTOM_FIELD_TYPES,sh as CalendarBoard,fo as Card,mh as CardHistoryReplay,uh as CardHistoryTimeline,bh as CardRelationshipsGraph,j5 as CardStack,eu as CardTemplateSelector,ud as CircuitBreaker,Bs as Column,ec as ColumnManager,Ud as CommandPalette,nu as ConfigMenu,_s as ContextMenu,Bi as DEFAULT_SHORTCUTS,Nb as DEFAULT_TABLE_COLUMNS,Zd as DEFAULT_TEMPLATES,vi as DateRangePicker,ki as DependenciesSelector,_i as DependencyLine,qd as DistributionCharts,wd as EditableColumnTitle,Ws as ErrorBoundary,u0 as ExportDropdown,au as ExportImportModal,ru as FilterBar,tf as GANTT_AI_SYSTEM_PROMPT,hc as GanttAIAssistant,Q0 as GanttBoard,ls as GanttI18nContext,lc as GanttMilestone,Ql as GanttToolbar,Dh as GenerateGanttTasksDialog,xh as GeneratePlanModal,Jd as GroupBySelector,Sd as HealthBar,$o as KanbanBoard,Ld as KanbanToolbar,Ii as KanbanViewAdapter,Qd as KeyboardShortcutsHelp,Db as ListView,ha as MenuIcons,Zc as PluginManager,os as PrioritySelector,Ed as ProfitabilityReport,Li as QuickTaskCreate,J5 as RATE_LIMITS,Sb as STANDARD_FIELDS,Yd as SwimlaneBoardView,cc as TODOS_LOS_DIAS,Cd as TagBadge,ng as TagList,$s as TagPicker,rc as TaskBar,ds as TaskDetailModal,ef as TaskFormModal,ac as TaskGrid,lu as ThemeModal,e0 as ThemeProvider,Qh as ThemeSwitcher,eo as TimeInputPopover,Td as TimePill,Dd as TimePopover,gc as Timeline,Po as UserAssignmentSelector,_d as VelocityChart,Kh as VirtualGrid,Vh as VirtualList,Ms as aiUsageTracker,Fp as borderRadius,zc as buildCalendar,kl as calculatePosition,Ko as calendarioDe,Cc as cardToGanttTask,cf as cardsToGanttTasks,g as cn,mc as conflictosDelCronograma,Ig as createKanbanView,by as createRetryWrapper,ou as darkTheme,td as darkTokenTheme,Yl as defaultTheme,ed as designTokens,Bp as duration,$p as easing,Js as empujarSucesoras,ws as enlacesDe,Jh as exportTokensToCSS,Ki as fechasQueCumplen,dc as finConDuracion,Co as findTaskByName,Lp as fontSize,Ap as fontWeight,ll as formatCost,Ci as ganttEnTranslations,Om as ganttEsTranslations,lf as ganttTaskToCardUpdate,Dt as ganttThemes,zp as ganttTokens,yd as ganttTranslations,$e as ganttUtils,jp as generateCSSVariables,_p as generateCompleteCSS,py as generateInitialPositions,af as generateTasksContext,pl as generateThemeVariables,Mb as getListViewTheme,Ou as getListViewTranslations,Xh as getToken,Hm as getTranslations,Xs as habilDesde,vs as habilesEntre,Wp as kanbanTokens,su as lightTheme,Vp as lightTokenTheme,pc as limiteDelEnlace,Ip as lineHeight,up as listViewDarkTheme,Bu as listViewEnTranslations,$u as listViewEsTranslations,pp as listViewLightTheme,mp as listViewNeutralTheme,Hc as listViewThemes,Tc as listViewTranslations,Dc as mergeListViewTranslations,xd as mergeTranslations,iu as neutralTheme,Gp as neutralTokenTheme,Hp as opacity,of as parseLocalCommand,Lu as parseNaturalDate,Au as parseNaturalDuration,Iu as parseProgress,nf as parseStatus,bT as pluginManager,fy as retrySyncOperation,Cl as retryWithBackoff,Op as shadows,Yh as shouldVirtualizeGrid,Kc as simulateReschedule,Pp as spacing,_o as sumarHabiles,ps as themes,Ih as useAI,Sh as useBoard,ul as useBoardCore,Qc as useBoardStore,$h as useCardStacking,Pd as useDragState,zh as useFilteredCards,Ph as useFilters,Rr as useGanttI18n,Jc as useKanbanState,Jg as useKeyboardShortcuts,Rh as useMultiSelect,Np as useSelectionState,Uh as useSortedCards,Vs as useTheme,qh as useVirtualGrid,Gh as useVirtualList,sf as validateAIResponse,Wd as withErrorBoundary,Nl as wouldCreateCircularDependency,Rp as zIndex};//# sourceMappingURL=index.js.map
|
|
445
445
|
//# sourceMappingURL=index.js.map
|